Class: Appwrite::Organization
- Defined in:
- lib/appwrite/services/organization.rb
Instance Method Summary collapse
-
#create_installation(app_id:, authorization_details: nil) ⇒ AppInstallation
Install an app on the organization.
-
#create_key(key_id:, name:, scopes:, expire: nil) ⇒ Key
Create a new organization API key.
-
#create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) ⇒ Membership
Invite a new member to join the current organization.
-
#create_project(project_id:, name:, region: nil) ⇒ Project
Create a new project.
-
#delete ⇒ Object
Delete the current organization.
-
#delete_installation(installation_id:) ⇒ Object
Uninstall an app from the organization by its installation ID.
-
#delete_key(key_id:) ⇒ Object
Delete a key by its unique ID.
-
#delete_membership(membership_id:) ⇒ Object
Remove a member from the current organization.
-
#delete_project(project_id:) ⇒ Object
Delete a project by its unique ID.
-
#get ⇒ Organization
Get the current organization.
-
#get_installation(installation_id:) ⇒ AppInstallation
Get an app installation on the organization by its unique ID.
-
#get_key(key_id:) ⇒ Key
Get a key by its unique ID.
-
#get_membership(membership_id:) ⇒ Membership
Get a membership from the current organization by its unique ID.
-
#get_project(project_id:) ⇒ Project
Get a project.
-
#initialize(client) ⇒ Organization
constructor
A new instance of Organization.
-
#list_installations(queries: nil, total: nil) ⇒ AppInstallationList
List app installations on the organization.
-
#list_keys(queries: nil, total: nil) ⇒ KeyList
Get a list of all API keys from the current organization.
-
#list_memberships(queries: nil, search: nil, total: nil) ⇒ MembershipList
Get a list of all memberships from the current organization.
-
#list_projects(queries: nil, search: nil, total: nil) ⇒ ProjectList
Get a list of all projects.
-
#update(name:) ⇒ Organization
Update the current organization's name.
-
#update_installation(installation_id:, authorization_details: nil) ⇒ AppInstallation
Update an app installation on the organization.
-
#update_key(key_id:, name:, scopes:, expire: nil) ⇒ Key
Update a key by its unique ID.
-
#update_membership(membership_id:, roles:) ⇒ Membership
Modify the roles of a member in the current organization.
-
#update_project(project_id:, name:) ⇒ Project
Update a project by its unique ID.
Constructor Details
#initialize(client) ⇒ Organization
Returns a new instance of Organization.
6 7 8 |
# File 'lib/appwrite/services/organization.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_installation(app_id:, authorization_details: nil) ⇒ AppInstallation
Install an app on the organization. Only organization members with the owner role can install apps. The installation is granted the scopes the app currently requests.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/appwrite/services/organization.rb', line 130 def create_installation(app_id:, authorization_details: nil) api_path = '/organization/installations' if app_id.nil? raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { appId: app_id, authorizationDetails: , } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AppInstallation ) end |
#create_key(key_id:, name:, scopes:, expire: nil) ⇒ Key
Create a new organization API key.
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/appwrite/services/organization.rb', line 297 def create_key(key_id:, name:, scopes:, expire: nil) api_path = '/organization/keys' if key_id.nil? raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { keyId: key_id, name: name, scopes: scopes, expire: expire, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Key ) end |
#create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) ⇒ Membership
Invite a new member to join the current organization. An email with a link to join the organization will be sent to the new member's email address. If member doesn't exist in the project it will be automatically created.
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/appwrite/services/organization.rb', line 488 def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) api_path = '/organization/memberships' if roles.nil? raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { email: email, userId: user_id, phone: phone, roles: roles, url: url, name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Membership ) end |
#create_project(project_id:, name:, region: nil) ⇒ Project
Create a new project.
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/appwrite/services/organization.rb', line 660 def create_project(project_id:, name:, region: nil) api_path = '/organization/projects' if project_id.nil? raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { projectId: project_id, name: name, region: region, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Project ) end |
#delete ⇒ Object
Delete the current organization. All projects that belong to the organization are deleted as well.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/appwrite/services/organization.rb', line 72 def delete() api_path = '/organization' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_installation(installation_id:) ⇒ Object
Uninstall an app from the organization by its installation ID. Only organization members with the owner role can remove installations. Previously issued installation access tokens are revoked.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/appwrite/services/organization.rb', line 234 def delete_installation(installation_id:) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_key(key_id:) ⇒ Object
Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/appwrite/services/organization.rb', line 420 def delete_key(key_id:) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? raise Appwrite::Exception.new('Missing required parameter: "keyId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_membership(membership_id:) ⇒ Object
Remove a member from the current organization. The member is removed whether they accepted the invitation or not; a pending invitation is revoked.
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
# File 'lib/appwrite/services/organization.rb', line 596 def delete_membership(membership_id:) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_project(project_id:) ⇒ Object
Delete a project by its unique ID.
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/appwrite/services/organization.rb', line 766 def delete_project(project_id:) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? raise Appwrite::Exception.new('Missing required parameter: "projectId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get ⇒ Organization
Get the current organization.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/appwrite/services/organization.rb', line 14 def get() api_path = '/organization' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Organization ) end |
#get_installation(installation_id:) ⇒ AppInstallation
Get an app installation on the organization by its unique ID. Any organization member can read installations.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/appwrite/services/organization.rb', line 164 def get_installation(installation_id:) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::AppInstallation ) end |
#get_key(key_id:) ⇒ Key
Get a key by its unique ID. This endpoint returns details about a specific API key in your organization including its scopes.
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/appwrite/services/organization.rb', line 341 def get_key(key_id:) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? raise Appwrite::Exception.new('Missing required parameter: "keyId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Key ) end |
#get_membership(membership_id:) ⇒ Membership
Get a membership from the current organization by its unique ID.
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
# File 'lib/appwrite/services/organization.rb', line 525 def get_membership(membership_id:) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Membership ) end |
#get_project(project_id:) ⇒ Project
Get a project.
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
# File 'lib/appwrite/services/organization.rb', line 698 def get_project(project_id:) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? raise Appwrite::Exception.new('Missing required parameter: "projectId"') end api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Project ) end |
#list_installations(queries: nil, total: nil) ⇒ AppInstallationList
List app installations on the organization. Any organization member can read installations.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/appwrite/services/organization.rb', line 99 def list_installations(queries: nil, total: nil) api_path = '/organization/installations' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::AppInstallationList ) end |
#list_keys(queries: nil, total: nil) ⇒ KeyList
Get a list of all API keys from the current organization.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/appwrite/services/organization.rb', line 266 def list_keys(queries: nil, total: nil) api_path = '/organization/keys' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::KeyList ) end |
#list_memberships(queries: nil, search: nil, total: nil) ⇒ MembershipList
Get a list of all memberships from the current organization.
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/appwrite/services/organization.rb', line 452 def list_memberships(queries: nil, search: nil, total: nil) api_path = '/organization/memberships' api_params = { queries: queries, search: search, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::MembershipList ) end |
#list_projects(queries: nil, search: nil, total: nil) ⇒ ProjectList
Get a list of all projects. You can use the query params to filter your results.
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/appwrite/services/organization.rb', line 629 def list_projects(queries: nil, search: nil, total: nil) api_path = '/organization/projects' api_params = { queries: queries, search: search, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProjectList ) end |
#update(name:) ⇒ Organization
Update the current organization's name.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/appwrite/services/organization.rb', line 40 def update(name:) api_path = '/organization' if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Organization ) end |
#update_installation(installation_id:, authorization_details: nil) ⇒ AppInstallation
Update an app installation on the organization. Only organization members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/appwrite/services/organization.rb', line 199 def update_installation(installation_id:, authorization_details: nil) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { authorizationDetails: , } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::AppInstallation ) end |
#update_key(key_id:, name:, scopes:, expire: nil) ⇒ Key
Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/appwrite/services/organization.rb', line 376 def update_key(key_id:, name:, scopes:, expire: nil) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { name: name, scopes: scopes, expire: expire, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Key ) end |
#update_membership(membership_id:, roles:) ⇒ Membership
Modify the roles of a member in the current organization.
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/appwrite/services/organization.rb', line 557 def update_membership(membership_id:, roles:) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if roles.nil? raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { roles: roles, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Membership ) end |
#update_project(project_id:, name:) ⇒ Project
Update a project by its unique ID.
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/appwrite/services/organization.rb', line 729 def update_project(project_id:, name:) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Project ) end |