appwrite 26.0.0 → 27.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +16 -2
  3. data/lib/appwrite/enums/authentication_factor.rb +1 -0
  4. data/lib/appwrite/enums/build_runtime.rb +1 -0
  5. data/lib/appwrite/enums/database_status.rb +11 -0
  6. data/lib/appwrite/enums/database_type.rb +3 -0
  7. data/lib/appwrite/enums/embedding_model.rb +10 -0
  8. data/lib/appwrite/enums/invalidation_type.rb +9 -0
  9. data/lib/appwrite/enums/organization_key_scopes.rb +2 -0
  10. data/lib/appwrite/enums/project_key_scopes.rb +5 -0
  11. data/lib/appwrite/enums/project_policy_id.rb +1 -0
  12. data/lib/appwrite/enums/runtime.rb +1 -0
  13. data/lib/appwrite/models/activity_event.rb +58 -3
  14. data/lib/appwrite/models/app.rb +152 -0
  15. data/lib/appwrite/models/app_installation.rb +72 -0
  16. data/lib/appwrite/models/app_installation_list.rb +32 -0
  17. data/lib/appwrite/models/app_key.rb +67 -0
  18. data/lib/appwrite/models/app_key_list.rb +32 -0
  19. data/lib/appwrite/models/app_scope.rb +47 -0
  20. data/lib/appwrite/models/app_scope_list.rb +32 -0
  21. data/lib/appwrite/models/app_secret.rb +67 -0
  22. data/lib/appwrite/models/app_secret_list.rb +32 -0
  23. data/lib/appwrite/models/app_secret_plaintext.rb +67 -0
  24. data/lib/appwrite/models/apps_list.rb +32 -0
  25. data/lib/appwrite/models/billing_plan.rb +9 -4
  26. data/lib/appwrite/models/billing_plan_addon.rb +6 -6
  27. data/lib/appwrite/models/billing_plan_addon_details.rb +1 -1
  28. data/lib/appwrite/models/database.rb +35 -6
  29. data/lib/appwrite/models/database_migration.rb +102 -0
  30. data/lib/appwrite/models/database_migration_list.rb +32 -0
  31. data/lib/appwrite/models/database_status.rb +92 -0
  32. data/lib/appwrite/models/database_status_connections.rb +32 -0
  33. data/lib/appwrite/models/database_status_replica.rb +42 -0
  34. data/lib/appwrite/models/database_status_volume.rb +42 -0
  35. data/lib/appwrite/models/dedicated_database.rb +262 -0
  36. data/lib/appwrite/models/dedicated_database_member.rb +42 -0
  37. data/lib/appwrite/models/dedicated_database_operation.rb +77 -0
  38. data/lib/appwrite/models/dedicated_database_operation_list.rb +32 -0
  39. data/lib/appwrite/models/dedicated_database_replicas.rb +62 -0
  40. data/lib/appwrite/models/dedicated_database_specification.rb +67 -0
  41. data/lib/appwrite/models/dedicated_database_specification_list.rb +37 -0
  42. data/lib/appwrite/models/dedicated_database_specification_pricing.rb +42 -0
  43. data/lib/appwrite/models/embedding.rb +42 -0
  44. data/lib/appwrite/models/embedding_list.rb +32 -0
  45. data/lib/appwrite/models/file.rb +10 -0
  46. data/lib/appwrite/models/mfa_challenge_secret.rb +47 -0
  47. data/lib/appwrite/models/mfa_factors.rb +8 -3
  48. data/lib/appwrite/models/oauth2_approve.rb +27 -0
  49. data/lib/appwrite/models/oauth2_authorize.rb +32 -0
  50. data/lib/appwrite/models/oauth2_consent.rb +72 -0
  51. data/lib/appwrite/models/oauth2_consent_list.rb +32 -0
  52. data/lib/appwrite/models/oauth2_consent_token.rb +77 -0
  53. data/lib/appwrite/models/oauth2_consent_token_list.rb +32 -0
  54. data/lib/appwrite/models/oauth2_device_authorization.rb +52 -0
  55. data/lib/appwrite/models/oauth2_grant.rb +82 -0
  56. data/lib/appwrite/models/oauth2_organization.rb +27 -0
  57. data/lib/appwrite/models/oauth2_organization_list.rb +32 -0
  58. data/lib/appwrite/models/oauth2_par.rb +32 -0
  59. data/lib/appwrite/models/oauth2_project.rb +37 -0
  60. data/lib/appwrite/models/oauth2_project_list.rb +32 -0
  61. data/lib/appwrite/models/oauth2_reject.rb +27 -0
  62. data/lib/appwrite/models/oauth2_token.rb +57 -0
  63. data/lib/appwrite/models/organization.rb +12 -12
  64. data/lib/appwrite/models/policy_mfa_factors.rb +47 -0
  65. data/lib/appwrite/models/project.rb +15 -0
  66. data/lib/appwrite/models/project_auth_method.rb +3 -3
  67. data/lib/appwrite/models/proxy_invalidation.rb +42 -0
  68. data/lib/appwrite/models/usage_billing_plan.rb +9 -9
  69. data/lib/appwrite/services/account.rb +210 -33
  70. data/lib/appwrite/services/activities.rb +1 -1
  71. data/lib/appwrite/services/apps.rb +855 -0
  72. data/lib/appwrite/services/backups.rb +31 -12
  73. data/lib/appwrite/services/databases.rb +4 -4
  74. data/lib/appwrite/services/embeddings.rb +48 -0
  75. data/lib/appwrite/services/functions.rb +1 -1
  76. data/lib/appwrite/services/oauth2.rb +525 -0
  77. data/lib/appwrite/services/organization.rb +168 -0
  78. data/lib/appwrite/services/project.rb +54 -57
  79. data/lib/appwrite/services/proxy.rb +44 -0
  80. data/lib/appwrite/services/sites.rb +4 -2
  81. data/lib/appwrite/services/storage.rb +4 -2
  82. data/lib/appwrite/services/tables_db.rb +378 -6
  83. data/lib/appwrite/services/teams.rb +198 -0
  84. data/lib/appwrite/services/users.rb +38 -0
  85. data/lib/appwrite.rb +50 -0
  86. metadata +52 -2
@@ -46,9 +46,11 @@ module Appwrite
46
46
  # @param [String] name Database name. Max length: 128 chars.
47
47
  # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
48
48
  # @param [String] specification Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification.
49
+ # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0.
50
+ # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
49
51
  #
50
52
  # @return [Database]
51
- def create(database_id:, name:, enabled: nil, specification: nil)
53
+ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, sync_mode: nil)
52
54
  api_path = '/tablesdb'
53
55
 
54
56
  if database_id.nil?
@@ -64,6 +66,8 @@ module Appwrite
64
66
  name: name,
65
67
  enabled: enabled,
66
68
  specification: specification,
69
+ replicas: replicas,
70
+ syncMode: sync_mode,
67
71
  }
68
72
 
69
73
  api_headers = {
@@ -82,6 +86,33 @@ module Appwrite
82
86
 
83
87
  end
84
88
 
89
+ # List the dedicated database specifications available on the current plan.
90
+ # Each specification reports its resource limits, pricing, and whether it is
91
+ # enabled for the organization.
92
+ #
93
+ #
94
+ # @return [DedicatedDatabaseSpecificationList]
95
+ def list_specifications()
96
+ api_path = '/tablesdb/specifications'
97
+
98
+ api_params = {
99
+ }
100
+
101
+ api_headers = {
102
+ "X-Appwrite-Project": @client.get_config('project'),
103
+ "accept": 'application/json',
104
+ }
105
+
106
+ @client.call(
107
+ method: 'GET',
108
+ path: api_path,
109
+ headers: api_headers,
110
+ params: api_params,
111
+ response_type: Models::DedicatedDatabaseSpecificationList
112
+ )
113
+
114
+ end
115
+
85
116
  # List transactions across all databases.
86
117
  #
87
118
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
@@ -305,9 +336,12 @@ module Appwrite
305
336
  # @param [String] database_id Database ID.
306
337
  # @param [String] name Database name. Max length: 128 chars.
307
338
  # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
339
+ # @param [String] specification Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize.
340
+ # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0.
341
+ # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
308
342
  #
309
343
  # @return [Database]
310
- def update(database_id:, name: nil, enabled: nil)
344
+ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: nil, sync_mode: nil)
311
345
  api_path = '/tablesdb/{databaseId}'
312
346
  .gsub('{databaseId}', database_id)
313
347
 
@@ -318,6 +352,9 @@ module Appwrite
318
352
  api_params = {
319
353
  name: name,
320
354
  enabled: enabled,
355
+ specification: specification,
356
+ replicas: replicas,
357
+ syncMode: sync_mode,
321
358
  }
322
359
 
323
360
  api_headers = {
@@ -367,6 +404,341 @@ module Appwrite
367
404
 
368
405
  end
369
406
 
407
+ # Trigger a manual failover for a dedicated database with high availability
408
+ # enabled. Promotes a replica to primary. The failover runs asynchronously;
409
+ # poll the database document for status updates. A database left
410
+ # mid-operation by a failover that did not finish also accepts this call as a
411
+ # repair, provided `targetReplicaId` names the member to promote.
412
+ #
413
+ # @param [String] database_id Database ID.
414
+ # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected.
415
+ #
416
+ # @return [DedicatedDatabase]
417
+ def create_failover(database_id:, target_replica_id: nil)
418
+ api_path = '/tablesdb/{databaseId}/failovers'
419
+ .gsub('{databaseId}', database_id)
420
+
421
+ if database_id.nil?
422
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
423
+ end
424
+
425
+ api_params = {
426
+ targetReplicaId: target_replica_id,
427
+ }
428
+
429
+ api_headers = {
430
+ "X-Appwrite-Project": @client.get_config('project'),
431
+ "content-type": 'application/json',
432
+ "accept": 'application/json',
433
+ }
434
+
435
+ @client.call(
436
+ method: 'POST',
437
+ path: api_path,
438
+ headers: api_headers,
439
+ params: api_params,
440
+ response_type: Models::DedicatedDatabase
441
+ )
442
+
443
+ end
444
+
445
+ # List the dedicated migrations for a TablesDB database. A database has at
446
+ # most one in-flight migration.
447
+ #
448
+ # @param [String] database_id Database ID.
449
+ #
450
+ # @return [DatabaseMigrationList]
451
+ def list_migrations(database_id:)
452
+ api_path = '/tablesdb/{databaseId}/migrations'
453
+ .gsub('{databaseId}', database_id)
454
+
455
+ if database_id.nil?
456
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
457
+ end
458
+
459
+ api_params = {
460
+ }
461
+
462
+ api_headers = {
463
+ "X-Appwrite-Project": @client.get_config('project'),
464
+ "accept": 'application/json',
465
+ }
466
+
467
+ @client.call(
468
+ method: 'GET',
469
+ path: api_path,
470
+ headers: api_headers,
471
+ params: api_params,
472
+ response_type: Models::DatabaseMigrationList
473
+ )
474
+
475
+ end
476
+
477
+ # Start migrating a serverless TablesDB database onto a dedicated MySQL
478
+ # compute. Data is copied to the target while the source stays live, with a
479
+ # brief read-only window during cutover.
480
+ #
481
+ # @param [String] database_id Database ID.
482
+ # @param [String] specification Dedicated compute specification to provision as the migration target (e.g. s-2vcpu-4gb). The migration always targets a dedicated compute, so `serverless` is not accepted.
483
+ # @param [] auto_cutover Whether to cut over automatically once the copy is verified. When disabled the migration parks at ready_to_cutover and holds there until the cutover is performed manually.
484
+ #
485
+ # @return [DatabaseMigration]
486
+ def create_migration(database_id:, specification:, auto_cutover: nil)
487
+ api_path = '/tablesdb/{databaseId}/migrations'
488
+ .gsub('{databaseId}', database_id)
489
+
490
+ if database_id.nil?
491
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
492
+ end
493
+
494
+ if specification.nil?
495
+ raise Appwrite::Exception.new('Missing required parameter: "specification"')
496
+ end
497
+
498
+ api_params = {
499
+ specification: specification,
500
+ autoCutover: auto_cutover,
501
+ }
502
+
503
+ api_headers = {
504
+ "X-Appwrite-Project": @client.get_config('project'),
505
+ "content-type": 'application/json',
506
+ "accept": 'application/json',
507
+ }
508
+
509
+ @client.call(
510
+ method: 'POST',
511
+ path: api_path,
512
+ headers: api_headers,
513
+ params: api_params,
514
+ response_type: Models::DatabaseMigration
515
+ )
516
+
517
+ end
518
+
519
+ # Get a single dedicated migration for a TablesDB database by its ID.
520
+ #
521
+ # @param [String] database_id Database ID.
522
+ # @param [String] migration_id Migration ID.
523
+ #
524
+ # @return [DatabaseMigration]
525
+ def get_migration(database_id:, migration_id:)
526
+ api_path = '/tablesdb/{databaseId}/migrations/{migrationId}'
527
+ .gsub('{databaseId}', database_id)
528
+ .gsub('{migrationId}', migration_id)
529
+
530
+ if database_id.nil?
531
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
532
+ end
533
+
534
+ if migration_id.nil?
535
+ raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
536
+ end
537
+
538
+ api_params = {
539
+ }
540
+
541
+ api_headers = {
542
+ "X-Appwrite-Project": @client.get_config('project'),
543
+ "accept": 'application/json',
544
+ }
545
+
546
+ @client.call(
547
+ method: 'GET',
548
+ path: api_path,
549
+ headers: api_headers,
550
+ params: api_params,
551
+ response_type: Models::DatabaseMigration
552
+ )
553
+
554
+ end
555
+
556
+ # Abort an in-flight TablesDB dedicated migration. Only allowed before
557
+ # cutover; once the migration has cut over it cannot be aborted.
558
+ #
559
+ # @param [String] database_id Database ID.
560
+ # @param [String] migration_id Migration ID.
561
+ #
562
+ # @return []
563
+ def delete_migration(database_id:, migration_id:)
564
+ api_path = '/tablesdb/{databaseId}/migrations/{migrationId}'
565
+ .gsub('{databaseId}', database_id)
566
+ .gsub('{migrationId}', migration_id)
567
+
568
+ if database_id.nil?
569
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
570
+ end
571
+
572
+ if migration_id.nil?
573
+ raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
574
+ end
575
+
576
+ api_params = {
577
+ }
578
+
579
+ api_headers = {
580
+ "X-Appwrite-Project": @client.get_config('project'),
581
+ "content-type": 'application/json',
582
+ "accept": 'application/json',
583
+ }
584
+
585
+ @client.call(
586
+ method: 'DELETE',
587
+ path: api_path,
588
+ headers: api_headers,
589
+ params: api_params,
590
+ )
591
+
592
+ end
593
+
594
+ # Cut a verified TablesDB migration over to its dedicated compute. Only
595
+ # applies to a migration created with `autoCutover` disabled, which waits at
596
+ # `ready_to_cutover` until this is called. The routing flip happens shortly
597
+ # after this returns, with a brief read-only window. One call buys one
598
+ # attempt: a cutover that fails a check returns the migration to `verifying`
599
+ # and parks it again, so call this once more to retry.
600
+ #
601
+ # @param [String] database_id Database ID.
602
+ # @param [String] migration_id Migration ID.
603
+ #
604
+ # @return [DatabaseMigration]
605
+ def cutover_migration(database_id:, migration_id:)
606
+ api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover'
607
+ .gsub('{databaseId}', database_id)
608
+ .gsub('{migrationId}', migration_id)
609
+
610
+ if database_id.nil?
611
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
612
+ end
613
+
614
+ if migration_id.nil?
615
+ raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
616
+ end
617
+
618
+ api_params = {
619
+ }
620
+
621
+ api_headers = {
622
+ "X-Appwrite-Project": @client.get_config('project'),
623
+ "content-type": 'application/json',
624
+ "accept": 'application/json',
625
+ }
626
+
627
+ @client.call(
628
+ method: 'POST',
629
+ path: api_path,
630
+ headers: api_headers,
631
+ params: api_params,
632
+ response_type: Models::DatabaseMigration
633
+ )
634
+
635
+ end
636
+
637
+ # List the lifecycle operations recorded for a dedicated database, newest
638
+ # first. Every provision, update, restore, backup and replication action is
639
+ # recorded here with its outcome, including an attempt that was abandoned
640
+ # because another worker took over the database.
641
+ #
642
+ # @param [String] database_id Database ID.
643
+ # @param [String] status Filter by operation status.
644
+ # @param [Integer] limit Maximum number of operations to return.
645
+ # @param [Integer] offset Number of operations to skip.
646
+ #
647
+ # @return [DedicatedDatabaseOperationList]
648
+ def list_operations(database_id:, status: nil, limit: nil, offset: nil)
649
+ api_path = '/tablesdb/{databaseId}/operations'
650
+ .gsub('{databaseId}', database_id)
651
+
652
+ if database_id.nil?
653
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
654
+ end
655
+
656
+ api_params = {
657
+ status: status,
658
+ limit: limit,
659
+ offset: offset,
660
+ }
661
+
662
+ api_headers = {
663
+ "X-Appwrite-Project": @client.get_config('project'),
664
+ "accept": 'application/json',
665
+ }
666
+
667
+ @client.call(
668
+ method: 'GET',
669
+ path: api_path,
670
+ headers: api_headers,
671
+ params: api_params,
672
+ response_type: Models::DedicatedDatabaseOperationList
673
+ )
674
+
675
+ end
676
+
677
+ # Get high availability status for a dedicated database. Returns replica
678
+ # statuses, replication lag, and sync mode.
679
+ #
680
+ # @param [String] database_id Database ID.
681
+ #
682
+ # @return [DedicatedDatabaseReplicas]
683
+ def get_replicas(database_id:)
684
+ api_path = '/tablesdb/{databaseId}/replicas'
685
+ .gsub('{databaseId}', database_id)
686
+
687
+ if database_id.nil?
688
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
689
+ end
690
+
691
+ api_params = {
692
+ }
693
+
694
+ api_headers = {
695
+ "X-Appwrite-Project": @client.get_config('project'),
696
+ "accept": 'application/json',
697
+ }
698
+
699
+ @client.call(
700
+ method: 'GET',
701
+ path: api_path,
702
+ headers: api_headers,
703
+ params: api_params,
704
+ response_type: Models::DedicatedDatabaseReplicas
705
+ )
706
+
707
+ end
708
+
709
+ # Get real-time health and status information for a dedicated database.
710
+ # Returns health status, readiness, uptime, connection info, replica status,
711
+ # and volume information.
712
+ #
713
+ # @param [String] database_id Database ID.
714
+ #
715
+ # @return [DatabaseStatus]
716
+ def get_status(database_id:)
717
+ api_path = '/tablesdb/{databaseId}/status'
718
+ .gsub('{databaseId}', database_id)
719
+
720
+ if database_id.nil?
721
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
722
+ end
723
+
724
+ api_params = {
725
+ }
726
+
727
+ api_headers = {
728
+ "X-Appwrite-Project": @client.get_config('project'),
729
+ "accept": 'application/json',
730
+ }
731
+
732
+ @client.call(
733
+ method: 'GET',
734
+ path: api_path,
735
+ headers: api_headers,
736
+ params: api_params,
737
+ response_type: Models::DatabaseStatus
738
+ )
739
+
740
+ end
741
+
370
742
  # Get a list of all tables that belong to the provided databaseId. You can
371
743
  # use the search parameter to filter your results.
372
744
  #
@@ -416,7 +788,7 @@ module Appwrite
416
788
  # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
417
789
  # @param [] row_security Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).
418
790
  # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.
419
- # @param [Array] columns Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
791
+ # @param [Array] columns Array of column definitions to create. Each column should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
420
792
  # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
421
793
  #
422
794
  # @return [Table]
@@ -2144,11 +2516,11 @@ module Appwrite
2144
2516
  # @param [String] database_id Database ID.
2145
2517
  # @param [String] table_id Table ID.
2146
2518
  # @param [String] related_table_id Related Table ID.
2147
- # @param [RelationshipType] type Relation type
2519
+ # @param [RelationshipType] type Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany.
2148
2520
  # @param [] two_way Is Two Way?
2149
2521
  # @param [String] key Column Key.
2150
2522
  # @param [String] two_way_key Two Way Column Key.
2151
- # @param [RelationMutate] on_delete Constraints option
2523
+ # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull.
2152
2524
  #
2153
2525
  # @return [ColumnRelationship]
2154
2526
  def create_relationship_column(database_id:, table_id:, related_table_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil)
@@ -2832,7 +3204,7 @@ module Appwrite
2832
3204
  # @param [String] database_id Database ID.
2833
3205
  # @param [String] table_id Table ID.
2834
3206
  # @param [String] key Column Key.
2835
- # @param [RelationMutate] on_delete Constraints option
3207
+ # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull.
2836
3208
  # @param [String] new_key New Column Key.
2837
3209
  #
2838
3210
  # @return [ColumnRelationship]
@@ -181,6 +181,204 @@ module Appwrite
181
181
 
182
182
  end
183
183
 
184
+ # List app installations on a team. Any team member can read installations.
185
+ #
186
+ # @param [String] team_id Team ID.
187
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
188
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
189
+ #
190
+ # @return [AppInstallationList]
191
+ def list_installations(team_id:, queries: nil, total: nil)
192
+ api_path = '/teams/{teamId}/installations'
193
+ .gsub('{teamId}', team_id)
194
+
195
+ if team_id.nil?
196
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
197
+ end
198
+
199
+ api_params = {
200
+ queries: queries,
201
+ total: total,
202
+ }
203
+
204
+ api_headers = {
205
+ "X-Appwrite-Project": @client.get_config('project'),
206
+ "accept": 'application/json',
207
+ }
208
+
209
+ @client.call(
210
+ method: 'GET',
211
+ path: api_path,
212
+ headers: api_headers,
213
+ params: api_params,
214
+ response_type: Models::AppInstallationList
215
+ )
216
+
217
+ end
218
+
219
+ # Install an app on a team. When authenticated as a user, only team members
220
+ # with the owner role can install apps. Requests using an API key or in admin
221
+ # mode can install apps on any team. The installation is granted the scopes
222
+ # the app currently requests.
223
+ #
224
+ # @param [String] team_id Team ID.
225
+ # @param [String] app_id Application unique ID.
226
+ # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here.
227
+ #
228
+ # @return [AppInstallation]
229
+ def create_installation(team_id:, app_id:, authorization_details: nil)
230
+ api_path = '/teams/{teamId}/installations'
231
+ .gsub('{teamId}', team_id)
232
+
233
+ if team_id.nil?
234
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
235
+ end
236
+
237
+ if app_id.nil?
238
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
239
+ end
240
+
241
+ api_params = {
242
+ appId: app_id,
243
+ authorizationDetails: authorization_details,
244
+ }
245
+
246
+ api_headers = {
247
+ "X-Appwrite-Project": @client.get_config('project'),
248
+ "content-type": 'application/json',
249
+ "accept": 'application/json',
250
+ }
251
+
252
+ @client.call(
253
+ method: 'POST',
254
+ path: api_path,
255
+ headers: api_headers,
256
+ params: api_params,
257
+ response_type: Models::AppInstallation
258
+ )
259
+
260
+ end
261
+
262
+ # Get an app installation on a team by its unique ID. Any team member can
263
+ # read installations.
264
+ #
265
+ # @param [String] team_id Team ID.
266
+ # @param [String] installation_id Installation unique ID.
267
+ #
268
+ # @return [AppInstallation]
269
+ def get_installation(team_id:, installation_id:)
270
+ api_path = '/teams/{teamId}/installations/{installationId}'
271
+ .gsub('{teamId}', team_id)
272
+ .gsub('{installationId}', installation_id)
273
+
274
+ if team_id.nil?
275
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
276
+ end
277
+
278
+ if installation_id.nil?
279
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
280
+ end
281
+
282
+ api_params = {
283
+ }
284
+
285
+ api_headers = {
286
+ "X-Appwrite-Project": @client.get_config('project'),
287
+ "accept": 'application/json',
288
+ }
289
+
290
+ @client.call(
291
+ method: 'GET',
292
+ path: api_path,
293
+ headers: api_headers,
294
+ params: api_params,
295
+ response_type: Models::AppInstallation
296
+ )
297
+
298
+ end
299
+
300
+ # Update an app installation on a team. Only team members with the owner role
301
+ # can update installations. The installation's granted scopes are refreshed
302
+ # to the scopes the app currently requests; previously issued installation
303
+ # access tokens are revoked.
304
+ #
305
+ # @param [String] team_id Team ID.
306
+ # @param [String] installation_id Installation unique ID.
307
+ # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value.
308
+ #
309
+ # @return [AppInstallation]
310
+ def update_installation(team_id:, installation_id:, authorization_details: nil)
311
+ api_path = '/teams/{teamId}/installations/{installationId}'
312
+ .gsub('{teamId}', team_id)
313
+ .gsub('{installationId}', installation_id)
314
+
315
+ if team_id.nil?
316
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
317
+ end
318
+
319
+ if installation_id.nil?
320
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
321
+ end
322
+
323
+ api_params = {
324
+ authorizationDetails: authorization_details,
325
+ }
326
+
327
+ api_headers = {
328
+ "X-Appwrite-Project": @client.get_config('project'),
329
+ "content-type": 'application/json',
330
+ "accept": 'application/json',
331
+ }
332
+
333
+ @client.call(
334
+ method: 'PUT',
335
+ path: api_path,
336
+ headers: api_headers,
337
+ params: api_params,
338
+ response_type: Models::AppInstallation
339
+ )
340
+
341
+ end
342
+
343
+ # Uninstall an app from a team by its installation ID. Only team members with
344
+ # the owner role can remove installations. Previously issued installation
345
+ # access tokens are revoked.
346
+ #
347
+ # @param [String] team_id Team ID.
348
+ # @param [String] installation_id Installation unique ID.
349
+ #
350
+ # @return []
351
+ def delete_installation(team_id:, installation_id:)
352
+ api_path = '/teams/{teamId}/installations/{installationId}'
353
+ .gsub('{teamId}', team_id)
354
+ .gsub('{installationId}', installation_id)
355
+
356
+ if team_id.nil?
357
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
358
+ end
359
+
360
+ if installation_id.nil?
361
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
362
+ end
363
+
364
+ api_params = {
365
+ }
366
+
367
+ api_headers = {
368
+ "X-Appwrite-Project": @client.get_config('project'),
369
+ "content-type": 'application/json',
370
+ "accept": 'application/json',
371
+ }
372
+
373
+ @client.call(
374
+ method: 'DELETE',
375
+ path: api_path,
376
+ headers: api_headers,
377
+ params: api_params,
378
+ )
379
+
380
+ end
381
+
184
382
  # Use this endpoint to list a team's members using the team's ID. All team
185
383
  # members have read access to this endpoint. Hide sensitive attributes from
186
384
  # the response by toggling membership privacy in the Console.