From 7e8b444373a4310556468150de74a207d16586c8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 10:47:45 +0530 Subject: [PATCH 01/10] chore: update Ruby SDK to 26.0.0 --- CHANGELOG.md | 18 + appwrite.gemspec | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/update-password.md | 4 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/backups/create-restoration.md | 3 +- .../functions/get-deployment-download.md | 3 +- .../examples/functions/list-specifications.md | 4 +- docs/examples/health/get-audits-db.md | 14 - docs/examples/health/get-cache.md | 14 - docs/examples/health/get-db.md | 14 - docs/examples/health/get-failed-jobs.md | 18 - docs/examples/health/get-pub-sub.md | 14 - docs/examples/health/get-queue-databases.md | 17 - docs/examples/health/get-queue-deletes.md | 16 - docs/examples/health/get-queue-functions.md | 16 - docs/examples/health/get-queue-logs.md | 16 - docs/examples/health/get-queue-mails.md | 16 - docs/examples/health/get-queue-messaging.md | 16 - docs/examples/health/get-queue-migrations.md | 16 - .../health/get-queue-stats-resources.md | 16 - docs/examples/health/get-queue-usage.md | 16 - docs/examples/health/get-queue-webhooks.md | 16 - docs/examples/health/get-storage-local.md | 14 - docs/examples/health/get-storage.md | 14 - docs/examples/health/get-time.md | 14 - .../messaging/create-smtp-provider.md | 2 +- docs/examples/messaging/list-provider-logs.md | 18 - .../messaging/list-subscriber-logs.md | 18 - docs/examples/messaging/list-topic-logs.md | 18 - .../messaging/update-smtp-provider.md | 2 +- .../organization/create-membership.md | 21 + .../delete-membership.md} | 6 +- .../delete.md} | 4 +- .../get-membership.md} | 6 +- docs/examples/{health => organization}/get.md | 4 +- .../list-memberships.md} | 6 +- .../organization/update-membership.md | 17 + .../update.md} | 6 +- .../update-deny-corporate-email-policy.md} | 6 +- .../update-membership-privacy-policy.md | 3 +- .../update-o-auth-2-appwrite.md} | 9 +- docs/examples/project/update-o-auth-2-oidc.md | 3 + .../project/update-o-auth-2-server.md | 8 +- docs/examples/project/update-smtp.md | 2 +- docs/examples/sites/list-specifications.md | 4 +- docs/examples/tablesdb/create.md | 3 +- docs/examples/usage/list-events.md | 17 - docs/examples/usage/list-gauges.md | 17 - docs/examples/users/create.md | 2 +- docs/examples/users/update-password.md | 2 +- docs/examples/webhooks/create.md | 2 +- docs/examples/webhooks/update.md | 2 +- lib/appwrite.rb | 31 +- lib/appwrite/client.rb | 22 +- lib/appwrite/enums/billing_plan_group.rb | 9 + lib/appwrite/enums/database_status.rb | 9 + lib/appwrite/enums/health_antivirus_status.rb | 9 - lib/appwrite/enums/health_check_status.rb | 8 - lib/appwrite/enums/health_queue_name.rb | 19 - lib/appwrite/enums/o_auth2_oidc_prompt.rb | 10 + lib/appwrite/enums/o_auth_provider.rb | 1 + lib/appwrite/enums/organization_key_scopes.rb | 4 + lib/appwrite/enums/project_key_scopes.rb | 9 +- .../enums/project_o_auth2_oidc_prompt.rb | 10 + .../enums/project_o_auth_provider_id.rb | 1 + lib/appwrite/enums/project_policy_id.rb | 1 + lib/appwrite/enums/project_service_id.rb | 1 + lib/appwrite/models/activity_event.rb | 76 +- lib/appwrite/models/additional_resource.rb | 52 ++ lib/appwrite/models/backup_policy.rb | 5 + lib/appwrite/models/billing_plan.rb | 379 ++++++++++ lib/appwrite/models/billing_plan_addon.rb | 32 + .../models/billing_plan_addon_details.rb | 62 ++ .../billing_plan_dedicated_database_limits.rb | 117 +++ lib/appwrite/models/billing_plan_limits.rb | 32 + .../models/billing_plan_supported_addons.rb | 37 + lib/appwrite/models/block.rb | 5 + lib/appwrite/models/database.rb | 19 + lib/appwrite/models/health_antivirus.rb | 49 -- lib/appwrite/models/health_certificate.rb | 52 -- lib/appwrite/models/health_queue.rb | 27 - lib/appwrite/models/health_status.rb | 53 -- lib/appwrite/models/health_status_list.rb | 32 - lib/appwrite/models/health_time.rb | 37 - lib/appwrite/models/locale.rb | 61 +- lib/appwrite/models/membership.rb | 5 + lib/appwrite/models/o_auth2_appwrite.rb | 42 ++ lib/appwrite/models/o_auth2_oidc.rb | 16 +- lib/appwrite/models/organization.rb | 197 +++++ .../models/policy_deny_corporate_email.rb | 32 + .../models/policy_membership_privacy.rb | 11 +- lib/appwrite/models/program.rb | 67 ++ lib/appwrite/models/project.rb | 53 +- lib/appwrite/models/usage_billing_plan.rb | 77 ++ lib/appwrite/models/usage_event.rb | 72 -- lib/appwrite/models/usage_event_list.rb | 32 - lib/appwrite/models/usage_gauge.rb | 47 -- lib/appwrite/models/usage_gauge_list.rb | 32 - lib/appwrite/models/user.rb | 25 + lib/appwrite/query.rb | 14 +- lib/appwrite/services/account.rb | 43 +- lib/appwrite/services/activities.rb | 2 + lib/appwrite/services/advisor.rb | 4 + lib/appwrite/services/avatars.rb | 8 + lib/appwrite/services/backups.rb | 26 +- lib/appwrite/services/databases.rb | 107 +++ lib/appwrite/services/functions.rb | 34 +- lib/appwrite/services/graphql.rb | 2 + lib/appwrite/services/health.rb | 681 ------------------ lib/appwrite/services/locale.rb | 8 + lib/appwrite/services/messaging.rb | 178 ++--- lib/appwrite/services/organization.rb | 271 ++++++- lib/appwrite/services/presences.rb | 4 + lib/appwrite/services/project.rb | 199 ++++- lib/appwrite/services/proxy.rb | 7 + lib/appwrite/services/sites.rb | 26 +- lib/appwrite/services/storage.rb | 11 + lib/appwrite/services/tables_db.rb | 69 +- lib/appwrite/services/teams.rb | 11 + lib/appwrite/services/tokens.rb | 4 + lib/appwrite/services/usage.rb | 88 --- lib/appwrite/services/users.rb | 39 +- lib/appwrite/services/webhooks.rb | 5 + 124 files changed, 2428 insertions(+), 1915 deletions(-) delete mode 100644 docs/examples/health/get-audits-db.md delete mode 100644 docs/examples/health/get-cache.md delete mode 100644 docs/examples/health/get-db.md delete mode 100644 docs/examples/health/get-failed-jobs.md delete mode 100644 docs/examples/health/get-pub-sub.md delete mode 100644 docs/examples/health/get-queue-databases.md delete mode 100644 docs/examples/health/get-queue-deletes.md delete mode 100644 docs/examples/health/get-queue-functions.md delete mode 100644 docs/examples/health/get-queue-logs.md delete mode 100644 docs/examples/health/get-queue-mails.md delete mode 100644 docs/examples/health/get-queue-messaging.md delete mode 100644 docs/examples/health/get-queue-migrations.md delete mode 100644 docs/examples/health/get-queue-stats-resources.md delete mode 100644 docs/examples/health/get-queue-usage.md delete mode 100644 docs/examples/health/get-queue-webhooks.md delete mode 100644 docs/examples/health/get-storage-local.md delete mode 100644 docs/examples/health/get-storage.md delete mode 100644 docs/examples/health/get-time.md delete mode 100644 docs/examples/messaging/list-provider-logs.md delete mode 100644 docs/examples/messaging/list-subscriber-logs.md delete mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/organization/create-membership.md rename docs/examples/{health/get-queue-certificates.md => organization/delete-membership.md} (68%) rename docs/examples/{health/get-antivirus.md => organization/delete.md} (78%) rename docs/examples/{health/get-queue-builds.md => organization/get-membership.md} (69%) rename docs/examples/{health => organization}/get.md (79%) rename docs/examples/{messaging/list-message-logs.md => organization/list-memberships.md} (73%) create mode 100644 docs/examples/organization/update-membership.md rename docs/examples/{health/get-certificate.md => organization/update.md} (74%) rename docs/examples/{health/get-queue-audits.md => project/update-deny-corporate-email-policy.md} (71%) rename docs/examples/{health/get-console-pausing.md => project/update-o-auth-2-appwrite.md} (57%) delete mode 100644 docs/examples/usage/list-events.md delete mode 100644 docs/examples/usage/list-gauges.md create mode 100644 lib/appwrite/enums/billing_plan_group.rb create mode 100644 lib/appwrite/enums/database_status.rb delete mode 100644 lib/appwrite/enums/health_antivirus_status.rb delete mode 100644 lib/appwrite/enums/health_check_status.rb delete mode 100644 lib/appwrite/enums/health_queue_name.rb create mode 100644 lib/appwrite/enums/o_auth2_oidc_prompt.rb create mode 100644 lib/appwrite/enums/project_o_auth2_oidc_prompt.rb create mode 100644 lib/appwrite/models/additional_resource.rb create mode 100644 lib/appwrite/models/billing_plan.rb create mode 100644 lib/appwrite/models/billing_plan_addon.rb create mode 100644 lib/appwrite/models/billing_plan_addon_details.rb create mode 100644 lib/appwrite/models/billing_plan_dedicated_database_limits.rb create mode 100644 lib/appwrite/models/billing_plan_limits.rb create mode 100644 lib/appwrite/models/billing_plan_supported_addons.rb delete mode 100644 lib/appwrite/models/health_antivirus.rb delete mode 100644 lib/appwrite/models/health_certificate.rb delete mode 100644 lib/appwrite/models/health_queue.rb delete mode 100644 lib/appwrite/models/health_status.rb delete mode 100644 lib/appwrite/models/health_status_list.rb delete mode 100644 lib/appwrite/models/health_time.rb create mode 100644 lib/appwrite/models/o_auth2_appwrite.rb create mode 100644 lib/appwrite/models/organization.rb create mode 100644 lib/appwrite/models/policy_deny_corporate_email.rb create mode 100644 lib/appwrite/models/program.rb create mode 100644 lib/appwrite/models/usage_billing_plan.rb delete mode 100644 lib/appwrite/models/usage_event.rb delete mode 100644 lib/appwrite/models/usage_event_list.rb delete mode 100644 lib/appwrite/models/usage_gauge.rb delete mode 100644 lib/appwrite/models/usage_gauge_list.rb delete mode 100644 lib/appwrite/services/health.rb delete mode 100644 lib/appwrite/services/usage.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e4fa59..937becfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## 26.0.0 + +* Breaking: Removed `Health` service and all health models and enums +* Breaking: Removed `Usage` service and `UsageEvent`/`UsageGauge` models +* Breaking: Removed `Messaging` log methods `list_message_logs`, `list_provider_logs`, `list_subscriber_logs`, `list_topic_logs` +* Breaking: Removed OS, client, device, and country fields from `ActivityEvent` model +* Added: `Client#set_bearer` for OAuth access token authentication +* Added: `Organization` `get`, `update`, `delete`, and membership CRUD methods +* Added: `Query.vector_dot`, `Query.vector_cosine`, `Query.vector_euclidean` query helpers +* Added: `Project#update_o_auth2_appwrite` and `Project#update_deny_corporate_email_policy` methods +* Added: OAuth2 server device-flow params (`verification_url`, `user_code_length`, `device_code_duration`, `default_scopes`) +* Added: optional params `new_specification` (restorations), `token` (deployment download), `type` (list specifications), `specification` (TablesDB create) +* Added: `Organization`, `BillingPlan`, `AdditionalResource`, `Program`, `OAuth2Appwrite`, `PolicyDenyCorporateEmail` models +* Added: `DatabaseStatus`, `BillingPlanGroup`, `ProjectOAuth2OidcPrompt` enums and `APPWRITE` OAuth provider +* Added: `Locale` geolocation/ISP fields, `Membership#user_accessed_at`, `Block#mode`, `BackupPolicy#type`, `Database#status` +* Added: `User` email classification fields (`email_is_free`, `email_is_disposable`, `email_is_corporate`) +* Added: new key scopes (`stages.*`, `project.oauth2.*`, `organization.*`, `dedicatedDatabases.execute`) + ## 25.1.0 * Added: `createSesProvider` and `updateSesProvider` to `messaging` diff --git a/appwrite.gemspec b/appwrite.gemspec index 80812fdf..1233f9c1 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '25.1.0' + spec.version = '26.0.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 673c8f3f..683fd89d 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -13,7 +13,7 @@ account = Account.new(client) result = account.create( user_id: '', email: 'email@example.com', - password: '', + password: 'password', name: '' # optional ) ``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 94516118..1e9aba5a 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -11,7 +11,7 @@ client = Client.new account = Account.new(client) result = account.update_password( - password: '', - old_password: '' # optional + password: 'password', + old_password: 'password' # optional ) ``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 198579ae..e3cfb643 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -13,6 +13,6 @@ account = Account.new(client) result = account.update_recovery( user_id: '', secret: '', - password: '' + password: 'password' ) ``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index f6509087..831c2aa1 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -15,6 +15,7 @@ result = backups.create_restoration( archive_id: '', services: [BackupServices::DATABASES], new_resource_id: '', # optional - new_resource_name: '' # optional + new_resource_name: '', # optional + new_specification: 'serverless' # optional ) ``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 728cfca6..dd7547af 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -14,6 +14,7 @@ functions = Functions.new(client) result = functions.get_deployment_download( function_id: '', deployment_id: '', - type: DeploymentDownloadType::SOURCE # optional + type: DeploymentDownloadType::SOURCE, # optional + token: '' # optional ) ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index b018ccdf..635f73a5 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -10,5 +10,7 @@ client = Client.new functions = Functions.new(client) -result = functions.list_specifications() +result = functions.list_specifications( + type: 'runtimes' # optional +) ``` diff --git a/docs/examples/health/get-audits-db.md b/docs/examples/health/get-audits-db.md deleted file mode 100644 index 19ad2e75..00000000 --- a/docs/examples/health/get-audits-db.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_audits_db() -``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index a9390d69..00000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_cache() -``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md deleted file mode 100644 index 6f06ad89..00000000 --- a/docs/examples/health/get-db.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_db() -``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index 54b36948..00000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,18 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite -include Appwrite::Enums - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_failed_jobs( - name: HealthQueueName::V1_DATABASE, - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index 7c90a55c..00000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_pub_sub() -``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index 23eff71b..00000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,17 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_databases( - name: '', # optional - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index f3664b61..00000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_deletes( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index cdf3d01b..00000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_functions( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index ee0b393e..00000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_logs( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index 26ef282c..00000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_mails( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 03d51a3f..00000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_messaging( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index a0b8d221..00000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_migrations( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md deleted file mode 100644 index cc0b19f8..00000000 --- a/docs/examples/health/get-queue-stats-resources.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_stats_resources( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index b9f36fb4..00000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_usage( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index 2982e65f..00000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,16 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_queue_webhooks( - threshold: null # optional -) -``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index 4175f277..00000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_storage_local() -``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index d187656d..00000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_storage() -``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index 4486ef15..00000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,14 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -health = Health.new(client) - -result = health.get_time() -``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index f3fd75d9..85c1abda 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -17,7 +17,7 @@ result = messaging.create_smtp_provider( host: '', port: 1, # optional username: '', # optional - password: '', # optional + password: 'password', # optional encryption: SmtpEncryption::NONE, # optional auto_tls: false, # optional mailer: '', # optional diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index 8696e4a5..00000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -messaging = Messaging.new(client) - -result = messaging.list_provider_logs( - provider_id: '', - queries: [], # optional - total: false # optional -) -``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index 1db126a6..00000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -messaging = Messaging.new(client) - -result = messaging.list_subscriber_logs( - subscriber_id: '', - queries: [], # optional - total: false # optional -) -``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index c7529041..00000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -messaging = Messaging.new(client) - -result = messaging.list_topic_logs( - topic_id: '', - queries: [], # optional - total: false # optional -) -``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 3c810609..a7355fef 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -17,7 +17,7 @@ result = messaging.update_smtp_provider( host: '', # optional port: 1, # optional username: '', # optional - password: '', # optional + password: 'password', # optional encryption: SmtpEncryption::NONE, # optional auto_tls: false, # optional mailer: '', # optional diff --git a/docs/examples/organization/create-membership.md b/docs/examples/organization/create-membership.md new file mode 100644 index 00000000..b49780c8 --- /dev/null +++ b/docs/examples/organization/create-membership.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +organization = Organization.new(client) + +result = organization.create_membership( + roles: [], + email: 'email@example.com', # optional + user_id: '', # optional + phone: '+12065550100', # optional + url: 'https://example.com', # optional + name: '' # optional +) +``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/organization/delete-membership.md similarity index 68% rename from docs/examples/health/get-queue-certificates.md rename to docs/examples/organization/delete-membership.md index 9d512bc3..8130e222 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/organization/delete-membership.md @@ -8,9 +8,9 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +organization = Organization.new(client) -result = health.get_queue_certificates( - threshold: null # optional +result = organization.delete_membership( + membership_id: '' ) ``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/organization/delete.md similarity index 78% rename from docs/examples/health/get-antivirus.md rename to docs/examples/organization/delete.md index 1c29b76d..c70d53db 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/organization/delete.md @@ -8,7 +8,7 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +organization = Organization.new(client) -result = health.get_antivirus() +result = organization.delete() ``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/organization/get-membership.md similarity index 69% rename from docs/examples/health/get-queue-builds.md rename to docs/examples/organization/get-membership.md index 40acf324..85db1008 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/organization/get-membership.md @@ -8,9 +8,9 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +organization = Organization.new(client) -result = health.get_queue_builds( - threshold: null # optional +result = organization.get_membership( + membership_id: '' ) ``` diff --git a/docs/examples/health/get.md b/docs/examples/organization/get.md similarity index 79% rename from docs/examples/health/get.md rename to docs/examples/organization/get.md index 54a191b8..e39c7764 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/organization/get.md @@ -8,7 +8,7 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +organization = Organization.new(client) -result = health.get() +result = organization.get() ``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/organization/list-memberships.md similarity index 73% rename from docs/examples/messaging/list-message-logs.md rename to docs/examples/organization/list-memberships.md index 3a55506d..ea03bef4 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/organization/list-memberships.md @@ -8,11 +8,11 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -messaging = Messaging.new(client) +organization = Organization.new(client) -result = messaging.list_message_logs( - message_id: '', +result = organization.list_memberships( queries: [], # optional + search: '', # optional total: false # optional ) ``` diff --git a/docs/examples/organization/update-membership.md b/docs/examples/organization/update-membership.md new file mode 100644 index 00000000..f4b5ac27 --- /dev/null +++ b/docs/examples/organization/update-membership.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +organization = Organization.new(client) + +result = organization.update_membership( + membership_id: '', + roles: [] +) +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/organization/update.md similarity index 74% rename from docs/examples/health/get-certificate.md rename to docs/examples/organization/update.md index f88145aa..5c0cda42 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/organization/update.md @@ -8,9 +8,9 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +organization = Organization.new(client) -result = health.get_certificate( - domain: '' # optional +result = organization.update( + name: '' ) ``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/project/update-deny-corporate-email-policy.md similarity index 71% rename from docs/examples/health/get-queue-audits.md rename to docs/examples/project/update-deny-corporate-email-policy.md index 2320ba16..24082514 100644 --- a/docs/examples/health/get-queue-audits.md +++ b/docs/examples/project/update-deny-corporate-email-policy.md @@ -8,9 +8,9 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +project = Project.new(client) -result = health.get_queue_audits( - threshold: null # optional +result = project.update_deny_corporate_email_policy( + enabled: false ) ``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md index e29b6b93..b84a8fac 100644 --- a/docs/examples/project/update-membership-privacy-policy.md +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -15,6 +15,7 @@ result = project.update_membership_privacy_policy( user_email: false, # optional user_phone: false, # optional user_name: false, # optional - user_mfa: false # optional + user_mfa: false, # optional + user_accessed_at: false # optional ) ``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/project/update-o-auth-2-appwrite.md similarity index 57% rename from docs/examples/health/get-console-pausing.md rename to docs/examples/project/update-o-auth-2-appwrite.md index 1e6513ff..1d8e92ed 100644 --- a/docs/examples/health/get-console-pausing.md +++ b/docs/examples/project/update-o-auth-2-appwrite.md @@ -8,10 +8,11 @@ client = Client.new .set_project('') # Your project ID .set_key('') # Your secret API key -health = Health.new(client) +project = Project.new(client) -result = health.get_console_pausing( - threshold: null, # optional - inactivity_days: null # optional +result = project.update_o_auth2_appwrite( + client_id: '', # optional + client_secret: '', # optional + enabled: false # optional ) ``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md index 44e48c72..f090e96a 100644 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -2,6 +2,7 @@ require 'appwrite' include Appwrite +include Appwrite::Enums client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -17,6 +18,8 @@ result = project.update_o_auth2_oidc( authorization_url: 'https://example.com', # optional token_url: 'https://example.com', # optional user_info_url: 'https://example.com', # optional + prompt: [ProjectOAuth2OidcPrompt::NONE], # optional + max_age: 0, # optional enabled: false # optional ) ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index bad44468..b3ab3399 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -14,10 +14,16 @@ result = project.update_o_auth2_server( enabled: false, authorization_url: 'https://example.com', scopes: [], # optional + authorization_details_types: [], # optional access_token_duration: 60, # optional refresh_token_duration: 60, # optional public_access_token_duration: 60, # optional public_refresh_token_duration: 60, # optional - confidential_pkce: false # optional + confidential_pkce: false, # optional + verification_url: 'https://example.com', # optional + user_code_length: 6, # optional + user_code_format: 'numeric', # optional + device_code_duration: 60, # optional + default_scopes: [] # optional ) ``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index ca53c6b5..7dda7710 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -15,7 +15,7 @@ result = project.update_smtp( host: '', # optional port: null, # optional username: '', # optional - password: '', # optional + password: 'password', # optional sender_email: 'email@example.com', # optional sender_name: '', # optional reply_to_email: 'email@example.com', # optional diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 132a6e9c..9ed8d001 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -10,5 +10,7 @@ client = Client.new sites = Sites.new(client) -result = sites.list_specifications() +result = sites.list_specifications( + type: 'runtimes' # optional +) ``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 4eba90af..10ab1a45 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -13,6 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create( database_id: '', name: '', - enabled: false # optional + enabled: false, # optional + specification: 'serverless' # optional ) ``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md deleted file mode 100644 index ec26a6db..00000000 --- a/docs/examples/usage/list-events.md +++ /dev/null @@ -1,17 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -usage = Usage.new(client) - -result = usage.list_events( - queries: [], # optional - total: false # optional -) -``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md deleted file mode 100644 index ba3061fb..00000000 --- a/docs/examples/usage/list-gauges.md +++ /dev/null @@ -1,17 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -usage = Usage.new(client) - -result = usage.list_gauges( - queries: [], # optional - total: false # optional -) -``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 06e30889..183fa076 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -14,7 +14,7 @@ result = users.create( user_id: '', email: 'email@example.com', # optional phone: '+12065550100', # optional - password: '', # optional + password: 'password', # optional name: '' # optional ) ``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index b7779e63..6be19718 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -12,6 +12,6 @@ users = Users.new(client) result = users.update_password( user_id: '', - password: '' + password: 'password' ) ``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index e5539108..58177d5a 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -18,7 +18,7 @@ result = webhooks.create( enabled: false, # optional tls: false, # optional auth_username: '', # optional - auth_password: '', # optional + auth_password: 'password', # optional secret: '' # optional ) ``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 1de7c044..d5d95428 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -18,6 +18,6 @@ result = webhooks.update( enabled: false, # optional tls: false, # optional auth_username: '', # optional - auth_password: '' # optional + auth_password: 'password' # optional ) ``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 5d707b38..2b14b4a3 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -48,7 +48,6 @@ require_relative 'appwrite/models/mock_number_list' require_relative 'appwrite/models/policy_list' require_relative 'appwrite/models/email_template_list' -require_relative 'appwrite/models/health_status_list' require_relative 'appwrite/models/proxy_rule_list' require_relative 'appwrite/models/locale_code_list' require_relative 'appwrite/models/provider_list' @@ -174,6 +173,7 @@ require_relative 'appwrite/models/o_auth2_tradeshift' require_relative 'appwrite/models/o_auth2_paypal' require_relative 'appwrite/models/o_auth2_gitlab' +require_relative 'appwrite/models/o_auth2_appwrite' require_relative 'appwrite/models/o_auth2_authentik' require_relative 'appwrite/models/o_auth2_auth0' require_relative 'appwrite/models/o_auth2_fusion_auth' @@ -206,11 +206,6 @@ require_relative 'appwrite/models/language' require_relative 'appwrite/models/currency' require_relative 'appwrite/models/phone' -require_relative 'appwrite/models/health_antivirus' -require_relative 'appwrite/models/health_queue' -require_relative 'appwrite/models/health_status' -require_relative 'appwrite/models/health_certificate' -require_relative 'appwrite/models/health_time' require_relative 'appwrite/models/headers' require_relative 'appwrite/models/specification' require_relative 'appwrite/models/proxy_rule' @@ -229,22 +224,29 @@ require_relative 'appwrite/models/insight_cta' require_relative 'appwrite/models/report' require_relative 'appwrite/models/activity_event' +require_relative 'appwrite/models/additional_resource' require_relative 'appwrite/models/backup_archive' require_relative 'appwrite/models/billing_limits' +require_relative 'appwrite/models/billing_plan' +require_relative 'appwrite/models/billing_plan_addon' +require_relative 'appwrite/models/billing_plan_addon_details' +require_relative 'appwrite/models/billing_plan_limits' +require_relative 'appwrite/models/billing_plan_dedicated_database_limits' +require_relative 'appwrite/models/billing_plan_supported_addons' require_relative 'appwrite/models/block' +require_relative 'appwrite/models/organization' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/policy_deny_aliased_email' require_relative 'appwrite/models/policy_deny_disposable_email' require_relative 'appwrite/models/policy_deny_free_email' +require_relative 'appwrite/models/policy_deny_corporate_email' +require_relative 'appwrite/models/program' require_relative 'appwrite/models/backup_restoration' -require_relative 'appwrite/models/usage_event' -require_relative 'appwrite/models/usage_gauge' +require_relative 'appwrite/models/usage_billing_plan' require_relative 'appwrite/models/activity_event_list' require_relative 'appwrite/models/backup_archive_list' require_relative 'appwrite/models/backup_policy_list' require_relative 'appwrite/models/backup_restoration_list' -require_relative 'appwrite/models/usage_event_list' -require_relative 'appwrite/models/usage_gauge_list' require_relative 'appwrite/enums/authenticator_type' require_relative 'appwrite/enums/authentication_factor' @@ -267,13 +269,13 @@ require_relative 'appwrite/enums/vcs_reference_type' require_relative 'appwrite/enums/deployment_download_type' require_relative 'appwrite/enums/execution_method' -require_relative 'appwrite/enums/health_queue_name' require_relative 'appwrite/enums/message_priority' require_relative 'appwrite/enums/smtp_encryption' require_relative 'appwrite/enums/organization_key_scopes' require_relative 'appwrite/enums/region' require_relative 'appwrite/enums/project_auth_method_id' require_relative 'appwrite/enums/project_o_auth2_google_prompt' +require_relative 'appwrite/enums/project_o_auth2_oidc_prompt' require_relative 'appwrite/enums/project_o_auth_provider_id' require_relative 'appwrite/enums/project_policy_id' require_relative 'appwrite/enums/project_protocol_id' @@ -292,6 +294,7 @@ require_relative 'appwrite/enums/password_hash' require_relative 'appwrite/enums/messaging_provider_type' require_relative 'appwrite/enums/database_type' +require_relative 'appwrite/enums/database_status' require_relative 'appwrite/enums/attribute_status' require_relative 'appwrite/enums/column_status' require_relative 'appwrite/enums/index_status' @@ -299,12 +302,12 @@ require_relative 'appwrite/enums/execution_trigger' require_relative 'appwrite/enums/execution_status' require_relative 'appwrite/enums/o_auth2_google_prompt' +require_relative 'appwrite/enums/o_auth2_oidc_prompt' require_relative 'appwrite/enums/platform_type' -require_relative 'appwrite/enums/health_antivirus_status' -require_relative 'appwrite/enums/health_check_status' require_relative 'appwrite/enums/proxy_rule_deployment_resource_type' require_relative 'appwrite/enums/proxy_rule_status' require_relative 'appwrite/enums/message_status' +require_relative 'appwrite/enums/billing_plan_group' require_relative 'appwrite/services/account' require_relative 'appwrite/services/activities' @@ -313,7 +316,6 @@ require_relative 'appwrite/services/databases' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' -require_relative 'appwrite/services/health' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/messaging' require_relative 'appwrite/services/organization' @@ -326,6 +328,5 @@ require_relative 'appwrite/services/tables_db' require_relative 'appwrite/services/teams' require_relative 'appwrite/services/tokens' -require_relative 'appwrite/services/usage' require_relative 'appwrite/services/users' require_relative 'appwrite/services/webhooks' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index c41363ae..b5922e70 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '25.1.0', + 'x-sdk-version'=> '26.0.0', 'X-Appwrite-Response-Format' => '1.9.5' } @endpoint = 'https://cloud.appwrite.io/v1' @@ -63,6 +63,20 @@ def set_jwt(value) self end + # Set Bearer + # + # The OAuth access token to authenticate with + # + # @param [String] value The value to set for the Bearer header + # + # @return [self] + def set_bearer(value) + add_header('authorization', value) + @config['bearer'] = value + + self + end + # Set Locale # # @param [String] value The value to set for the Locale header @@ -133,7 +147,7 @@ def set_cookie(value) # Set ImpersonateUserId # - # Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + # Impersonate a user by ID # # @param [String] value The value to set for the ImpersonateUserId header # @@ -147,7 +161,7 @@ def set_impersonate_user_id(value) # Set ImpersonateUserEmail # - # Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + # Impersonate a user by email # # @param [String] value The value to set for the ImpersonateUserEmail header # @@ -161,7 +175,7 @@ def set_impersonate_user_email(value) # Set ImpersonateUserPhone # - # Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + # Impersonate a user by phone # # @param [String] value The value to set for the ImpersonateUserPhone header # diff --git a/lib/appwrite/enums/billing_plan_group.rb b/lib/appwrite/enums/billing_plan_group.rb new file mode 100644 index 00000000..053feaf3 --- /dev/null +++ b/lib/appwrite/enums/billing_plan_group.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module BillingPlanGroup + STARTER = 'starter' + PRO = 'pro' + SCALE = 'scale' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/database_status.rb b/lib/appwrite/enums/database_status.rb new file mode 100644 index 00000000..e0e488b2 --- /dev/null +++ b/lib/appwrite/enums/database_status.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module DatabaseStatus + PROVISIONING = 'provisioning' + READY = 'ready' + FAILED = 'failed' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/health_antivirus_status.rb b/lib/appwrite/enums/health_antivirus_status.rb deleted file mode 100644 index c4ed0731..00000000 --- a/lib/appwrite/enums/health_antivirus_status.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Appwrite - module Enums - module HealthAntivirusStatus - DISABLED = 'disabled' - OFFLINE = 'offline' - ONLINE = 'online' - end - end -end \ No newline at end of file diff --git a/lib/appwrite/enums/health_check_status.rb b/lib/appwrite/enums/health_check_status.rb deleted file mode 100644 index 1b530e16..00000000 --- a/lib/appwrite/enums/health_check_status.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Appwrite - module Enums - module HealthCheckStatus - PASS = 'pass' - FAIL = 'fail' - end - end -end \ No newline at end of file diff --git a/lib/appwrite/enums/health_queue_name.rb b/lib/appwrite/enums/health_queue_name.rb deleted file mode 100644 index b105be14..00000000 --- a/lib/appwrite/enums/health_queue_name.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Appwrite - module Enums - module HealthQueueName - V1_DATABASE = 'v1-database' - V1_DELETES = 'v1-deletes' - V1_AUDITS = 'v1-audits' - V1_MAILS = 'v1-mails' - V1_FUNCTIONS = 'v1-functions' - V1_STATS_RESOURCES = 'v1-stats-resources' - V1_STATS_USAGE = 'v1-stats-usage' - V1_WEBHOOKS = 'v1-webhooks' - V1_CERTIFICATES = 'v1-certificates' - V1_BUILDS = 'v1-builds' - V1_SCREENSHOTS = 'v1-screenshots' - V1_MESSAGING = 'v1-messaging' - V1_MIGRATIONS = 'v1-migrations' - end - end -end \ No newline at end of file diff --git a/lib/appwrite/enums/o_auth2_oidc_prompt.rb b/lib/appwrite/enums/o_auth2_oidc_prompt.rb new file mode 100644 index 00000000..f07d5271 --- /dev/null +++ b/lib/appwrite/enums/o_auth2_oidc_prompt.rb @@ -0,0 +1,10 @@ +module Appwrite + module Enums + module OAuth2OidcPrompt + NONE = 'none' + LOGIN = 'login' + CONSENT = 'consent' + SELECT_ACCOUNT = 'select_account' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/o_auth_provider.rb b/lib/appwrite/enums/o_auth_provider.rb index 5962eb43..e2e27fa0 100644 --- a/lib/appwrite/enums/o_auth_provider.rb +++ b/lib/appwrite/enums/o_auth_provider.rb @@ -3,6 +3,7 @@ module Enums module OAuthProvider AMAZON = 'amazon' APPLE = 'apple' + APPWRITE = 'appwrite' AUTH0 = 'auth0' AUTHENTIK = 'authentik' AUTODESK = 'autodesk' diff --git a/lib/appwrite/enums/organization_key_scopes.rb b/lib/appwrite/enums/organization_key_scopes.rb index 6a38e563..0263ef82 100644 --- a/lib/appwrite/enums/organization_key_scopes.rb +++ b/lib/appwrite/enums/organization_key_scopes.rb @@ -7,6 +7,10 @@ module OrganizationKeyScopes DEVKEYS_WRITE = 'devKeys.write' ORGANIZATION_KEYS_READ = 'organization.keys.read' ORGANIZATION_KEYS_WRITE = 'organization.keys.write' + ORGANIZATION_MEMBERSHIPS_READ = 'organization.memberships.read' + ORGANIZATION_MEMBERSHIPS_WRITE = 'organization.memberships.write' + ORGANIZATION_READ = 'organization.read' + ORGANIZATION_WRITE = 'organization.write' DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' KEYS_READ = 'keys.read' diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index 146c1bc5..ba1b7ee1 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -13,10 +13,12 @@ module ProjectKeyScopes POLICIES_WRITE = 'policies.write' PROJECT_POLICIES_READ = 'project.policies.read' PROJECT_POLICIES_WRITE = 'project.policies.write' + PROJECT_OAUTH2_READ = 'project.oauth2.read' + PROJECT_OAUTH2_WRITE = 'project.oauth2.write' TEMPLATES_READ = 'templates.read' TEMPLATES_WRITE = 'templates.write' - OAUTH2_READ = 'oauth2.read' - OAUTH2_WRITE = 'oauth2.write' + STAGES_READ = 'stages.read' + STAGES_WRITE = 'stages.write' USERS_READ = 'users.read' USERS_WRITE = 'users.write' SESSIONS_READ = 'sessions.read' @@ -91,11 +93,14 @@ module ProjectKeyScopes ARCHIVES_WRITE = 'archives.write' RESTORATIONS_READ = 'restorations.read' RESTORATIONS_WRITE = 'restorations.write' + DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute' DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' EVENTS_READ = 'events.read' APPS_READ = 'apps.read' APPS_WRITE = 'apps.write' + OAUTH2_READ = 'oauth2.read' + OAUTH2_WRITE = 'oauth2.write' USAGE_READ = 'usage.read' end end diff --git a/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb new file mode 100644 index 00000000..268b2b9f --- /dev/null +++ b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb @@ -0,0 +1,10 @@ +module Appwrite + module Enums + module ProjectOAuth2OidcPrompt + NONE = 'none' + LOGIN = 'login' + CONSENT = 'consent' + SELECT_ACCOUNT = 'select_account' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/project_o_auth_provider_id.rb b/lib/appwrite/enums/project_o_auth_provider_id.rb index d6ab5b63..44adb565 100644 --- a/lib/appwrite/enums/project_o_auth_provider_id.rb +++ b/lib/appwrite/enums/project_o_auth_provider_id.rb @@ -3,6 +3,7 @@ module Enums module ProjectOAuthProviderId AMAZON = 'amazon' APPLE = 'apple' + APPWRITE = 'appwrite' AUTH0 = 'auth0' AUTHENTIK = 'authentik' AUTODESK = 'autodesk' diff --git a/lib/appwrite/enums/project_policy_id.rb b/lib/appwrite/enums/project_policy_id.rb index 5e29823a..738292d4 100644 --- a/lib/appwrite/enums/project_policy_id.rb +++ b/lib/appwrite/enums/project_policy_id.rb @@ -14,6 +14,7 @@ module ProjectPolicyId DENY_ALIASED_EMAIL = 'deny-aliased-email' DENY_DISPOSABLE_EMAIL = 'deny-disposable-email' DENY_FREE_EMAIL = 'deny-free-email' + DENY_CORPORATE_EMAIL = 'deny-corporate-email' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/project_service_id.rb b/lib/appwrite/enums/project_service_id.rb index 0343ee58..871e9241 100644 --- a/lib/appwrite/enums/project_service_id.rb +++ b/lib/appwrite/enums/project_service_id.rb @@ -19,6 +19,7 @@ module ProjectServiceId MIGRATIONS = 'migrations' MESSAGING = 'messaging' ADVISOR = 'advisor' + OAUTH2 = 'oauth2' end end end \ No newline at end of file diff --git a/lib/appwrite/models/activity_event.rb b/lib/appwrite/models/activity_event.rb index 8d341a5e..0a746eef 100644 --- a/lib/appwrite/models/activity_event.rb +++ b/lib/appwrite/models/activity_event.rb @@ -21,20 +21,6 @@ class ActivityEvent attr_reader :project_id attr_reader :team_id attr_reader :hostname - attr_reader :os_code - attr_reader :os_name - attr_reader :os_version - attr_reader :client_type - attr_reader :client_code - attr_reader :client_name - attr_reader :client_version - attr_reader :client_engine - attr_reader :client_engine_version - attr_reader :device_name - attr_reader :device_brand - attr_reader :device_model - attr_reader :country_code - attr_reader :country_name def initialize( id:, @@ -54,21 +40,7 @@ def initialize( time:, project_id:, team_id:, - hostname:, - os_code:, - os_name:, - os_version:, - client_type:, - client_code:, - client_name:, - client_version:, - client_engine:, - client_engine_version:, - device_name:, - device_brand:, - device_model:, - country_code:, - country_name: + hostname: ) @id = id @actor_type = actor_type @@ -88,20 +60,6 @@ def initialize( @project_id = project_id @team_id = team_id @hostname = hostname - @os_code = os_code - @os_name = os_name - @os_version = os_version - @client_type = client_type - @client_code = client_code - @client_name = client_name - @client_version = client_version - @client_engine = client_engine - @client_engine_version = client_engine_version - @device_name = device_name - @device_brand = device_brand - @device_model = device_model - @country_code = country_code - @country_name = country_name end def self.from(map:) @@ -123,21 +81,7 @@ def self.from(map:) time: map["time"], project_id: map["projectId"], team_id: map["teamId"], - hostname: map["hostname"], - os_code: map["osCode"], - os_name: map["osName"], - os_version: map["osVersion"], - client_type: map["clientType"], - client_code: map["clientCode"], - client_name: map["clientName"], - client_version: map["clientVersion"], - client_engine: map["clientEngine"], - client_engine_version: map["clientEngineVersion"], - device_name: map["deviceName"], - device_brand: map["deviceBrand"], - device_model: map["deviceModel"], - country_code: map["countryCode"], - country_name: map["countryName"] + hostname: map["hostname"] ) end @@ -160,21 +104,7 @@ def to_map "time": @time, "projectId": @project_id, "teamId": @team_id, - "hostname": @hostname, - "osCode": @os_code, - "osName": @os_name, - "osVersion": @os_version, - "clientType": @client_type, - "clientCode": @client_code, - "clientName": @client_name, - "clientVersion": @client_version, - "clientEngine": @client_engine, - "clientEngineVersion": @client_engine_version, - "deviceName": @device_name, - "deviceBrand": @device_brand, - "deviceModel": @device_model, - "countryCode": @country_code, - "countryName": @country_name + "hostname": @hostname } end end diff --git a/lib/appwrite/models/additional_resource.rb b/lib/appwrite/models/additional_resource.rb new file mode 100644 index 00000000..23e5402e --- /dev/null +++ b/lib/appwrite/models/additional_resource.rb @@ -0,0 +1,52 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AdditionalResource + attr_reader :name + attr_reader :unit + attr_reader :currency + attr_reader :price + attr_reader :value + attr_reader :invoice_desc + + def initialize( + name:, + unit:, + currency:, + price:, + value:, + invoice_desc: + ) + @name = name + @unit = unit + @currency = currency + @price = price + @value = value + @invoice_desc = invoice_desc + end + + def self.from(map:) + AdditionalResource.new( + name: map["name"], + unit: map["unit"], + currency: map["currency"], + price: map["price"], + value: map["value"], + invoice_desc: map["invoiceDesc"] + ) + end + + def to_map + { + "name": @name, + "unit": @unit, + "currency": @currency, + "price": @price, + "value": @value, + "invoiceDesc": @invoice_desc + } + end + end + end +end diff --git a/lib/appwrite/models/backup_policy.rb b/lib/appwrite/models/backup_policy.rb index 9a2146eb..abbe49c6 100644 --- a/lib/appwrite/models/backup_policy.rb +++ b/lib/appwrite/models/backup_policy.rb @@ -13,6 +13,7 @@ class BackupPolicy attr_reader :resource_type attr_reader :retention attr_reader :schedule + attr_reader :type attr_reader :enabled def initialize( @@ -26,6 +27,7 @@ def initialize( resource_type: , retention:, schedule:, + type:, enabled: ) @id = id @@ -38,6 +40,7 @@ def initialize( @resource_type = resource_type @retention = retention @schedule = schedule + @type = type @enabled = enabled end @@ -53,6 +56,7 @@ def self.from(map:) resource_type: map["resourceType"], retention: map["retention"], schedule: map["schedule"], + type: map["type"], enabled: map["enabled"] ) end @@ -69,6 +73,7 @@ def to_map "resourceType": @resource_type, "retention": @retention, "schedule": @schedule, + "type": @type, "enabled": @enabled } end diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb new file mode 100644 index 00000000..e00a32f6 --- /dev/null +++ b/lib/appwrite/models/billing_plan.rb @@ -0,0 +1,379 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlan + attr_reader :id + attr_reader :name + attr_reader :desc + attr_reader :order + attr_reader :price + attr_reader :trial + attr_reader :bandwidth + attr_reader :storage + attr_reader :image_transformations + attr_reader :screenshots_generated + attr_reader :members + attr_reader :webhooks + attr_reader :projects + attr_reader :platforms + attr_reader :users + attr_reader :teams + attr_reader :databases + attr_reader :databases_reads + attr_reader :databases_writes + attr_reader :databases_batch_size + attr_reader :buckets + attr_reader :file_size + attr_reader :functions + attr_reader :sites + attr_reader :executions + attr_reader :executions_retention_count + attr_reader :gb_hours + attr_reader :realtime + attr_reader :realtime_messages + attr_reader :messages + attr_reader :topics + attr_reader :auth_phone + attr_reader :domains + attr_reader :activity_logs + attr_reader :usage_logs + attr_reader :usage_logs_intervals + attr_reader :project_inactivity_days + attr_reader :alert_limit + attr_reader :usage + attr_reader :addons + attr_reader :budget_cap_enabled + attr_reader :custom_smtp + attr_reader :email_branding + attr_reader :requires_payment_method + attr_reader :requires_billing_address + attr_reader :is_available + attr_reader :self_service + attr_reader :premium_support + attr_reader :budgeting + attr_reader :supports_mock_numbers + attr_reader :supports_organization_roles + attr_reader :supports_credits + attr_reader :supports_disposable_email_validation + attr_reader :supports_canonical_email_validation + attr_reader :supports_free_email_validation + attr_reader :supports_corporate_email_validation + attr_reader :supports_project_specific_roles + attr_reader :backups_enabled + attr_reader :usage_per_project + attr_reader :supported_addons + attr_reader :backup_policies + attr_reader :deployment_size + attr_reader :build_size + attr_reader :databases_allow_encrypt + attr_reader :limits + attr_reader :group + attr_reader :program + attr_reader :dedicated_databases + + def initialize( + id:, + name:, + desc:, + order:, + price:, + trial:, + bandwidth:, + storage:, + image_transformations:, + screenshots_generated:, + members:, + webhooks:, + projects:, + platforms:, + users:, + teams:, + databases:, + databases_reads:, + databases_writes:, + databases_batch_size:, + buckets:, + file_size:, + functions:, + sites:, + executions:, + executions_retention_count:, + gb_hours:, + realtime:, + realtime_messages:, + messages:, + topics:, + auth_phone:, + domains:, + activity_logs:, + usage_logs:, + usage_logs_intervals: , + project_inactivity_days:, + alert_limit:, + usage:, + addons:, + budget_cap_enabled:, + custom_smtp:, + email_branding:, + requires_payment_method:, + requires_billing_address:, + is_available:, + self_service:, + premium_support:, + budgeting:, + supports_mock_numbers:, + supports_organization_roles:, + supports_credits:, + supports_disposable_email_validation:, + supports_canonical_email_validation:, + supports_free_email_validation:, + supports_corporate_email_validation:, + supports_project_specific_roles:, + backups_enabled:, + usage_per_project:, + supported_addons:, + backup_policies:, + deployment_size:, + build_size:, + databases_allow_encrypt:, + limits: , + group:, + program: , + dedicated_databases: + ) + @id = id + @name = name + @desc = desc + @order = order + @price = price + @trial = trial + @bandwidth = bandwidth + @storage = storage + @image_transformations = image_transformations + @screenshots_generated = screenshots_generated + @members = members + @webhooks = webhooks + @projects = projects + @platforms = platforms + @users = users + @teams = teams + @databases = databases + @databases_reads = databases_reads + @databases_writes = databases_writes + @databases_batch_size = databases_batch_size + @buckets = buckets + @file_size = file_size + @functions = functions + @sites = sites + @executions = executions + @executions_retention_count = executions_retention_count + @gb_hours = gb_hours + @realtime = realtime + @realtime_messages = realtime_messages + @messages = messages + @topics = topics + @auth_phone = auth_phone + @domains = domains + @activity_logs = activity_logs + @usage_logs = usage_logs + @usage_logs_intervals = usage_logs_intervals + @project_inactivity_days = project_inactivity_days + @alert_limit = alert_limit + @usage = usage + @addons = addons + @budget_cap_enabled = budget_cap_enabled + @custom_smtp = custom_smtp + @email_branding = email_branding + @requires_payment_method = requires_payment_method + @requires_billing_address = requires_billing_address + @is_available = is_available + @self_service = self_service + @premium_support = premium_support + @budgeting = budgeting + @supports_mock_numbers = supports_mock_numbers + @supports_organization_roles = supports_organization_roles + @supports_credits = supports_credits + @supports_disposable_email_validation = supports_disposable_email_validation + @supports_canonical_email_validation = supports_canonical_email_validation + @supports_free_email_validation = supports_free_email_validation + @supports_corporate_email_validation = supports_corporate_email_validation + @supports_project_specific_roles = supports_project_specific_roles + @backups_enabled = backups_enabled + @usage_per_project = usage_per_project + @supported_addons = supported_addons + @backup_policies = backup_policies + @deployment_size = deployment_size + @build_size = build_size + @databases_allow_encrypt = databases_allow_encrypt + @limits = limits + @group = validate_group(group) + @program = program + @dedicated_databases = dedicated_databases + end + + def self.from(map:) + BillingPlan.new( + id: map["$id"], + name: map["name"], + desc: map["desc"], + order: map["order"], + price: map["price"], + trial: map["trial"], + bandwidth: map["bandwidth"], + storage: map["storage"], + image_transformations: map["imageTransformations"], + screenshots_generated: map["screenshotsGenerated"], + members: map["members"], + webhooks: map["webhooks"], + projects: map["projects"], + platforms: map["platforms"], + users: map["users"], + teams: map["teams"], + databases: map["databases"], + databases_reads: map["databasesReads"], + databases_writes: map["databasesWrites"], + databases_batch_size: map["databasesBatchSize"], + buckets: map["buckets"], + file_size: map["fileSize"], + functions: map["functions"], + sites: map["sites"], + executions: map["executions"], + executions_retention_count: map["executionsRetentionCount"], + gb_hours: map["GBHours"], + realtime: map["realtime"], + realtime_messages: map["realtimeMessages"], + messages: map["messages"], + topics: map["topics"], + auth_phone: map["authPhone"], + domains: map["domains"], + activity_logs: map["activityLogs"], + usage_logs: map["usageLogs"], + usage_logs_intervals: map["usageLogsIntervals"], + project_inactivity_days: map["projectInactivityDays"], + alert_limit: map["alertLimit"], + usage: UsageBillingPlan.from(map: map["usage"]), + addons: BillingPlanAddon.from(map: map["addons"]), + budget_cap_enabled: map["budgetCapEnabled"], + custom_smtp: map["customSmtp"], + email_branding: map["emailBranding"], + requires_payment_method: map["requiresPaymentMethod"], + requires_billing_address: map["requiresBillingAddress"], + is_available: map["isAvailable"], + self_service: map["selfService"], + premium_support: map["premiumSupport"], + budgeting: map["budgeting"], + supports_mock_numbers: map["supportsMockNumbers"], + supports_organization_roles: map["supportsOrganizationRoles"], + supports_credits: map["supportsCredits"], + supports_disposable_email_validation: map["supportsDisposableEmailValidation"], + supports_canonical_email_validation: map["supportsCanonicalEmailValidation"], + supports_free_email_validation: map["supportsFreeEmailValidation"], + supports_corporate_email_validation: map["supportsCorporateEmailValidation"], + supports_project_specific_roles: map["supportsProjectSpecificRoles"], + backups_enabled: map["backupsEnabled"], + usage_per_project: map["usagePerProject"], + supported_addons: BillingPlanSupportedAddons.from(map: map["supportedAddons"]), + backup_policies: map["backupPolicies"], + deployment_size: map["deploymentSize"], + build_size: map["buildSize"], + databases_allow_encrypt: map["databasesAllowEncrypt"], + limits: BillingPlanLimits.from(map: map["limits"]), + group: map["group"], + program: Program.from(map: map["program"]), + dedicated_databases: BillingPlanDedicatedDatabaseLimits.from(map: map["dedicatedDatabases"]) + ) + end + + def to_map + { + "$id": @id, + "name": @name, + "desc": @desc, + "order": @order, + "price": @price, + "trial": @trial, + "bandwidth": @bandwidth, + "storage": @storage, + "imageTransformations": @image_transformations, + "screenshotsGenerated": @screenshots_generated, + "members": @members, + "webhooks": @webhooks, + "projects": @projects, + "platforms": @platforms, + "users": @users, + "teams": @teams, + "databases": @databases, + "databasesReads": @databases_reads, + "databasesWrites": @databases_writes, + "databasesBatchSize": @databases_batch_size, + "buckets": @buckets, + "fileSize": @file_size, + "functions": @functions, + "sites": @sites, + "executions": @executions, + "executionsRetentionCount": @executions_retention_count, + "GBHours": @gb_hours, + "realtime": @realtime, + "realtimeMessages": @realtime_messages, + "messages": @messages, + "topics": @topics, + "authPhone": @auth_phone, + "domains": @domains, + "activityLogs": @activity_logs, + "usageLogs": @usage_logs, + "usageLogsIntervals": @usage_logs_intervals, + "projectInactivityDays": @project_inactivity_days, + "alertLimit": @alert_limit, + "usage": @usage.to_map, + "addons": @addons.to_map, + "budgetCapEnabled": @budget_cap_enabled, + "customSmtp": @custom_smtp, + "emailBranding": @email_branding, + "requiresPaymentMethod": @requires_payment_method, + "requiresBillingAddress": @requires_billing_address, + "isAvailable": @is_available, + "selfService": @self_service, + "premiumSupport": @premium_support, + "budgeting": @budgeting, + "supportsMockNumbers": @supports_mock_numbers, + "supportsOrganizationRoles": @supports_organization_roles, + "supportsCredits": @supports_credits, + "supportsDisposableEmailValidation": @supports_disposable_email_validation, + "supportsCanonicalEmailValidation": @supports_canonical_email_validation, + "supportsFreeEmailValidation": @supports_free_email_validation, + "supportsCorporateEmailValidation": @supports_corporate_email_validation, + "supportsProjectSpecificRoles": @supports_project_specific_roles, + "backupsEnabled": @backups_enabled, + "usagePerProject": @usage_per_project, + "supportedAddons": @supported_addons.to_map, + "backupPolicies": @backup_policies, + "deploymentSize": @deployment_size, + "buildSize": @build_size, + "databasesAllowEncrypt": @databases_allow_encrypt, + "limits": @limits.to_map, + "group": @group, + "program": @program.to_map, + "dedicatedDatabases": @dedicated_databases.to_map + } + end + + private + + def validate_group(group) + valid_group = [ + Appwrite::Enums::BillingPlanGroup::STARTER, + Appwrite::Enums::BillingPlanGroup::PRO, + Appwrite::Enums::BillingPlanGroup::SCALE, + ] + + unless valid_group.include?(group) + raise ArgumentError, "Invalid " + group + ". Must be one of: " + valid_group.join(', ') + end + + group + end + + end + end +end diff --git a/lib/appwrite/models/billing_plan_addon.rb b/lib/appwrite/models/billing_plan_addon.rb new file mode 100644 index 00000000..5569f8a5 --- /dev/null +++ b/lib/appwrite/models/billing_plan_addon.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlanAddon + attr_reader :seats + attr_reader :projects + + def initialize( + seats:, + projects: + ) + @seats = seats + @projects = projects + end + + def self.from(map:) + BillingPlanAddon.new( + seats: BillingPlanAddonDetails.from(map: map["seats"]), + projects: BillingPlanAddonDetails.from(map: map["projects"]) + ) + end + + def to_map + { + "seats": @seats.to_map, + "projects": @projects.to_map + } + end + end + end +end diff --git a/lib/appwrite/models/billing_plan_addon_details.rb b/lib/appwrite/models/billing_plan_addon_details.rb new file mode 100644 index 00000000..7ca96ab1 --- /dev/null +++ b/lib/appwrite/models/billing_plan_addon_details.rb @@ -0,0 +1,62 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlanAddonDetails + attr_reader :supported + attr_reader :plan_included + attr_reader :limit + attr_reader :type + attr_reader :currency + attr_reader :price + attr_reader :value + attr_reader :invoice_desc + + def initialize( + supported:, + plan_included:, + limit:, + type:, + currency:, + price:, + value:, + invoice_desc: + ) + @supported = supported + @plan_included = plan_included + @limit = limit + @type = type + @currency = currency + @price = price + @value = value + @invoice_desc = invoice_desc + end + + def self.from(map:) + BillingPlanAddonDetails.new( + supported: map["supported"], + plan_included: map["planIncluded"], + limit: map["limit"], + type: map["type"], + currency: map["currency"], + price: map["price"], + value: map["value"], + invoice_desc: map["invoiceDesc"] + ) + end + + def to_map + { + "supported": @supported, + "planIncluded": @plan_included, + "limit": @limit, + "type": @type, + "currency": @currency, + "price": @price, + "value": @value, + "invoiceDesc": @invoice_desc + } + end + end + end +end diff --git a/lib/appwrite/models/billing_plan_dedicated_database_limits.rb b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb new file mode 100644 index 00000000..41458e73 --- /dev/null +++ b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb @@ -0,0 +1,117 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlanDedicatedDatabaseLimits + attr_reader :min_cpu + attr_reader :max_cpu + attr_reader :min_memory_mb + attr_reader :max_memory_mb + attr_reader :min_storage_gb + attr_reader :max_storage_gb + attr_reader :max_replicas + attr_reader :max_connections + attr_reader :max_ip_allowlist_size + attr_reader :max_extensions + attr_reader :max_backup_retention_days + attr_reader :max_pitr_retention_days + attr_reader :max_sql_api_max_rows + attr_reader :max_sql_api_max_bytes + attr_reader :max_sql_api_timeout_seconds + attr_reader :max_sql_api_allowed_statements + attr_reader :allowed_sql_statements + attr_reader :allowed_storage_classes + attr_reader :allowed_sync_modes + + def initialize( + min_cpu: , + max_cpu: , + min_memory_mb: , + max_memory_mb: , + min_storage_gb: , + max_storage_gb: , + max_replicas: , + max_connections: , + max_ip_allowlist_size: , + max_extensions: , + max_backup_retention_days: , + max_pitr_retention_days: , + max_sql_api_max_rows: , + max_sql_api_max_bytes: , + max_sql_api_timeout_seconds: , + max_sql_api_allowed_statements: , + allowed_sql_statements: , + allowed_storage_classes: , + allowed_sync_modes: + ) + @min_cpu = min_cpu + @max_cpu = max_cpu + @min_memory_mb = min_memory_mb + @max_memory_mb = max_memory_mb + @min_storage_gb = min_storage_gb + @max_storage_gb = max_storage_gb + @max_replicas = max_replicas + @max_connections = max_connections + @max_ip_allowlist_size = max_ip_allowlist_size + @max_extensions = max_extensions + @max_backup_retention_days = max_backup_retention_days + @max_pitr_retention_days = max_pitr_retention_days + @max_sql_api_max_rows = max_sql_api_max_rows + @max_sql_api_max_bytes = max_sql_api_max_bytes + @max_sql_api_timeout_seconds = max_sql_api_timeout_seconds + @max_sql_api_allowed_statements = max_sql_api_allowed_statements + @allowed_sql_statements = allowed_sql_statements + @allowed_storage_classes = allowed_storage_classes + @allowed_sync_modes = allowed_sync_modes + end + + def self.from(map:) + BillingPlanDedicatedDatabaseLimits.new( + min_cpu: map["minCpu"], + max_cpu: map["maxCpu"], + min_memory_mb: map["minMemoryMb"], + max_memory_mb: map["maxMemoryMb"], + min_storage_gb: map["minStorageGb"], + max_storage_gb: map["maxStorageGb"], + max_replicas: map["maxReplicas"], + max_connections: map["maxConnections"], + max_ip_allowlist_size: map["maxIpAllowlistSize"], + max_extensions: map["maxExtensions"], + max_backup_retention_days: map["maxBackupRetentionDays"], + max_pitr_retention_days: map["maxPitrRetentionDays"], + max_sql_api_max_rows: map["maxSqlApiMaxRows"], + max_sql_api_max_bytes: map["maxSqlApiMaxBytes"], + max_sql_api_timeout_seconds: map["maxSqlApiTimeoutSeconds"], + max_sql_api_allowed_statements: map["maxSqlApiAllowedStatements"], + allowed_sql_statements: map["allowedSqlStatements"], + allowed_storage_classes: map["allowedStorageClasses"], + allowed_sync_modes: map["allowedSyncModes"] + ) + end + + def to_map + { + "minCpu": @min_cpu, + "maxCpu": @max_cpu, + "minMemoryMb": @min_memory_mb, + "maxMemoryMb": @max_memory_mb, + "minStorageGb": @min_storage_gb, + "maxStorageGb": @max_storage_gb, + "maxReplicas": @max_replicas, + "maxConnections": @max_connections, + "maxIpAllowlistSize": @max_ip_allowlist_size, + "maxExtensions": @max_extensions, + "maxBackupRetentionDays": @max_backup_retention_days, + "maxPitrRetentionDays": @max_pitr_retention_days, + "maxSqlApiMaxRows": @max_sql_api_max_rows, + "maxSqlApiMaxBytes": @max_sql_api_max_bytes, + "maxSqlApiTimeoutSeconds": @max_sql_api_timeout_seconds, + "maxSqlApiAllowedStatements": @max_sql_api_allowed_statements, + "allowedSqlStatements": @allowed_sql_statements, + "allowedStorageClasses": @allowed_storage_classes, + "allowedSyncModes": @allowed_sync_modes + } + end + end + end +end diff --git a/lib/appwrite/models/billing_plan_limits.rb b/lib/appwrite/models/billing_plan_limits.rb new file mode 100644 index 00000000..547fd307 --- /dev/null +++ b/lib/appwrite/models/billing_plan_limits.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlanLimits + attr_reader :credits + attr_reader :daily_credits + + def initialize( + credits: , + daily_credits: + ) + @credits = credits + @daily_credits = daily_credits + end + + def self.from(map:) + BillingPlanLimits.new( + credits: map["credits"], + daily_credits: map["dailyCredits"] + ) + end + + def to_map + { + "credits": @credits, + "dailyCredits": @daily_credits + } + end + end + end +end diff --git a/lib/appwrite/models/billing_plan_supported_addons.rb b/lib/appwrite/models/billing_plan_supported_addons.rb new file mode 100644 index 00000000..504a98d6 --- /dev/null +++ b/lib/appwrite/models/billing_plan_supported_addons.rb @@ -0,0 +1,37 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class BillingPlanSupportedAddons + attr_reader :baa + attr_reader :premium_geo_db + attr_reader :premium_geo_db_org + + def initialize( + baa:, + premium_geo_db:, + premium_geo_db_org: + ) + @baa = baa + @premium_geo_db = premium_geo_db + @premium_geo_db_org = premium_geo_db_org + end + + def self.from(map:) + BillingPlanSupportedAddons.new( + baa: map["baa"], + premium_geo_db: map["premiumGeoDB"], + premium_geo_db_org: map["premiumGeoDBOrg"] + ) + end + + def to_map + { + "baa": @baa, + "premiumGeoDB": @premium_geo_db, + "premiumGeoDBOrg": @premium_geo_db_org + } + end + end + end +end diff --git a/lib/appwrite/models/block.rb b/lib/appwrite/models/block.rb index 0a95a3f4..b7c55101 100644 --- a/lib/appwrite/models/block.rb +++ b/lib/appwrite/models/block.rb @@ -6,6 +6,7 @@ class Block attr_reader :created_at attr_reader :resource_type attr_reader :resource_id + attr_reader :mode attr_reader :reason attr_reader :expired_at attr_reader :project_name @@ -18,6 +19,7 @@ def initialize( created_at:, resource_type:, resource_id:, + mode:, reason: , expired_at: , project_name:, @@ -29,6 +31,7 @@ def initialize( @created_at = created_at @resource_type = resource_type @resource_id = resource_id + @mode = mode @reason = reason @expired_at = expired_at @project_name = project_name @@ -43,6 +46,7 @@ def self.from(map:) created_at: map["$createdAt"], resource_type: map["resourceType"], resource_id: map["resourceId"], + mode: map["mode"], reason: map["reason"], expired_at: map["expiredAt"], project_name: map["projectName"], @@ -58,6 +62,7 @@ def to_map "$createdAt": @created_at, "resourceType": @resource_type, "resourceId": @resource_id, + "mode": @mode, "reason": @reason, "expiredAt": @expired_at, "projectName": @project_name, diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index aac839c5..015903f1 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -9,6 +9,7 @@ class Database attr_reader :updated_at attr_reader :enabled attr_reader :type + attr_reader :status attr_reader :policies attr_reader :archives @@ -19,6 +20,7 @@ def initialize( updated_at:, enabled:, type:, + status: , policies:, archives: ) @@ -28,6 +30,7 @@ def initialize( @updated_at = updated_at @enabled = enabled @type = validate_type(type) + @status = status.nil? ? status : validate_status(status) @policies = policies @archives = archives end @@ -40,6 +43,7 @@ def self.from(map:) updated_at: map["$updatedAt"], enabled: map["enabled"], type: map["type"], + status: map["status"], policies: map["policies"].map { |it| BackupPolicy.from(map: it) }, archives: map["archives"].map { |it| BackupArchive.from(map: it) } ) @@ -53,6 +57,7 @@ def to_map "$updatedAt": @updated_at, "enabled": @enabled, "type": @type, + "status": @status, "policies": @policies.map { |it| it.to_map }, "archives": @archives.map { |it| it.to_map } } @@ -75,6 +80,20 @@ def validate_type(type) type end + def validate_status(status) + valid_status = [ + Appwrite::Enums::DatabaseStatus::PROVISIONING, + Appwrite::Enums::DatabaseStatus::READY, + Appwrite::Enums::DatabaseStatus::FAILED, + ] + + unless valid_status.include?(status) + raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') + end + + status + end + end end end diff --git a/lib/appwrite/models/health_antivirus.rb b/lib/appwrite/models/health_antivirus.rb deleted file mode 100644 index 6a157cb1..00000000 --- a/lib/appwrite/models/health_antivirus.rb +++ /dev/null @@ -1,49 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthAntivirus - attr_reader :version - attr_reader :status - - def initialize( - version:, - status: - ) - @version = version - @status = validate_status(status) - end - - def self.from(map:) - HealthAntivirus.new( - version: map["version"], - status: map["status"] - ) - end - - def to_map - { - "version": @version, - "status": @status - } - end - - private - - def validate_status(status) - valid_status = [ - Appwrite::Enums::HealthAntivirusStatus::DISABLED, - Appwrite::Enums::HealthAntivirusStatus::OFFLINE, - Appwrite::Enums::HealthAntivirusStatus::ONLINE, - ] - - unless valid_status.include?(status) - raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') - end - - status - end - - end - end -end diff --git a/lib/appwrite/models/health_certificate.rb b/lib/appwrite/models/health_certificate.rb deleted file mode 100644 index 1a8b4997..00000000 --- a/lib/appwrite/models/health_certificate.rb +++ /dev/null @@ -1,52 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthCertificate - attr_reader :name - attr_reader :subject_sn - attr_reader :issuer_organisation - attr_reader :valid_from - attr_reader :valid_to - attr_reader :signature_type_sn - - def initialize( - name:, - subject_sn:, - issuer_organisation:, - valid_from:, - valid_to:, - signature_type_sn: - ) - @name = name - @subject_sn = subject_sn - @issuer_organisation = issuer_organisation - @valid_from = valid_from - @valid_to = valid_to - @signature_type_sn = signature_type_sn - end - - def self.from(map:) - HealthCertificate.new( - name: map["name"], - subject_sn: map["subjectSN"], - issuer_organisation: map["issuerOrganisation"], - valid_from: map["validFrom"], - valid_to: map["validTo"], - signature_type_sn: map["signatureTypeSN"] - ) - end - - def to_map - { - "name": @name, - "subjectSN": @subject_sn, - "issuerOrganisation": @issuer_organisation, - "validFrom": @valid_from, - "validTo": @valid_to, - "signatureTypeSN": @signature_type_sn - } - end - end - end -end diff --git a/lib/appwrite/models/health_queue.rb b/lib/appwrite/models/health_queue.rb deleted file mode 100644 index 515d48c1..00000000 --- a/lib/appwrite/models/health_queue.rb +++ /dev/null @@ -1,27 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthQueue - attr_reader :size - - def initialize( - size: - ) - @size = size - end - - def self.from(map:) - HealthQueue.new( - size: map["size"] - ) - end - - def to_map - { - "size": @size - } - end - end - end -end diff --git a/lib/appwrite/models/health_status.rb b/lib/appwrite/models/health_status.rb deleted file mode 100644 index 8a19a223..00000000 --- a/lib/appwrite/models/health_status.rb +++ /dev/null @@ -1,53 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthStatus - attr_reader :name - attr_reader :ping - attr_reader :status - - def initialize( - name:, - ping:, - status: - ) - @name = name - @ping = ping - @status = validate_status(status) - end - - def self.from(map:) - HealthStatus.new( - name: map["name"], - ping: map["ping"], - status: map["status"] - ) - end - - def to_map - { - "name": @name, - "ping": @ping, - "status": @status - } - end - - private - - def validate_status(status) - valid_status = [ - Appwrite::Enums::HealthCheckStatus::PASS, - Appwrite::Enums::HealthCheckStatus::FAIL, - ] - - unless valid_status.include?(status) - raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') - end - - status - end - - end - end -end diff --git a/lib/appwrite/models/health_status_list.rb b/lib/appwrite/models/health_status_list.rb deleted file mode 100644 index 256c5d91..00000000 --- a/lib/appwrite/models/health_status_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthStatusList - attr_reader :total - attr_reader :statuses - - def initialize( - total:, - statuses: - ) - @total = total - @statuses = statuses - end - - def self.from(map:) - HealthStatusList.new( - total: map["total"], - statuses: map["statuses"].map { |it| HealthStatus.from(map: it) } - ) - end - - def to_map - { - "total": @total, - "statuses": @statuses.map { |it| it.to_map } - } - end - end - end -end diff --git a/lib/appwrite/models/health_time.rb b/lib/appwrite/models/health_time.rb deleted file mode 100644 index 7bf17d32..00000000 --- a/lib/appwrite/models/health_time.rb +++ /dev/null @@ -1,37 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class HealthTime - attr_reader :remote_time - attr_reader :local_time - attr_reader :diff - - def initialize( - remote_time:, - local_time:, - diff: - ) - @remote_time = remote_time - @local_time = local_time - @diff = diff - end - - def self.from(map:) - HealthTime.new( - remote_time: map["remoteTime"], - local_time: map["localTime"], - diff: map["diff"] - ) - end - - def to_map - { - "remoteTime": @remote_time, - "localTime": @local_time, - "diff": @diff - } - end - end - end -end diff --git a/lib/appwrite/models/locale.rb b/lib/appwrite/models/locale.rb index 884d698e..7480e2bf 100644 --- a/lib/appwrite/models/locale.rb +++ b/lib/appwrite/models/locale.rb @@ -10,6 +10,17 @@ class Locale attr_reader :continent attr_reader :eu attr_reader :currency + attr_reader :city + attr_reader :time_zone + attr_reader :postal_code + attr_reader :latitude + attr_reader :longitude + attr_reader :autonomous_system_number + attr_reader :autonomous_system_organization + attr_reader :isp + attr_reader :connection_type + attr_reader :connection_usage_type + attr_reader :connection_organization def initialize( ip:, @@ -18,7 +29,18 @@ def initialize( continent_code:, continent:, eu:, - currency: + currency:, + city: , + time_zone: , + postal_code: , + latitude: , + longitude: , + autonomous_system_number: , + autonomous_system_organization: , + isp: , + connection_type: , + connection_usage_type: , + connection_organization: ) @ip = ip @country_code = country_code @@ -27,6 +49,17 @@ def initialize( @continent = continent @eu = eu @currency = currency + @city = city + @time_zone = time_zone + @postal_code = postal_code + @latitude = latitude + @longitude = longitude + @autonomous_system_number = autonomous_system_number + @autonomous_system_organization = autonomous_system_organization + @isp = isp + @connection_type = connection_type + @connection_usage_type = connection_usage_type + @connection_organization = connection_organization end def self.from(map:) @@ -37,7 +70,18 @@ def self.from(map:) continent_code: map["continentCode"], continent: map["continent"], eu: map["eu"], - currency: map["currency"] + currency: map["currency"], + city: map["city"], + time_zone: map["timeZone"], + postal_code: map["postalCode"], + latitude: map["latitude"], + longitude: map["longitude"], + autonomous_system_number: map["autonomousSystemNumber"], + autonomous_system_organization: map["autonomousSystemOrganization"], + isp: map["isp"], + connection_type: map["connectionType"], + connection_usage_type: map["connectionUsageType"], + connection_organization: map["connectionOrganization"] ) end @@ -49,7 +93,18 @@ def to_map "continentCode": @continent_code, "continent": @continent, "eu": @eu, - "currency": @currency + "currency": @currency, + "city": @city, + "timeZone": @time_zone, + "postalCode": @postal_code, + "latitude": @latitude, + "longitude": @longitude, + "autonomousSystemNumber": @autonomous_system_number, + "autonomousSystemOrganization": @autonomous_system_organization, + "isp": @isp, + "connectionType": @connection_type, + "connectionUsageType": @connection_usage_type, + "connectionOrganization": @connection_organization } end end diff --git a/lib/appwrite/models/membership.rb b/lib/appwrite/models/membership.rb index 0de5658c..4880a9ce 100644 --- a/lib/appwrite/models/membership.rb +++ b/lib/appwrite/models/membership.rb @@ -16,6 +16,7 @@ class Membership attr_reader :joined attr_reader :confirm attr_reader :mfa + attr_reader :user_accessed_at attr_reader :roles def initialize( @@ -32,6 +33,7 @@ def initialize( joined:, confirm:, mfa:, + user_accessed_at:, roles: ) @id = id @@ -47,6 +49,7 @@ def initialize( @joined = joined @confirm = confirm @mfa = mfa + @user_accessed_at = user_accessed_at @roles = roles end @@ -65,6 +68,7 @@ def self.from(map:) joined: map["joined"], confirm: map["confirm"], mfa: map["mfa"], + user_accessed_at: map["userAccessedAt"], roles: map["roles"] ) end @@ -84,6 +88,7 @@ def to_map "joined": @joined, "confirm": @confirm, "mfa": @mfa, + "userAccessedAt": @user_accessed_at, "roles": @roles } end diff --git a/lib/appwrite/models/o_auth2_appwrite.rb b/lib/appwrite/models/o_auth2_appwrite.rb new file mode 100644 index 00000000..f9ca4772 --- /dev/null +++ b/lib/appwrite/models/o_auth2_appwrite.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class OAuth2Appwrite + attr_reader :id + attr_reader :enabled + attr_reader :client_id + attr_reader :client_secret + + def initialize( + id:, + enabled:, + client_id:, + client_secret: + ) + @id = id + @enabled = enabled + @client_id = client_id + @client_secret = client_secret + end + + def self.from(map:) + OAuth2Appwrite.new( + id: map["$id"], + enabled: map["enabled"], + client_id: map["clientId"], + client_secret: map["clientSecret"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled, + "clientId": @client_id, + "clientSecret": @client_secret + } + end + end + end +end diff --git a/lib/appwrite/models/o_auth2_oidc.rb b/lib/appwrite/models/o_auth2_oidc.rb index 52d78f82..105d148a 100644 --- a/lib/appwrite/models/o_auth2_oidc.rb +++ b/lib/appwrite/models/o_auth2_oidc.rb @@ -11,6 +11,8 @@ class OAuth2Oidc attr_reader :authorization_url attr_reader :token_url attr_reader :user_info_url + attr_reader :prompt + attr_reader :max_age def initialize( id:, @@ -20,7 +22,9 @@ def initialize( well_known_url:, authorization_url:, token_url:, - user_info_url: + user_info_url:, + prompt:, + max_age: ) @id = id @enabled = enabled @@ -30,6 +34,8 @@ def initialize( @authorization_url = authorization_url @token_url = token_url @user_info_url = user_info_url + @prompt = prompt + @max_age = max_age end def self.from(map:) @@ -41,7 +47,9 @@ def self.from(map:) well_known_url: map["wellKnownURL"], authorization_url: map["authorizationURL"], token_url: map["tokenURL"], - user_info_url: map["userInfoURL"] + user_info_url: map["userInfoURL"], + prompt: map["prompt"], + max_age: map["maxAge"] ) end @@ -54,7 +62,9 @@ def to_map "wellKnownURL": @well_known_url, "authorizationURL": @authorization_url, "tokenURL": @token_url, - "userInfoURL": @user_info_url + "userInfoURL": @user_info_url, + "prompt": @prompt, + "maxAge": @max_age } end end diff --git a/lib/appwrite/models/organization.rb b/lib/appwrite/models/organization.rb new file mode 100644 index 00000000..779b7ff9 --- /dev/null +++ b/lib/appwrite/models/organization.rb @@ -0,0 +1,197 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Organization + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :name + attr_reader :total + attr_reader :prefs + attr_reader :billing_budget + attr_reader :budget_alerts + attr_reader :billing_plan + attr_reader :billing_plan_id + attr_reader :billing_plan_details + attr_reader :billing_email + attr_reader :billing_start_date + attr_reader :billing_current_invoice_date + attr_reader :billing_next_invoice_date + attr_reader :billing_trial_start_date + attr_reader :billing_trial_days + attr_reader :billing_aggregation_id + attr_reader :billing_invoice_id + attr_reader :payment_method_id + attr_reader :billing_address_id + attr_reader :backup_payment_method_id + attr_reader :status + attr_reader :remarks + attr_reader :agreement_baa + attr_reader :program_manager_name + attr_reader :program_manager_calendar + attr_reader :program_discord_channel_name + attr_reader :program_discord_channel_url + attr_reader :billing_limits + attr_reader :billing_plan_downgrade + attr_reader :billing_tax_id + attr_reader :marked_for_deletion + attr_reader :platform + attr_reader :projects + + def initialize( + id:, + created_at:, + updated_at:, + name:, + total:, + prefs:, + billing_budget:, + budget_alerts:, + billing_plan:, + billing_plan_id:, + billing_plan_details:, + billing_email:, + billing_start_date:, + billing_current_invoice_date:, + billing_next_invoice_date:, + billing_trial_start_date:, + billing_trial_days:, + billing_aggregation_id:, + billing_invoice_id:, + payment_method_id:, + billing_address_id:, + backup_payment_method_id:, + status:, + remarks:, + agreement_baa:, + program_manager_name:, + program_manager_calendar:, + program_discord_channel_name:, + program_discord_channel_url:, + billing_limits: , + billing_plan_downgrade:, + billing_tax_id:, + marked_for_deletion:, + platform:, + projects: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @name = name + @total = total + @prefs = prefs + @billing_budget = billing_budget + @budget_alerts = budget_alerts + @billing_plan = billing_plan + @billing_plan_id = billing_plan_id + @billing_plan_details = billing_plan_details + @billing_email = billing_email + @billing_start_date = billing_start_date + @billing_current_invoice_date = billing_current_invoice_date + @billing_next_invoice_date = billing_next_invoice_date + @billing_trial_start_date = billing_trial_start_date + @billing_trial_days = billing_trial_days + @billing_aggregation_id = billing_aggregation_id + @billing_invoice_id = billing_invoice_id + @payment_method_id = payment_method_id + @billing_address_id = billing_address_id + @backup_payment_method_id = backup_payment_method_id + @status = status + @remarks = remarks + @agreement_baa = agreement_baa + @program_manager_name = program_manager_name + @program_manager_calendar = program_manager_calendar + @program_discord_channel_name = program_discord_channel_name + @program_discord_channel_url = program_discord_channel_url + @billing_limits = billing_limits + @billing_plan_downgrade = billing_plan_downgrade + @billing_tax_id = billing_tax_id + @marked_for_deletion = marked_for_deletion + @platform = platform + @projects = projects + end + + def self.from(map:) + Organization.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + name: map["name"], + total: map["total"], + prefs: Preferences.from(map: map["prefs"]), + billing_budget: map["billingBudget"], + budget_alerts: map["budgetAlerts"], + billing_plan: map["billingPlan"], + billing_plan_id: map["billingPlanId"], + billing_plan_details: BillingPlan.from(map: map["billingPlanDetails"]), + billing_email: map["billingEmail"], + billing_start_date: map["billingStartDate"], + billing_current_invoice_date: map["billingCurrentInvoiceDate"], + billing_next_invoice_date: map["billingNextInvoiceDate"], + billing_trial_start_date: map["billingTrialStartDate"], + billing_trial_days: map["billingTrialDays"], + billing_aggregation_id: map["billingAggregationId"], + billing_invoice_id: map["billingInvoiceId"], + payment_method_id: map["paymentMethodId"], + billing_address_id: map["billingAddressId"], + backup_payment_method_id: map["backupPaymentMethodId"], + status: map["status"], + remarks: map["remarks"], + agreement_baa: map["agreementBAA"], + program_manager_name: map["programManagerName"], + program_manager_calendar: map["programManagerCalendar"], + program_discord_channel_name: map["programDiscordChannelName"], + program_discord_channel_url: map["programDiscordChannelUrl"], + billing_limits: BillingLimits.from(map: map["billingLimits"]), + billing_plan_downgrade: map["billingPlanDowngrade"], + billing_tax_id: map["billingTaxId"], + marked_for_deletion: map["markedForDeletion"], + platform: map["platform"], + projects: map["projects"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "name": @name, + "total": @total, + "prefs": @prefs.to_map, + "billingBudget": @billing_budget, + "budgetAlerts": @budget_alerts, + "billingPlan": @billing_plan, + "billingPlanId": @billing_plan_id, + "billingPlanDetails": @billing_plan_details.to_map, + "billingEmail": @billing_email, + "billingStartDate": @billing_start_date, + "billingCurrentInvoiceDate": @billing_current_invoice_date, + "billingNextInvoiceDate": @billing_next_invoice_date, + "billingTrialStartDate": @billing_trial_start_date, + "billingTrialDays": @billing_trial_days, + "billingAggregationId": @billing_aggregation_id, + "billingInvoiceId": @billing_invoice_id, + "paymentMethodId": @payment_method_id, + "billingAddressId": @billing_address_id, + "backupPaymentMethodId": @backup_payment_method_id, + "status": @status, + "remarks": @remarks, + "agreementBAA": @agreement_baa, + "programManagerName": @program_manager_name, + "programManagerCalendar": @program_manager_calendar, + "programDiscordChannelName": @program_discord_channel_name, + "programDiscordChannelUrl": @program_discord_channel_url, + "billingLimits": @billing_limits.to_map, + "billingPlanDowngrade": @billing_plan_downgrade, + "billingTaxId": @billing_tax_id, + "markedForDeletion": @marked_for_deletion, + "platform": @platform, + "projects": @projects + } + end + end + end +end diff --git a/lib/appwrite/models/policy_deny_corporate_email.rb b/lib/appwrite/models/policy_deny_corporate_email.rb new file mode 100644 index 00000000..d57f0c2c --- /dev/null +++ b/lib/appwrite/models/policy_deny_corporate_email.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class PolicyDenyCorporateEmail + attr_reader :id + attr_reader :enabled + + def initialize( + id:, + enabled: + ) + @id = id + @enabled = enabled + end + + def self.from(map:) + PolicyDenyCorporateEmail.new( + id: map["$id"], + enabled: map["enabled"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled + } + end + end + end +end diff --git a/lib/appwrite/models/policy_membership_privacy.rb b/lib/appwrite/models/policy_membership_privacy.rb index d18f76fc..9635ac3e 100644 --- a/lib/appwrite/models/policy_membership_privacy.rb +++ b/lib/appwrite/models/policy_membership_privacy.rb @@ -9,6 +9,7 @@ class PolicyMembershipPrivacy attr_reader :user_phone attr_reader :user_name attr_reader :user_mfa + attr_reader :user_accessed_at def initialize( id:, @@ -16,7 +17,8 @@ def initialize( user_email:, user_phone:, user_name:, - user_mfa: + user_mfa:, + user_accessed_at: ) @id = id @user_id = user_id @@ -24,6 +26,7 @@ def initialize( @user_phone = user_phone @user_name = user_name @user_mfa = user_mfa + @user_accessed_at = user_accessed_at end def self.from(map:) @@ -33,7 +36,8 @@ def self.from(map:) user_email: map["userEmail"], user_phone: map["userPhone"], user_name: map["userName"], - user_mfa: map["userMFA"] + user_mfa: map["userMFA"], + user_accessed_at: map["userAccessedAt"] ) end @@ -44,7 +48,8 @@ def to_map "userEmail": @user_email, "userPhone": @user_phone, "userName": @user_name, - "userMFA": @user_mfa + "userMFA": @user_mfa, + "userAccessedAt": @user_accessed_at } end end diff --git a/lib/appwrite/models/program.rb b/lib/appwrite/models/program.rb new file mode 100644 index 00000000..4a2f1032 --- /dev/null +++ b/lib/appwrite/models/program.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Program + attr_reader :id + attr_reader :title + attr_reader :description + attr_reader :tag + attr_reader :icon + attr_reader :url + attr_reader :active + attr_reader :external + attr_reader :billing_plan_id + + def initialize( + id:, + title:, + description:, + tag:, + icon:, + url:, + active:, + external:, + billing_plan_id: + ) + @id = id + @title = title + @description = description + @tag = tag + @icon = icon + @url = url + @active = active + @external = external + @billing_plan_id = billing_plan_id + end + + def self.from(map:) + Program.new( + id: map["$id"], + title: map["title"], + description: map["description"], + tag: map["tag"], + icon: map["icon"], + url: map["url"], + active: map["active"], + external: map["external"], + billing_plan_id: map["billingPlanId"] + ) + end + + def to_map + { + "$id": @id, + "title": @title, + "description": @description, + "tag": @tag, + "icon": @icon, + "url": @url, + "active": @active, + "external": @external, + "billingPlanId": @billing_plan_id + } + end + end + end +end diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index 519825eb..d520b652 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -24,6 +24,7 @@ class Project attr_reader :pinged_at attr_reader :labels attr_reader :status + attr_reader :onboarding attr_reader :auth_methods attr_reader :services attr_reader :protocols @@ -33,11 +34,17 @@ class Project attr_reader :o_auth2_server_enabled attr_reader :o_auth2_server_authorization_url attr_reader :o_auth2_server_scopes + attr_reader :o_auth2_server_default_scopes + attr_reader :o_auth2_server_authorization_details_types attr_reader :o_auth2_server_access_token_duration attr_reader :o_auth2_server_refresh_token_duration attr_reader :o_auth2_server_public_access_token_duration attr_reader :o_auth2_server_public_refresh_token_duration attr_reader :o_auth2_server_confidential_pkce + attr_reader :o_auth2_server_verification_url + attr_reader :o_auth2_server_user_code_length + attr_reader :o_auth2_server_user_code_format + attr_reader :o_auth2_server_device_code_duration attr_reader :o_auth2_server_discovery_url def initialize( @@ -62,21 +69,28 @@ def initialize( pinged_at:, labels:, status:, + onboarding:, auth_methods:, services:, protocols:, blocks:, console_accessed_at:, billing_limits: , - o_auth2_server_enabled:, - o_auth2_server_authorization_url:, - o_auth2_server_scopes:, - o_auth2_server_access_token_duration:, - o_auth2_server_refresh_token_duration:, - o_auth2_server_public_access_token_duration:, - o_auth2_server_public_refresh_token_duration:, - o_auth2_server_confidential_pkce:, - o_auth2_server_discovery_url: + o_auth2_server_enabled: , + o_auth2_server_authorization_url: , + o_auth2_server_scopes: , + o_auth2_server_default_scopes: , + o_auth2_server_authorization_details_types: , + o_auth2_server_access_token_duration: , + o_auth2_server_refresh_token_duration: , + o_auth2_server_public_access_token_duration: , + o_auth2_server_public_refresh_token_duration: , + o_auth2_server_confidential_pkce: , + o_auth2_server_verification_url: , + o_auth2_server_user_code_length: , + o_auth2_server_user_code_format: , + o_auth2_server_device_code_duration: , + o_auth2_server_discovery_url: ) @id = id @created_at = created_at @@ -99,6 +113,7 @@ def initialize( @pinged_at = pinged_at @labels = labels @status = status + @onboarding = onboarding @auth_methods = auth_methods @services = services @protocols = protocols @@ -108,11 +123,17 @@ def initialize( @o_auth2_server_enabled = o_auth2_server_enabled @o_auth2_server_authorization_url = o_auth2_server_authorization_url @o_auth2_server_scopes = o_auth2_server_scopes + @o_auth2_server_default_scopes = o_auth2_server_default_scopes + @o_auth2_server_authorization_details_types = o_auth2_server_authorization_details_types @o_auth2_server_access_token_duration = o_auth2_server_access_token_duration @o_auth2_server_refresh_token_duration = o_auth2_server_refresh_token_duration @o_auth2_server_public_access_token_duration = o_auth2_server_public_access_token_duration @o_auth2_server_public_refresh_token_duration = o_auth2_server_public_refresh_token_duration @o_auth2_server_confidential_pkce = o_auth2_server_confidential_pkce + @o_auth2_server_verification_url = o_auth2_server_verification_url + @o_auth2_server_user_code_length = o_auth2_server_user_code_length + @o_auth2_server_user_code_format = o_auth2_server_user_code_format + @o_auth2_server_device_code_duration = o_auth2_server_device_code_duration @o_auth2_server_discovery_url = o_auth2_server_discovery_url end @@ -139,6 +160,7 @@ def self.from(map:) pinged_at: map["pingedAt"], labels: map["labels"], status: map["status"], + onboarding: map["onboarding"], auth_methods: map["authMethods"].map { |it| ProjectAuthMethod.from(map: it) }, services: map["services"].map { |it| ProjectService.from(map: it) }, protocols: map["protocols"].map { |it| ProjectProtocol.from(map: it) }, @@ -148,11 +170,17 @@ def self.from(map:) o_auth2_server_enabled: map["oAuth2ServerEnabled"], o_auth2_server_authorization_url: map["oAuth2ServerAuthorizationUrl"], o_auth2_server_scopes: map["oAuth2ServerScopes"], + o_auth2_server_default_scopes: map["oAuth2ServerDefaultScopes"], + o_auth2_server_authorization_details_types: map["oAuth2ServerAuthorizationDetailsTypes"], o_auth2_server_access_token_duration: map["oAuth2ServerAccessTokenDuration"], o_auth2_server_refresh_token_duration: map["oAuth2ServerRefreshTokenDuration"], o_auth2_server_public_access_token_duration: map["oAuth2ServerPublicAccessTokenDuration"], o_auth2_server_public_refresh_token_duration: map["oAuth2ServerPublicRefreshTokenDuration"], o_auth2_server_confidential_pkce: map["oAuth2ServerConfidentialPkce"], + o_auth2_server_verification_url: map["oAuth2ServerVerificationUrl"], + o_auth2_server_user_code_length: map["oAuth2ServerUserCodeLength"], + o_auth2_server_user_code_format: map["oAuth2ServerUserCodeFormat"], + o_auth2_server_device_code_duration: map["oAuth2ServerDeviceCodeDuration"], o_auth2_server_discovery_url: map["oAuth2ServerDiscoveryUrl"] ) end @@ -180,6 +208,7 @@ def to_map "pingedAt": @pinged_at, "labels": @labels, "status": @status, + "onboarding": @onboarding, "authMethods": @auth_methods.map { |it| it.to_map }, "services": @services.map { |it| it.to_map }, "protocols": @protocols.map { |it| it.to_map }, @@ -189,11 +218,17 @@ def to_map "oAuth2ServerEnabled": @o_auth2_server_enabled, "oAuth2ServerAuthorizationUrl": @o_auth2_server_authorization_url, "oAuth2ServerScopes": @o_auth2_server_scopes, + "oAuth2ServerDefaultScopes": @o_auth2_server_default_scopes, + "oAuth2ServerAuthorizationDetailsTypes": @o_auth2_server_authorization_details_types, "oAuth2ServerAccessTokenDuration": @o_auth2_server_access_token_duration, "oAuth2ServerRefreshTokenDuration": @o_auth2_server_refresh_token_duration, "oAuth2ServerPublicAccessTokenDuration": @o_auth2_server_public_access_token_duration, "oAuth2ServerPublicRefreshTokenDuration": @o_auth2_server_public_refresh_token_duration, "oAuth2ServerConfidentialPkce": @o_auth2_server_confidential_pkce, + "oAuth2ServerVerificationUrl": @o_auth2_server_verification_url, + "oAuth2ServerUserCodeLength": @o_auth2_server_user_code_length, + "oAuth2ServerUserCodeFormat": @o_auth2_server_user_code_format, + "oAuth2ServerDeviceCodeDuration": @o_auth2_server_device_code_duration, "oAuth2ServerDiscoveryUrl": @o_auth2_server_discovery_url } end diff --git a/lib/appwrite/models/usage_billing_plan.rb b/lib/appwrite/models/usage_billing_plan.rb new file mode 100644 index 00000000..ec694844 --- /dev/null +++ b/lib/appwrite/models/usage_billing_plan.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class UsageBillingPlan + attr_reader :bandwidth + attr_reader :executions + attr_reader :member + attr_reader :realtime + attr_reader :realtime_messages + attr_reader :realtime_bandwidth + attr_reader :storage + attr_reader :users + attr_reader :gb_hours + attr_reader :image_transformations + attr_reader :credits + + def initialize( + bandwidth:, + executions:, + member:, + realtime:, + realtime_messages:, + realtime_bandwidth:, + storage:, + users:, + gb_hours:, + image_transformations:, + credits: + ) + @bandwidth = bandwidth + @executions = executions + @member = member + @realtime = realtime + @realtime_messages = realtime_messages + @realtime_bandwidth = realtime_bandwidth + @storage = storage + @users = users + @gb_hours = gb_hours + @image_transformations = image_transformations + @credits = credits + end + + def self.from(map:) + UsageBillingPlan.new( + bandwidth: AdditionalResource.from(map: map["bandwidth"]), + executions: AdditionalResource.from(map: map["executions"]), + member: AdditionalResource.from(map: map["member"]), + realtime: AdditionalResource.from(map: map["realtime"]), + realtime_messages: AdditionalResource.from(map: map["realtimeMessages"]), + realtime_bandwidth: AdditionalResource.from(map: map["realtimeBandwidth"]), + storage: AdditionalResource.from(map: map["storage"]), + users: AdditionalResource.from(map: map["users"]), + gb_hours: AdditionalResource.from(map: map["GBHours"]), + image_transformations: AdditionalResource.from(map: map["imageTransformations"]), + credits: AdditionalResource.from(map: map["credits"]) + ) + end + + def to_map + { + "bandwidth": @bandwidth.to_map, + "executions": @executions.to_map, + "member": @member.to_map, + "realtime": @realtime.to_map, + "realtimeMessages": @realtime_messages.to_map, + "realtimeBandwidth": @realtime_bandwidth.to_map, + "storage": @storage.to_map, + "users": @users.to_map, + "GBHours": @gb_hours.to_map, + "imageTransformations": @image_transformations.to_map, + "credits": @credits.to_map + } + end + end + end +end diff --git a/lib/appwrite/models/usage_event.rb b/lib/appwrite/models/usage_event.rb deleted file mode 100644 index c7d9fa66..00000000 --- a/lib/appwrite/models/usage_event.rb +++ /dev/null @@ -1,72 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class UsageEvent - attr_reader :metric - attr_reader :value - attr_reader :time - attr_reader :xpath - attr_reader :method - attr_reader :status - attr_reader :resource_type - attr_reader :resource_id - attr_reader :country_code - attr_reader :user_agent - - def initialize( - metric:, - value:, - time:, - xpath:, - method:, - status:, - resource_type:, - resource_id:, - country_code:, - user_agent: - ) - @metric = metric - @value = value - @time = time - @xpath = xpath - @method = method - @status = status - @resource_type = resource_type - @resource_id = resource_id - @country_code = country_code - @user_agent = user_agent - end - - def self.from(map:) - UsageEvent.new( - metric: map["metric"], - value: map["value"], - time: map["time"], - xpath: map["path"], - method: map["method"], - status: map["status"], - resource_type: map["resourceType"], - resource_id: map["resourceId"], - country_code: map["countryCode"], - user_agent: map["userAgent"] - ) - end - - def to_map - { - "metric": @metric, - "value": @value, - "time": @time, - "path": @xpath, - "method": @method, - "status": @status, - "resourceType": @resource_type, - "resourceId": @resource_id, - "countryCode": @country_code, - "userAgent": @user_agent - } - end - end - end -end diff --git a/lib/appwrite/models/usage_event_list.rb b/lib/appwrite/models/usage_event_list.rb deleted file mode 100644 index 29098858..00000000 --- a/lib/appwrite/models/usage_event_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class UsageEventList - attr_reader :total - attr_reader :events - - def initialize( - total:, - events: - ) - @total = total - @events = events - end - - def self.from(map:) - UsageEventList.new( - total: map["total"], - events: map["events"].map { |it| UsageEvent.from(map: it) } - ) - end - - def to_map - { - "total": @total, - "events": @events.map { |it| it.to_map } - } - end - end - end -end diff --git a/lib/appwrite/models/usage_gauge.rb b/lib/appwrite/models/usage_gauge.rb deleted file mode 100644 index 3df822ea..00000000 --- a/lib/appwrite/models/usage_gauge.rb +++ /dev/null @@ -1,47 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class UsageGauge - attr_reader :metric - attr_reader :value - attr_reader :time - attr_reader :resource_type - attr_reader :resource_id - - def initialize( - metric:, - value:, - time:, - resource_type:, - resource_id: - ) - @metric = metric - @value = value - @time = time - @resource_type = resource_type - @resource_id = resource_id - end - - def self.from(map:) - UsageGauge.new( - metric: map["metric"], - value: map["value"], - time: map["time"], - resource_type: map["resourceType"], - resource_id: map["resourceId"] - ) - end - - def to_map - { - "metric": @metric, - "value": @value, - "time": @time, - "resourceType": @resource_type, - "resourceId": @resource_id - } - end - end - end -end diff --git a/lib/appwrite/models/usage_gauge_list.rb b/lib/appwrite/models/usage_gauge_list.rb deleted file mode 100644 index e924801c..00000000 --- a/lib/appwrite/models/usage_gauge_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class UsageGaugeList - attr_reader :total - attr_reader :gauges - - def initialize( - total:, - gauges: - ) - @total = total - @gauges = gauges - end - - def self.from(map:) - UsageGaugeList.new( - total: map["total"], - gauges: map["gauges"].map { |it| UsageGauge.from(map: it) } - ) - end - - def to_map - { - "total": @total, - "gauges": @gauges.map { |it| it.to_map } - } - end - end - end -end diff --git a/lib/appwrite/models/user.rb b/lib/appwrite/models/user.rb index ec03e292..e55781e3 100644 --- a/lib/appwrite/models/user.rb +++ b/lib/appwrite/models/user.rb @@ -17,6 +17,11 @@ class User attr_reader :email attr_reader :phone attr_reader :email_verification + attr_reader :email_canonical + attr_reader :email_is_free + attr_reader :email_is_disposable + attr_reader :email_is_corporate + attr_reader :email_is_canonical attr_reader :phone_verification attr_reader :mfa attr_reader :prefs @@ -40,6 +45,11 @@ def initialize( email:, phone:, email_verification:, + email_canonical: , + email_is_free: , + email_is_disposable: , + email_is_corporate: , + email_is_canonical: , phone_verification:, mfa:, prefs:, @@ -62,6 +72,11 @@ def initialize( @email = email @phone = phone @email_verification = email_verification + @email_canonical = email_canonical + @email_is_free = email_is_free + @email_is_disposable = email_is_disposable + @email_is_corporate = email_is_corporate + @email_is_canonical = email_is_canonical @phone_verification = phone_verification @mfa = mfa @prefs = prefs @@ -87,6 +102,11 @@ def self.from(map:) email: map["email"], phone: map["phone"], email_verification: map["emailVerification"], + email_canonical: map["emailCanonical"], + email_is_free: map["emailIsFree"], + email_is_disposable: map["emailIsDisposable"], + email_is_corporate: map["emailIsCorporate"], + email_is_canonical: map["emailIsCanonical"], phone_verification: map["phoneVerification"], mfa: map["mfa"], prefs: Preferences.from(map: map["prefs"]), @@ -113,6 +133,11 @@ def to_map "email": @email, "phone": @phone, "emailVerification": @email_verification, + "emailCanonical": @email_canonical, + "emailIsFree": @email_is_free, + "emailIsDisposable": @email_is_disposable, + "emailIsCorporate": @email_is_corporate, + "emailIsCanonical": @email_is_canonical, "phoneVerification": @phone_verification, "mfa": @mfa, "prefs": @prefs.to_map, diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index 6ac666b1..aa7f01e2 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -232,6 +232,18 @@ def distance_less_than(attribute, values, distance, meters = true) return Query.new("distanceLessThan", attribute, [[values, distance, meters]]).to_s end + def vector_dot(attribute, vector) + return Query.new("vectorDot", attribute, [vector]).to_s + end + + def vector_cosine(attribute, vector) + return Query.new("vectorCosine", attribute, [vector]).to_s + end + + def vector_euclidean(attribute, vector) + return Query.new("vectorEuclidean", attribute, [vector]).to_s + end + def intersects(attribute, values) return Query.new("intersects", attribute, [values]).to_s end @@ -265,4 +277,4 @@ def not_touches(attribute, values) end end end -end \ No newline at end of file +end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 068b478f..23087c01 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -19,6 +19,7 @@ def get() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -70,6 +71,7 @@ def create(user_id:, email:, password:, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -114,6 +116,7 @@ def update_email(email:, password:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -142,6 +145,7 @@ def list_identities(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -203,6 +207,7 @@ def create_jwt(duration: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -232,6 +237,7 @@ def list_logs(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -263,6 +269,7 @@ def update_mfa(mfa:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -297,6 +304,7 @@ def create_mfa_authenticator(type:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -336,6 +344,7 @@ def update_mfa_authenticator(type:, otp:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -399,6 +408,7 @@ def create_mfa_challenge(factor:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -440,6 +450,7 @@ def update_mfa_challenge(challenge_id:, otp:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -464,6 +475,7 @@ def list_mfa_factors() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -491,6 +503,7 @@ def get_mfa_recovery_codes() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -520,6 +533,7 @@ def create_mfa_recovery_codes() api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -548,6 +562,7 @@ def update_mfa_recovery_codes() api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -579,6 +594,7 @@ def update_name(name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -614,6 +630,7 @@ def update_password(password:, old_password: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -655,6 +672,7 @@ def update_phone(phone:, password:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -679,6 +697,7 @@ def get_prefs() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -712,6 +731,7 @@ def update_prefs(prefs:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -756,6 +776,7 @@ def create_recovery(email:, url:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -808,6 +829,7 @@ def update_recovery(user_id:, secret:, password:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -833,6 +855,7 @@ def list_sessions() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -889,6 +912,7 @@ def create_anonymous_session() api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -931,6 +955,7 @@ def create_email_password_session(email:, password:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -973,6 +998,7 @@ def update_magic_url_session(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1015,6 +1041,7 @@ def update_phone_session(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1054,6 +1081,7 @@ def create_session(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1085,6 +1113,7 @@ def get_session(session_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1118,6 +1147,7 @@ def update_session(session_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1179,6 +1209,7 @@ def update_status() api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1231,6 +1262,7 @@ def create_email_token(user_id:, email:, phrase: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1285,6 +1317,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1312,7 +1345,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -1334,6 +1367,7 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'text/html', } @client.call( @@ -1380,6 +1414,7 @@ def create_phone_token(user_id:, phone:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1425,6 +1460,7 @@ def create_email_verification(url:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1473,6 +1509,7 @@ def create_verification(url:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1513,6 +1550,7 @@ def update_email_verification(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1556,6 +1594,7 @@ def update_verification(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1588,6 +1627,7 @@ def create_phone_verification() api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1628,6 +1668,7 @@ def update_phone_verification(user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/activities.rb b/lib/appwrite/services/activities.rb index c8d94a7c..e14db113 100644 --- a/lib/appwrite/services/activities.rb +++ b/lib/appwrite/services/activities.rb @@ -21,6 +21,7 @@ def list_events(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -52,6 +53,7 @@ def get_event(event_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/advisor.rb b/lib/appwrite/services/advisor.rb index 83703be1..571216cf 100644 --- a/lib/appwrite/services/advisor.rb +++ b/lib/appwrite/services/advisor.rb @@ -25,6 +25,7 @@ def list_reports(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -57,6 +58,7 @@ def get_report(report_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -125,6 +127,7 @@ def list_insights(report_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -162,6 +165,7 @@ def get_insight(report_id:, insight_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index 9d8d9d9e..e4163c75 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -40,6 +40,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( @@ -83,6 +84,7 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( @@ -115,6 +117,7 @@ def get_favicon(url:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/*', } @client.call( @@ -159,6 +162,7 @@ def get_flag(code:, width: nil, height: nil, quality: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( @@ -202,6 +206,7 @@ def get_image(url:, width: nil, height: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/*', } @client.call( @@ -248,6 +253,7 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( @@ -285,6 +291,7 @@ def get_qr(text:, size: nil, margin: nil, download: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( @@ -361,6 +368,7 @@ def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/png', } @client.call( diff --git a/lib/appwrite/services/backups.rb b/lib/appwrite/services/backups.rb index bb9432be..936833da 100644 --- a/lib/appwrite/services/backups.rb +++ b/lib/appwrite/services/backups.rb @@ -21,6 +21,7 @@ def list_archives(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -54,6 +55,7 @@ def create_archive(services:, resource_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -84,6 +86,7 @@ def get_archive(archive_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -115,6 +118,7 @@ def delete_archive(archive_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -140,6 +144,7 @@ def list_policies(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -195,6 +200,7 @@ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resou api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -225,6 +231,7 @@ def get_policy(policy_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -264,6 +271,7 @@ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -295,6 +303,7 @@ def delete_policy(policy_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -307,14 +316,25 @@ def delete_policy(policy_id:) end # Create and trigger a new restoration for a backup on a project. + # + # When restoring a DocumentsDB or VectorsDB database to a new resource, pass + # `newSpecification` to provision the restored database on a different + # specification than the archived one (for example, restoring onto a larger + # or smaller dedicated database). Use `serverless` to restore onto the shared + # pool, or a dedicated specification slug to restore onto a dedicated + # database of that size. The specification must be permitted by the + # organization's plan. `newSpecification` is not supported for + # legacy/TablesDB databases or for bucket restores. + # # # @param [String] archive_id Backup archive ID to restore # @param [Array] services Array of services to restore # @param [String] new_resource_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] new_resource_name Database name. Max length: 128 chars. + # @param [String] new_specification Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. # # @return [BackupRestoration] - def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) + def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil, new_specification: nil) api_path = '/backups/restoration' if archive_id.nil? @@ -330,11 +350,13 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc services: services, newResourceId: new_resource_id, newResourceName: new_resource_name, + newSpecification: new_specification, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -361,6 +383,7 @@ def list_restorations(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -391,6 +414,7 @@ def get_restoration(restoration_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 354cc882..c4f6341c 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -29,6 +29,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -72,6 +73,7 @@ def create(database_id:, name:, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -84,6 +86,9 @@ def create(database_id:, name:, enabled: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTransactions` instead. + # # List transactions across all databases. # # @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). @@ -98,6 +103,7 @@ def list_transactions(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -110,6 +116,9 @@ def list_transactions(queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTransaction` instead. + # # Create a new transaction. # # @param [Integer] ttl Seconds before the transaction expires. @@ -125,6 +134,7 @@ def create_transaction(ttl: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -137,6 +147,9 @@ def create_transaction(ttl: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTransaction` instead. + # # Get a transaction by its unique ID. # # @param [String] transaction_id Transaction ID. @@ -155,6 +168,7 @@ def get_transaction(transaction_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -167,6 +181,9 @@ def get_transaction(transaction_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTransaction` instead. + # # Update a transaction, to either commit or roll back its operations. # # @param [String] transaction_id Transaction ID. @@ -190,6 +207,7 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -202,6 +220,9 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTransaction` instead. + # # Delete a transaction by its unique ID. # # @param [String] transaction_id Transaction ID. @@ -232,6 +253,9 @@ def delete_transaction(transaction_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createOperations` instead. + # # Create multiple operations in a single transaction. # # @param [String] transaction_id Transaction ID. @@ -253,6 +277,7 @@ def create_operations(transaction_id:, operations: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -287,6 +312,7 @@ def get(database_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -325,6 +351,7 @@ def update(database_id:, name: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -399,6 +426,7 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -458,6 +486,7 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -498,6 +527,7 @@ def get_collection(database_id:, collection_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -548,6 +578,7 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -631,6 +662,7 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -693,6 +725,7 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -759,6 +792,7 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -816,6 +850,7 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -877,6 +912,7 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -933,6 +969,7 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -994,6 +1031,7 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1051,6 +1089,7 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1113,6 +1152,7 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1177,6 +1217,7 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1245,6 +1286,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1307,6 +1349,7 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1373,6 +1416,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1435,6 +1479,7 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1501,6 +1546,7 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1558,6 +1604,7 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1620,6 +1667,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1674,6 +1722,7 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1731,6 +1780,7 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1743,6 +1793,9 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLongtextColumn` instead. + # # Create a longtext attribute. # # @@ -1787,6 +1840,7 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1799,6 +1853,9 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLongtextColumn` instead. + # # Update a longtext attribute. Changing the `default` value will not update # already existing documents. # @@ -1846,6 +1903,7 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1858,6 +1916,9 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createMediumtextColumn` instead. + # # Create a mediumtext attribute. # # @@ -1902,6 +1963,7 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1914,6 +1976,9 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateMediumtextColumn` instead. + # # Update a mediumtext attribute. Changing the `default` value will not update # already existing documents. # @@ -1961,6 +2026,7 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2015,6 +2081,7 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2072,6 +2139,7 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2126,6 +2194,7 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2183,6 +2252,7 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2245,6 +2315,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2297,6 +2368,7 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2362,6 +2434,7 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2426,6 +2499,7 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2438,6 +2512,9 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTextColumn` instead. + # # Create a text attribute. # # @@ -2482,6 +2559,7 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2494,6 +2572,9 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. + # # Update a text attribute. Changing the `default` value will not update # already existing documents. # @@ -2541,6 +2622,7 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2598,6 +2680,7 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2660,6 +2743,7 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2672,6 +2756,9 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createVarcharColumn` instead. + # # Create a varchar attribute. # # @@ -2722,6 +2809,7 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2734,6 +2822,9 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateVarcharColumn` instead. + # # Update a varchar attribute. Changing the `default` value will not update # already existing documents. # @@ -2783,6 +2874,7 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2828,6 +2920,7 @@ def get_attribute(database_id:, collection_id:, key:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } response = @client.call( @@ -2976,6 +3069,7 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3035,6 +3129,7 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3086,6 +3181,7 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3138,6 +3234,7 @@ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3186,6 +3283,7 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3231,6 +3329,7 @@ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3281,6 +3380,7 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil, trans api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3336,6 +3436,7 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3389,6 +3490,7 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3494,6 +3596,7 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3552,6 +3655,7 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3595,6 +3699,7 @@ def list_indexes(database_id:, collection_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3659,6 +3764,7 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3704,6 +3810,7 @@ def get_index(database_id:, collection_id:, key:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index c622b6b2..20132479 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -26,6 +26,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -54,7 +55,7 @@ def list(queries: nil, search: nil, total: nil) # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. - # @param [Array] scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + # @param [Array] scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment. # @param [String] provider_repository_id Repository ID of the repo linked to the function. # @param [String] provider_branch Production branch for the repo linked to the function. @@ -110,6 +111,7 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -134,6 +136,7 @@ def list_runtimes() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -148,16 +151,19 @@ def list_runtimes() # List allowed function specifications for this instance. # + # @param [String] type Specification type to list. Can be one of: runtimes, builds. # # @return [SpecificationList] - def list_specifications() + def list_specifications(type: nil) api_path = '/functions/specifications' api_params = { + type: type, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -188,6 +194,7 @@ def get(function_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -213,7 +220,7 @@ def get(function_id:) # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. - # @param [Array] scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + # @param [Array] scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Controle System) deployment. # @param [String] provider_repository_id Repository ID of the repo linked to the function # @param [String] provider_branch Production branch for the repo linked to the function @@ -265,6 +272,7 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -333,6 +341,7 @@ def update_function_deployment(function_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -370,6 +379,7 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -426,6 +436,7 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', + "accept": 'application/json', } id_param_name = nil @@ -474,6 +485,7 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -541,6 +553,7 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -588,6 +601,7 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -624,6 +638,7 @@ def get_deployment(function_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -679,9 +694,10 @@ def delete_deployment(function_id:, deployment_id:) # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(function_id:, deployment_id:, type: nil) + def get_deployment_download(function_id:, deployment_id:, type: nil, token: nil) api_path = '/functions/{functionId}/deployments/{deploymentId}/download' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) @@ -696,10 +712,12 @@ def get_deployment_download(function_id:, deployment_id:, type: nil) api_params = { type: type, + token: token, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": '*/*', } @client.call( @@ -740,6 +758,7 @@ def update_deployment_status(function_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -775,6 +794,7 @@ def list_executions(function_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -821,6 +841,7 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -857,6 +878,7 @@ def get_execution(function_id:, execution_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -927,6 +949,7 @@ def list_variables(function_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -979,6 +1002,7 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1015,6 +1039,7 @@ def get_variable(function_id:, variable_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1058,6 +1083,7 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/graphql.rb b/lib/appwrite/services/graphql.rb index 8f3c6aad..2ba03f56 100644 --- a/lib/appwrite/services/graphql.rb +++ b/lib/appwrite/services/graphql.rb @@ -27,6 +27,7 @@ def query(query:) "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -58,6 +59,7 @@ def mutation(query:) "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/health.rb b/lib/appwrite/services/health.rb deleted file mode 100644 index fbd59efb..00000000 --- a/lib/appwrite/services/health.rb +++ /dev/null @@ -1,681 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - class Health < Service - - def initialize(client) - @client = client - end - - # Check the Appwrite HTTP server is up and responsive. - # - # - # @return [HealthStatus] - def get() - api_path = '/health' - - 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::HealthStatus - ) - - end - - # Check the Appwrite Antivirus server is up and connection is successful. - # - # - # @return [HealthAntivirus] - def get_antivirus() - api_path = '/health/anti-virus' - - 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::HealthAntivirus - ) - - end - - # Check the database that backs the audit and activity store. When the - # connection is reachable the endpoint returns a passing status with its - # response time. - # - # - # - # @return [HealthStatusList] - def get_audits_db() - api_path = '/health/audits-db' - - 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::HealthStatusList - ) - - end - - # Check the Appwrite in-memory cache servers are up and connection is - # successful. - # - # - # @return [HealthStatusList] - def get_cache() - api_path = '/health/cache' - - 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::HealthStatusList - ) - - end - - # Get the SSL certificate for a domain - # - # @param [String] domain string - # - # @return [HealthCertificate] - def get_certificate(domain: nil) - api_path = '/health/certificate' - - api_params = { - domain: domain, - } - - 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::HealthCertificate - ) - - end - - # Get console pausing health status. Monitors projects approaching the pause - # threshold to detect potential issues with console access tracking. - # - # - # @param [Integer] threshold Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. - # @param [Integer] inactivity_days Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. - # - # @return [HealthStatus] - def get_console_pausing(threshold: nil, inactivity_days: nil) - api_path = '/health/console-pausing' - - api_params = { - threshold: threshold, - inactivityDays: inactivity_days, - } - - 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::HealthStatus - ) - - end - - # Check the Appwrite database servers are up and connection is successful. - # - # - # @return [HealthStatusList] - def get_db() - api_path = '/health/db' - - 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::HealthStatusList - ) - - end - - # Check the Appwrite pub-sub servers are up and connection is successful. - # - # - # @return [HealthStatusList] - def get_pub_sub() - api_path = '/health/pubsub' - - 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::HealthStatusList - ) - - end - - # Get the number of audit logs that are waiting to be processed in the - # Appwrite internal queue server. - # - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_audits(threshold: nil) - api_path = '/health/queue/audits' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of builds that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_builds(threshold: nil) - api_path = '/health/queue/builds' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of certificates that are waiting to be issued against - # [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue - # server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_certificates(threshold: nil) - api_path = '/health/queue/certificates' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of database changes that are waiting to be processed in the - # Appwrite internal queue server. - # - # @param [String] name Queue name for which to check the queue size - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_databases(name: nil, threshold: nil) - api_path = '/health/queue/databases' - - api_params = { - name: name, - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of background destructive changes that are waiting to be - # processed in the Appwrite internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_deletes(threshold: nil) - api_path = '/health/queue/deletes' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Returns the amount of failed jobs in a given queue. - # - # - # @param [HealthQueueName] name The name of the queue - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_failed_jobs(name:, threshold: nil) - api_path = '/health/queue/failed/{name}' - .gsub('{name}', name) - - if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') - end - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of function executions that are waiting to be processed in - # the Appwrite internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_functions(threshold: nil) - api_path = '/health/queue/functions' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of logs that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_logs(threshold: nil) - api_path = '/health/queue/logs' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of mails that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_mails(threshold: nil) - api_path = '/health/queue/mails' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of messages that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_messaging(threshold: nil) - api_path = '/health/queue/messaging' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of migrations that are waiting to be processed in the - # Appwrite internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_migrations(threshold: nil) - api_path = '/health/queue/migrations' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of metrics that are waiting to be processed in the Appwrite - # stats resources queue. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_stats_resources(threshold: nil) - api_path = '/health/queue/stats-resources' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of metrics that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_usage(threshold: nil) - api_path = '/health/queue/stats-usage' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Get the number of webhooks that are waiting to be processed in the Appwrite - # internal queue server. - # - # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - # - # @return [HealthQueue] - def get_queue_webhooks(threshold: nil) - api_path = '/health/queue/webhooks' - - api_params = { - threshold: threshold, - } - - 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::HealthQueue - ) - - end - - # Check the Appwrite storage device is up and connection is successful. - # - # - # @return [HealthStatus] - def get_storage() - api_path = '/health/storage' - - 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::HealthStatus - ) - - end - - # Check the Appwrite local storage device is up and connection is successful. - # - # - # @return [HealthStatus] - def get_storage_local() - api_path = '/health/storage/local' - - 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::HealthStatus - ) - - end - - # Check the Appwrite server time is synced with Google remote NTP server. We - # use this technology to smoothly handle leap seconds with no disruptive - # events. The [Network Time - # Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is - # used by hundreds of millions of computers and devices to synchronize their - # clocks over the Internet. If your computer sets its own clock, it likely - # uses NTP. - # - # - # @return [HealthTime] - def get_time() - api_path = '/health/time' - - 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::HealthTime - ) - - end - - end -end diff --git a/lib/appwrite/services/locale.rb b/lib/appwrite/services/locale.rb index 103f4f44..6c76a957 100644 --- a/lib/appwrite/services/locale.rb +++ b/lib/appwrite/services/locale.rb @@ -24,6 +24,7 @@ def get() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -49,6 +50,7 @@ def list_codes() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -74,6 +76,7 @@ def list_continents() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -99,6 +102,7 @@ def list_countries() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -124,6 +128,7 @@ def list_countries_eu() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -149,6 +154,7 @@ def list_countries_phones() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -175,6 +181,7 @@ def list_currencies() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -200,6 +207,7 @@ def list_languages() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/messaging.rb b/lib/appwrite/services/messaging.rb index 0ebf8f7e..d982aa12 100644 --- a/lib/appwrite/services/messaging.rb +++ b/lib/appwrite/services/messaging.rb @@ -25,6 +25,7 @@ def list_messages(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -86,6 +87,7 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -142,6 +144,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -209,6 +212,7 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -279,6 +283,7 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -326,6 +331,7 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -372,6 +378,7 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -403,6 +410,7 @@ def get_message(message_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -446,40 +454,6 @@ def delete(message_id:) end - # Get the message activity logs listed by its unique ID. - # - # @param [String] message_id Message ID. - # @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). Only supported methods are limit and offset - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [LogList] - def list_message_logs(message_id:, queries: nil, total: nil) - api_path = '/messaging/messages/{messageId}/logs' - .gsub('{messageId}', message_id) - - if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') - end - - api_params = { - queries: queries, - total: total, - } - - 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::LogList - ) - - end - # Get a list of the targets associated with a message. # # @param [String] message_id Message ID. @@ -502,6 +476,7 @@ def list_targets(message_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -532,6 +507,7 @@ def list_providers(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -581,6 +557,7 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -626,6 +603,7 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -667,6 +645,7 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -704,6 +683,7 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -757,6 +737,7 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -806,6 +787,7 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -851,6 +833,7 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -892,6 +875,7 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -941,6 +925,7 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -986,6 +971,7 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1035,6 +1021,7 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1080,6 +1067,7 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1133,6 +1121,7 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1182,6 +1171,7 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1247,6 +1237,7 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1304,6 +1295,7 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1349,6 +1341,7 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1390,6 +1383,7 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1435,6 +1429,7 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1476,6 +1471,7 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1521,6 +1517,7 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1562,6 +1559,7 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1607,6 +1605,7 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1648,6 +1647,7 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1679,6 +1679,7 @@ def get_provider(provider_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1721,74 +1722,6 @@ def delete_provider(provider_id:) end - # Get the provider activity logs listed by its unique ID. - # - # @param [String] provider_id Provider ID. - # @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). Only supported methods are limit and offset - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [LogList] - def list_provider_logs(provider_id:, queries: nil, total: nil) - api_path = '/messaging/providers/{providerId}/logs' - .gsub('{providerId}', provider_id) - - if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') - end - - api_params = { - queries: queries, - total: total, - } - - 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::LogList - ) - - end - - # Get the subscriber activity logs listed by its unique ID. - # - # @param [String] subscriber_id Subscriber ID. - # @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). Only supported methods are limit and offset - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [LogList] - def list_subscriber_logs(subscriber_id:, queries: nil, total: nil) - api_path = '/messaging/subscribers/{subscriberId}/logs' - .gsub('{subscriberId}', subscriber_id) - - if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') - end - - api_params = { - queries: queries, - total: total, - } - - 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::LogList - ) - - end - # Get a list of all topics from the current Appwrite project. # # @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. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal @@ -1807,6 +1740,7 @@ def list_topics(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1846,6 +1780,7 @@ def create_topic(topic_id:, name:, subscribe: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1877,6 +1812,7 @@ def get_topic(topic_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1913,6 +1849,7 @@ def update_topic(topic_id:, name: nil, subscribe: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1955,40 +1892,6 @@ def delete_topic(topic_id:) end - # Get the topic activity logs listed by its unique ID. - # - # @param [String] topic_id Topic ID. - # @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). Only supported methods are limit and offset - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [LogList] - def list_topic_logs(topic_id:, queries: nil, total: nil) - api_path = '/messaging/topics/{topicId}/logs' - .gsub('{topicId}', topic_id) - - if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') - end - - api_params = { - queries: queries, - total: total, - } - - 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::LogList - ) - - end - # Get a list of all subscribers from the current Appwrite project. # # @param [String] topic_id Topic ID. The topic ID subscribed to. @@ -2013,6 +1916,7 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -2056,6 +1960,7 @@ def create_subscriber(topic_id:, subscriber_id:, target_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2093,6 +1998,7 @@ def get_subscriber(topic_id:, subscriber_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/organization.rb b/lib/appwrite/services/organization.rb index 77d626d0..2405ffff 100644 --- a/lib/appwrite/services/organization.rb +++ b/lib/appwrite/services/organization.rb @@ -7,6 +7,88 @@ def initialize(client) @client = client end + # Get the current organization. + # + # + # @return [Organization] + 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 + + # Update the current organization's name. + # + # @param [String] name New organization name. Max length: 128 chars. + # + # @return [Organization] + 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 + + # Delete the current organization. All projects that belong to the + # organization are deleted as well. + # + # + # @return [] + 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 + # Get a list of all API keys from the current organization. # # @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. You may filter on the following attributes: expire, accessedAt, name, scopes @@ -23,6 +105,7 @@ def list_keys(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -39,7 +122,7 @@ def list_keys(queries: nil, total: nil) # # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Key name. Max length: 128 chars. - # @param [Array] scopes Key scopes list. Maximum of 100 scopes are allowed. + # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] @@ -68,6 +151,7 @@ def create_key(key_id:, name:, scopes:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -99,6 +183,7 @@ def get_key(key_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -116,7 +201,7 @@ def get_key(key_id:) # # @param [String] key_id Key unique ID. # @param [String] name Key name. Max length: 128 chars. - # @param [Array] scopes Key scopes list. Maximum of 100 scopes are allowed. + # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] @@ -145,6 +230,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -188,10 +274,186 @@ def delete_key(key_id:) end + # Get a list of all memberships from the current organization. + # + # @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. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [MembershipList] + 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 + + # 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. + # + # @param [Array] roles Array of strings. Use this param to set the user roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # @param [String] email Email of the new organization member. + # @param [String] user_id ID of the user to be added to the organization. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. + # @param [String] name Name of the new organization member. Max length: 128 chars. + # + # @return [Membership] + 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 + + # Get a membership from the current organization by its unique ID. + # + # @param [String] membership_id Membership ID. + # + # @return [Membership] + 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 + + # Modify the roles of a member in the current organization. + # + # @param [String] membership_id Membership ID. + # @param [Array] roles An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # + # @return [Membership] + 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 + + # Remove a member from the current organization. The member is removed + # whether they accepted the invitation or not; a pending invitation is + # revoked. + # + # @param [String] membership_id Membership ID. + # + # @return [] + 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 + # Get a list of all projects. You can use the query params to filter your # results. # - # @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. You may filter on the following attributes: name, teamId, labels, search + # @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. You may filter on the following attributes: name, teamId, labels, search, accessedAt # @param [String] search Search term to filter your list results. Max length: 256 chars. # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # @@ -207,6 +469,7 @@ def list_projects(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -246,6 +509,7 @@ def create_project(project_id:, name:, region: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -313,6 +577,7 @@ def update_project(project_id:, name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/presences.rb b/lib/appwrite/services/presences.rb index a839b01e..d5f1c30c 100644 --- a/lib/appwrite/services/presences.rb +++ b/lib/appwrite/services/presences.rb @@ -26,6 +26,7 @@ def list(queries: nil, total: nil, ttl: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -58,6 +59,7 @@ def get(presence_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -108,6 +110,7 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -157,6 +160,7 @@ def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index d71c0960..954ef3bf 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -81,6 +81,7 @@ def update_auth_method(method_id:, enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -109,6 +110,7 @@ def list_keys(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -129,7 +131,7 @@ def list_keys(queries: nil, total: nil) # # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Key name. Max length: 128 chars. - # @param [Array] scopes Key scopes list. Maximum of 100 scopes are allowed. + # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] @@ -158,6 +160,7 @@ def create_key(key_id:, name:, scopes:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -176,7 +179,7 @@ def create_key(key_id:, name:, scopes:, expire: nil) # You can also create a standard API key if you need a longer-lived key # instead. # - # @param [Array] scopes Key scopes list. Maximum of 100 scopes are allowed. + # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [Integer] duration Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. # # @return [EphemeralKey] @@ -199,6 +202,7 @@ def create_ephemeral_key(scopes:, duration:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -229,6 +233,7 @@ def get_key(key_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -246,7 +251,7 @@ def get_key(key_id:) # # @param [String] key_id Key ID. # @param [String] name Key name. Max length: 128 chars. - # @param [Array] scopes Key scopes list. Maximum of 100 scopes are allowed. + # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] @@ -275,6 +280,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -338,6 +344,7 @@ def update_labels(labels:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -367,6 +374,7 @@ def list_mock_phones(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -405,6 +413,7 @@ def create_mock_phone(number:, otp:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -436,6 +445,7 @@ def get_mock_phone(number:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -474,6 +484,7 @@ def update_mock_phone(number:, otp:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -535,6 +546,7 @@ def list_o_auth2_providers(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -552,14 +564,20 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [] enabled Enable or disable the OAuth2 server. # @param [String] authorization_url URL to your application with consent screen. # @param [Array] scopes List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + # @param [Array] authorization_details_types List of accepted `authorization_details` types. Maximum of 100 types are allowed, each up to 128 characters long. # @param [Integer] access_token_duration Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. # @param [Integer] refresh_token_duration Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. # @param [Integer] public_access_token_duration Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. # @param [Integer] public_refresh_token_duration Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. # @param [] confidential_pkce When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + # @param [String] verification_url URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. + # @param [Integer] user_code_length Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. + # @param [String] user_code_format Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. + # @param [Integer] device_code_duration Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. + # @param [Array] default_scopes List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. # # @return [Project] - def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, confidential_pkce: nil) + def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil) api_path = '/project/oauth2-server' if enabled.nil? @@ -574,16 +592,23 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, access_toke enabled: enabled, authorizationUrl: authorization_url, scopes: scopes, + authorizationDetailsTypes: authorization_details_types, accessTokenDuration: access_token_duration, refreshTokenDuration: refresh_token_duration, publicAccessTokenDuration: public_access_token_duration, publicRefreshTokenDuration: public_refresh_token_duration, confidentialPkce: confidential_pkce, + verificationUrl: verification_url, + userCodeLength: user_code_length, + userCodeFormat: user_code_format, + deviceCodeDuration: device_code_duration, + defaultScopes: default_scopes, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -615,6 +640,7 @@ def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -650,6 +676,7 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -662,6 +689,38 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni end + # Update the project OAuth2 Appwrite configuration. + # + # @param [String] client_id 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 + # @param [String] client_secret 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 + # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + # + # @return [OAuth2Appwrite] + def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) + api_path = '/project/oauth2/appwrite' + + api_params = { + clientId: client_id, + clientSecret: client_secret, + enabled: enabled, + } + + 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::OAuth2Appwrite + ) + + end + # Update the project OAuth2 Auth0 configuration. # # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq @@ -683,6 +742,7 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -716,6 +776,7 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -747,6 +808,7 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -778,6 +840,7 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -809,6 +872,7 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -840,6 +904,7 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -871,6 +936,7 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -902,6 +968,7 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -933,6 +1000,7 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -964,6 +1032,7 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -995,6 +1064,7 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1026,6 +1096,7 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1057,6 +1128,7 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1090,6 +1162,7 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1121,6 +1194,7 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1154,6 +1228,7 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1187,6 +1262,7 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabl api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1222,6 +1298,7 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1253,6 +1330,7 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1284,6 +1362,7 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1317,6 +1396,7 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1348,6 +1428,7 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1368,10 +1449,12 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable # @param [String] authorization_url OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize # @param [String] token_url OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token # @param [String] user_info_url OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + # @param [Array] prompt Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + # @param [Integer] max_age Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds, otherwise they are prompted to re-authenticate. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Oidc] - def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, authorization_url: nil, token_url: nil, user_info_url: nil, enabled: nil) + def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, authorization_url: nil, token_url: nil, user_info_url: nil, prompt: nil, max_age: nil, enabled: nil) api_path = '/project/oauth2/oidc' api_params = { @@ -1381,12 +1464,15 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, authorizationURL: authorization_url, tokenURL: token_url, userInfoURL: user_info_url, + prompt: prompt, + maxAge: max_age, enabled: enabled, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1422,6 +1508,7 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1453,6 +1540,7 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1484,6 +1572,7 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1515,6 +1604,7 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1546,6 +1636,7 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1577,6 +1668,7 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1608,6 +1700,7 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1639,6 +1732,7 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1670,6 +1764,7 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1701,6 +1796,7 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1732,6 +1828,7 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1763,6 +1860,7 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1794,6 +1892,7 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1825,6 +1924,7 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1856,6 +1956,7 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1887,6 +1988,7 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1918,6 +2020,7 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1949,6 +2052,7 @@ def get_o_auth2_provider(provider_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } response = @client.call( @@ -2183,6 +2287,7 @@ def list_platforms(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -2228,6 +2333,7 @@ def create_android_platform(platform_id:, name:, application_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2272,6 +2378,7 @@ def update_android_platform(platform_id:, name:, application_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2317,6 +2424,7 @@ def create_apple_platform(platform_id:, name:, bundle_identifier:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2361,6 +2469,7 @@ def update_apple_platform(platform_id:, name:, bundle_identifier:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2406,6 +2515,7 @@ def create_linux_platform(platform_id:, name:, package_name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2450,6 +2560,7 @@ def update_linux_platform(platform_id:, name:, package_name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2495,6 +2606,7 @@ def create_web_platform(platform_id:, name:, hostname:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2539,6 +2651,7 @@ def update_web_platform(platform_id:, name:, hostname:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2584,6 +2697,7 @@ def create_windows_platform(platform_id:, name:, package_identifier_name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2628,6 +2742,7 @@ def update_windows_platform(platform_id:, name:, package_identifier_name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2659,6 +2774,7 @@ def get_platform(platform_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } response = @client.call( @@ -2748,6 +2864,7 @@ def list_policies(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -2780,6 +2897,40 @@ def update_deny_aliased_email_policy(enabled:) 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 + + # Configures if only corporate email addresses (non-free and non-disposable + # domains) are allowed during new user sign-ups and email updates. + # + # @param [] enabled Set whether or not to restrict sign-ups and email updates to corporate email addresses only. + # + # @return [Project] + def update_deny_corporate_email_policy(enabled:) + api_path = '/project/policies/deny-corporate-email' + + if enabled.nil? + raise Appwrite::Exception.new('Missing required parameter: "enabled"') + end + + api_params = { + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2812,6 +2963,7 @@ def update_deny_disposable_email_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2844,6 +2996,7 @@ def update_deny_free_email_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2865,9 +3018,10 @@ def update_deny_free_email_policy(enabled:) # @param [] user_phone Set to true if you want make user phone number visible to all team members, or false to hide it. # @param [] user_name Set to true if you want make user name visible to all team members, or false to hide it. # @param [] user_mfa Set to true if you want make user MFA status visible to all team members, or false to hide it. + # @param [] user_accessed_at Set to true if you want make user last access time visible to all team members, or false to hide it. # # @return [Project] - def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: nil, user_name: nil, user_mfa: nil) + def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: nil, user_name: nil, user_mfa: nil, user_accessed_at: nil) api_path = '/project/policies/membership-privacy' api_params = { @@ -2876,11 +3030,13 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: userPhone: user_phone, userName: user_name, userMFA: user_mfa, + userAccessedAt: user_accessed_at, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2914,6 +3070,7 @@ def update_password_dictionary_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2953,6 +3110,7 @@ def update_password_history_policy(total:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2987,6 +3145,7 @@ def update_password_personal_data_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3022,6 +3181,7 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3057,6 +3217,7 @@ def update_session_alert_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3089,6 +3250,7 @@ def update_session_duration_policy(duration:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3122,6 +3284,7 @@ def update_session_invalidation_policy(enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3154,6 +3317,7 @@ def update_session_limit_policy(total:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3187,6 +3351,7 @@ def update_user_limit_policy(total:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3202,9 +3367,9 @@ def update_user_limit_policy(total:) # Get a policy by its unique ID. This endpoint returns the current # configuration for the requested project policy. # - # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. + # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. # - # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail] + # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail] def get_policy(policy_id:) api_path = '/project/policies/{policyId}' .gsub('{policyId}', policy_id) @@ -3218,6 +3383,7 @@ def get_policy(policy_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } response = @client.call( @@ -3296,6 +3462,11 @@ def get_policy(policy_id:) return Models::PolicyDenyFreeEmail.from(map: response) end + if response['$id'] == 'deny-corporate-email' + + return Models::PolicyDenyCorporateEmail.from(map: response) + end + raise Exception, "Unable to match response to any expected response model" end @@ -3326,6 +3497,7 @@ def update_protocol(protocol_id:, enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3341,7 +3513,7 @@ def update_protocol(protocol_id:, enabled:) # Update properties of a specific service. Use this endpoint to enable or # disable a service in your project. # - # @param [ProjectServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor + # @param [ProjectServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 # @param [] enabled Service status. # # @return [Project] @@ -3364,6 +3536,7 @@ def update_service(service_id:, enabled:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3411,6 +3584,7 @@ def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3471,6 +3645,7 @@ def list_email_templates(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3517,6 +3692,7 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3551,6 +3727,7 @@ def get_email_template(template_id:, locale: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3579,6 +3756,7 @@ def list_variables(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3625,6 +3803,7 @@ def create_variable(variable_id:, key:, value:, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3655,6 +3834,7 @@ def get_variable(variable_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3692,6 +3872,7 @@ def update_variable(variable_id:, key: nil, value: nil, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/proxy.rb b/lib/appwrite/services/proxy.rb index 542e83f9..8fa472e8 100644 --- a/lib/appwrite/services/proxy.rb +++ b/lib/appwrite/services/proxy.rb @@ -24,6 +24,7 @@ def list_rules(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -58,6 +59,7 @@ def create_api_rule(domain:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -100,6 +102,7 @@ def create_function_rule(domain:, function_id:, branch: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -159,6 +162,7 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -201,6 +205,7 @@ def create_site_rule(domain:, site_id:, branch: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -231,6 +236,7 @@ def get_rule(rule_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -295,6 +301,7 @@ def update_rule_status(rule_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index 8aa0c195..b077debc 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -26,6 +26,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -113,6 +114,7 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -138,6 +140,7 @@ def list_frameworks() api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -152,16 +155,19 @@ def list_frameworks() # List allowed site specifications for this instance. # + # @param [String] type Specification type to list. Can be one of: runtimes, builds. # # @return [SpecificationList] - def list_specifications() + def list_specifications(type: nil) api_path = '/sites/specifications' api_params = { + type: type, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -192,6 +198,7 @@ def get(site_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -275,6 +282,7 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -343,6 +351,7 @@ def update_site_deployment(site_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -380,6 +389,7 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -427,6 +437,7 @@ def create_deployment(site_id:, code:, install_command: nil, build_command: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', + "accept": 'application/json', } id_param_name = nil @@ -473,6 +484,7 @@ def create_duplicate_deployment(site_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -540,6 +552,7 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -587,6 +600,7 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -623,6 +637,7 @@ def get_deployment(site_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -699,6 +714,7 @@ def get_deployment_download(site_id:, deployment_id:, type: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": '*/*', } @client.call( @@ -739,6 +755,7 @@ def update_deployment_status(site_id:, deployment_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -774,6 +791,7 @@ def list_logs(site_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -810,6 +828,7 @@ def get_log(site_id:, log_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -847,6 +866,7 @@ def delete_log(site_id:, log_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -880,6 +900,7 @@ def list_variables(site_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -932,6 +953,7 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -968,6 +990,7 @@ def get_variable(site_id:, variable_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1011,6 +1034,7 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index 86d95c56..fcc5a98c 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -26,6 +26,7 @@ def list_buckets(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -81,6 +82,7 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -112,6 +114,7 @@ def get_bucket(bucket_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -167,6 +170,7 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -234,6 +238,7 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -296,6 +301,7 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', + "accept": 'application/json', } id_param_name = "fileId" @@ -338,6 +344,7 @@ def get_file(bucket_id:, file_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -380,6 +387,7 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -457,6 +465,7 @@ def get_file_download(bucket_id:, file_id:, token: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": '*/*', } @client.call( @@ -520,6 +529,7 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/*', } @client.call( @@ -559,6 +569,7 @@ def get_file_view(bucket_id:, file_id:, token: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": '*/*', } @client.call( diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 9d035dcd..a60395f6 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -26,6 +26,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -44,9 +45,10 @@ def list(queries: nil, search: nil, total: nil) # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Database name. Max length: 128 chars. # @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. + # @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. # # @return [Database] - def create(database_id:, name:, enabled: nil) + def create(database_id:, name:, enabled: nil, specification: nil) api_path = '/tablesdb' if database_id.nil? @@ -61,11 +63,13 @@ def create(database_id:, name:, enabled: nil) databaseId: database_id, name: name, enabled: enabled, + specification: specification, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -92,6 +96,7 @@ def list_transactions(queries: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -119,6 +124,7 @@ def create_transaction(ttl: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -149,6 +155,7 @@ def get_transaction(transaction_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -184,6 +191,7 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -247,6 +255,7 @@ def create_operations(transaction_id:, operations: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -278,6 +287,7 @@ def get(database_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -313,6 +323,7 @@ def update(database_id:, name: nil, enabled: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -381,6 +392,7 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -437,6 +449,7 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -474,6 +487,7 @@ def get_table(database_id:, table_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -521,6 +535,7 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -598,6 +613,7 @@ def list_columns(database_id:, table_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -657,6 +673,7 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -720,6 +737,7 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -774,6 +792,7 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -832,6 +851,7 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -885,6 +905,7 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -943,6 +964,7 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -997,6 +1019,7 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1056,6 +1079,7 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1116,6 +1140,7 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1181,6 +1206,7 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1240,6 +1266,7 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1303,6 +1330,7 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1362,6 +1390,7 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1425,6 +1454,7 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1479,6 +1509,7 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1538,6 +1569,7 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1589,6 +1621,7 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1643,6 +1676,7 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1699,6 +1733,7 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1758,6 +1793,7 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1814,6 +1850,7 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1873,6 +1910,7 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1924,6 +1962,7 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1978,6 +2017,7 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2029,6 +2069,7 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2083,6 +2124,7 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2142,6 +2184,7 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2207,6 +2250,7 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2271,6 +2315,7 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2327,6 +2372,7 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2386,6 +2432,7 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2440,6 +2487,7 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2499,6 +2547,7 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2561,6 +2610,7 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2622,6 +2672,7 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2664,6 +2715,7 @@ def get_column(database_id:, table_id:, key:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } response = @client.call( @@ -2810,6 +2862,7 @@ def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, ne api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2850,6 +2903,7 @@ def list_indexes(database_id:, table_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -2911,6 +2965,7 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -2953,6 +3008,7 @@ def get_index(database_id:, table_id:, key:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3040,6 +3096,7 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3096,6 +3153,7 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3144,6 +3202,7 @@ def create_rows(database_id:, table_id:, rows:, transaction_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3193,6 +3252,7 @@ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3237,6 +3297,7 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3279,6 +3340,7 @@ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3326,6 +3388,7 @@ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -3378,6 +3441,7 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3428,6 +3492,7 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3527,6 +3592,7 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -3582,6 +3648,7 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index d7215677..c41f7fa4 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -26,6 +26,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -67,6 +68,7 @@ def create(team_id:, name:, roles: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -97,6 +99,7 @@ def get(team_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -134,6 +137,7 @@ def update_name(team_id:, name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -203,6 +207,7 @@ def list_memberships(team_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -270,6 +275,7 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -308,6 +314,7 @@ def get_membership(team_id:, membership_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -354,6 +361,7 @@ def update_membership(team_id:, membership_id:, roles:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -447,6 +455,7 @@ def update_membership_status(team_id:, membership_id:, user_id:, secret:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -479,6 +488,7 @@ def get_prefs(team_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -518,6 +528,7 @@ def update_prefs(team_id:, prefs:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/tokens.rb b/lib/appwrite/services/tokens.rb index 973c892b..81abddf9 100644 --- a/lib/appwrite/services/tokens.rb +++ b/lib/appwrite/services/tokens.rb @@ -36,6 +36,7 @@ def list(bucket_id:, file_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -76,6 +77,7 @@ def create_file_token(bucket_id:, file_id:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -106,6 +108,7 @@ def get(token_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -140,6 +143,7 @@ def update(token_id:, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/usage.rb b/lib/appwrite/services/usage.rb deleted file mode 100644 index 94f86c4d..00000000 --- a/lib/appwrite/services/usage.rb +++ /dev/null @@ -1,88 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - class Usage < Service - - def initialize(client) - @client = client - end - - # Query usage event metrics from the usage database. Returns individual event - # rows with full metadata. Pass Query objects as JSON strings to filter, - # paginate, and order results. Supported query methods: equal, - # greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. - # Supported filter attributes: metric, path, method, status, resource, - # resourceId, country, userAgent, time (these match the underlying column - # names — note that the response surfaces `resource` as `resourceType` and - # `country` as `countryCode`). When no time filter is supplied the endpoint - # defaults to the last 7 days. Default `limit(100)` is applied if none is - # given; user-supplied limits are capped at 500. The `total` field is capped - # at 5000 to keep counts predictable — pass `total=false` to skip the count - # entirely. - # - # @param [Array] queries Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [UsageEventList] - def list_events(queries: nil, total: nil) - api_path = '/usage/events' - - api_params = { - queries: queries, - total: total, - } - - 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::UsageEventList - ) - - end - - # Query usage gauge metrics (point-in-time resource snapshots) from the usage - # database. Returns individual gauge snapshots with metric, value, timestamp, - # resourceType, and resourceId. Pass Query objects as JSON strings to filter, - # paginate, and order results. Supported query methods: equal, - # greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. - # Supported filter attributes: metric, time. Use `orderDesc("time"), - # limit(1)` to fetch the most recent snapshot. When no time filter is - # supplied the endpoint defaults to the last 7 days. Default `limit(100)` is - # applied if none is given; user-supplied limits are capped at 500. The - # `total` field is capped at 5000 to keep counts predictable — pass - # `total=false` to skip the count entirely. - # - # @param [Array] queries Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - # @param [] total When set to false, the total count returned will be 0 and will not be calculated. - # - # @return [UsageGaugeList] - def list_gauges(queries: nil, total: nil) - api_path = '/usage/gauges' - - api_params = { - queries: queries, - total: total, - } - - 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::UsageGaugeList - ) - - end - - end -end diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 0b7437a2..472df7f3 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -10,7 +10,7 @@ def initialize(client) # Get a list of all the project's users. You can use the query params to # filter your results. # - # @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. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator + # @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. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator, accessedAt # @param [String] search Search term to filter your list results. Max length: 256 chars. # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # @@ -26,6 +26,7 @@ def list(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -65,6 +66,7 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -113,6 +115,7 @@ def create_argon2_user(user_id:, email:, password:, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -161,6 +164,7 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -191,6 +195,7 @@ def list_identities(queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -269,6 +274,7 @@ def create_md5_user(user_id:, email:, password:, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -317,6 +323,7 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -395,6 +402,7 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -462,6 +470,7 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -512,6 +521,7 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -542,6 +552,7 @@ def get(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -614,6 +625,7 @@ def update_email(user_id:, email:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -656,6 +668,7 @@ def update_impersonator(user_id:, impersonator:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -693,6 +706,7 @@ def create_jwt(user_id:, session_id: nil, duration: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -735,6 +749,7 @@ def update_labels(user_id:, labels:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -769,6 +784,7 @@ def list_logs(user_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -805,6 +821,7 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -842,6 +859,7 @@ def update_mfa(user_id:, mfa:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -908,6 +926,7 @@ def list_mfa_factors(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -941,6 +960,7 @@ def get_mfa_recovery_codes(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -975,6 +995,7 @@ def update_mfa_recovery_codes(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1009,6 +1030,7 @@ def create_mfa_recovery_codes(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1046,6 +1068,7 @@ def update_name(user_id:, name:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1083,6 +1106,7 @@ def update_password(user_id:, password:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1120,6 +1144,7 @@ def update_phone(user_id:, number:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1150,6 +1175,7 @@ def get_prefs(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1189,6 +1215,7 @@ def update_prefs(user_id:, prefs:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1221,6 +1248,7 @@ def list_sessions(user_id:, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1257,6 +1285,7 @@ def create_session(user_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1361,6 +1390,7 @@ def update_status(user_id:, status:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1395,6 +1425,7 @@ def list_targets(user_id:, queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1448,6 +1479,7 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1484,6 +1516,7 @@ def get_target(user_id:, target_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -1527,6 +1560,7 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1602,6 +1636,7 @@ def create_token(user_id:, length: nil, expire: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1639,6 +1674,7 @@ def update_email_verification(user_id:, email_verification:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -1676,6 +1712,7 @@ def update_phone_verification(user_id:, phone_verification:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( diff --git a/lib/appwrite/services/webhooks.rb b/lib/appwrite/services/webhooks.rb index 99945596..c9886708 100644 --- a/lib/appwrite/services/webhooks.rb +++ b/lib/appwrite/services/webhooks.rb @@ -24,6 +24,7 @@ def list(queries: nil, total: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -84,6 +85,7 @@ def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_usern api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -115,6 +117,7 @@ def get(webhook_id:) api_headers = { "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', } @client.call( @@ -173,6 +176,7 @@ def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_usern api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( @@ -239,6 +243,7 @@ def update_secret(webhook_id:, secret: nil) api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', + "accept": 'application/json', } @client.call( From e70273c60e27bad7b9c1ecc1f6f2721efd7075f2 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 11:04:22 +0530 Subject: [PATCH 02/10] docs: clarify ActivityEvent changelog, country field remains --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 937becfd..37d2172a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * Breaking: Removed `Health` service and all health models and enums * Breaking: Removed `Usage` service and `UsageEvent`/`UsageGauge` models * Breaking: Removed `Messaging` log methods `list_message_logs`, `list_provider_logs`, `list_subscriber_logs`, `list_topic_logs` -* Breaking: Removed OS, client, device, and country fields from `ActivityEvent` model +* Breaking: Removed OS, client, and device fields plus `countryCode`/`countryName` from `ActivityEvent` (`country` remains) * Added: `Client#set_bearer` for OAuth access token authentication * Added: `Organization` `get`, `update`, `delete`, and membership CRUD methods * Added: `Query.vector_dot`, `Query.vector_cosine`, `Query.vector_euclidean` query helpers From 8115496c9cec0b1f3b99e959ad86a23ba5e32dd3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 12:11:16 +0530 Subject: [PATCH 03/10] chore: update Ruby SDK to 26.0.0 --- lib/appwrite/client.rb | 2 +- lib/appwrite/models/billing_plan.rb | 12 ++++++------ lib/appwrite/models/organization.rb | 4 ++-- lib/appwrite/models/project.rb | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index b5922e70..94eb7fb0 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -71,7 +71,7 @@ def set_jwt(value) # # @return [self] def set_bearer(value) - add_header('authorization', value) + add_header('authorization', "Bearer #{value}") @config['bearer'] = value self diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index e00a32f6..ad31ce7f 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -278,10 +278,10 @@ def self.from(map:) deployment_size: map["deploymentSize"], build_size: map["buildSize"], databases_allow_encrypt: map["databasesAllowEncrypt"], - limits: BillingPlanLimits.from(map: map["limits"]), + limits: map["limits"].nil? ? nil : BillingPlanLimits.from(map: map["limits"]), group: map["group"], - program: Program.from(map: map["program"]), - dedicated_databases: BillingPlanDedicatedDatabaseLimits.from(map: map["dedicatedDatabases"]) + program: map["program"].nil? ? nil : Program.from(map: map["program"]), + dedicated_databases: map["dedicatedDatabases"].nil? ? nil : BillingPlanDedicatedDatabaseLimits.from(map: map["dedicatedDatabases"]) ) end @@ -351,10 +351,10 @@ def to_map "deploymentSize": @deployment_size, "buildSize": @build_size, "databasesAllowEncrypt": @databases_allow_encrypt, - "limits": @limits.to_map, + "limits": @limits&.to_map, "group": @group, - "program": @program.to_map, - "dedicatedDatabases": @dedicated_databases.to_map + "program": @program&.to_map, + "dedicatedDatabases": @dedicated_databases&.to_map } end diff --git a/lib/appwrite/models/organization.rb b/lib/appwrite/models/organization.rb index 779b7ff9..2cdbe8e0 100644 --- a/lib/appwrite/models/organization.rb +++ b/lib/appwrite/models/organization.rb @@ -144,7 +144,7 @@ def self.from(map:) program_manager_calendar: map["programManagerCalendar"], program_discord_channel_name: map["programDiscordChannelName"], program_discord_channel_url: map["programDiscordChannelUrl"], - billing_limits: BillingLimits.from(map: map["billingLimits"]), + billing_limits: map["billingLimits"].nil? ? nil : BillingLimits.from(map: map["billingLimits"]), billing_plan_downgrade: map["billingPlanDowngrade"], billing_tax_id: map["billingTaxId"], marked_for_deletion: map["markedForDeletion"], @@ -184,7 +184,7 @@ def to_map "programManagerCalendar": @program_manager_calendar, "programDiscordChannelName": @program_discord_channel_name, "programDiscordChannelUrl": @program_discord_channel_url, - "billingLimits": @billing_limits.to_map, + "billingLimits": @billing_limits&.to_map, "billingPlanDowngrade": @billing_plan_downgrade, "billingTaxId": @billing_tax_id, "markedForDeletion": @marked_for_deletion, diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index d520b652..15d5056a 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -166,7 +166,7 @@ def self.from(map:) protocols: map["protocols"].map { |it| ProjectProtocol.from(map: it) }, blocks: map["blocks"].map { |it| Block.from(map: it) }, console_accessed_at: map["consoleAccessedAt"], - billing_limits: BillingLimits.from(map: map["billingLimits"]), + billing_limits: map["billingLimits"].nil? ? nil : BillingLimits.from(map: map["billingLimits"]), o_auth2_server_enabled: map["oAuth2ServerEnabled"], o_auth2_server_authorization_url: map["oAuth2ServerAuthorizationUrl"], o_auth2_server_scopes: map["oAuth2ServerScopes"], @@ -214,7 +214,7 @@ def to_map "protocols": @protocols.map { |it| it.to_map }, "blocks": @blocks.map { |it| it.to_map }, "consoleAccessedAt": @console_accessed_at, - "billingLimits": @billing_limits.to_map, + "billingLimits": @billing_limits&.to_map, "oAuth2ServerEnabled": @o_auth2_server_enabled, "oAuth2ServerAuthorizationUrl": @o_auth2_server_authorization_url, "oAuth2ServerScopes": @o_auth2_server_scopes, From 75a57025a0512d9bcf53698989f7b12a14c108a9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 23 Jul 2026 16:17:47 +0530 Subject: [PATCH 04/10] chore: update Ruby SDK to 26.1.0 --- CHANGELOG.md | 10 + appwrite.gemspec | 2 +- docs/examples/account/delete-consent-token.md | 17 + docs/examples/account/delete-consent.md | 16 + docs/examples/account/get-consent-token.md | 17 + docs/examples/account/get-consent.md | 16 + docs/examples/account/list-consent-tokens.md | 18 + docs/examples/account/list-consents.md | 17 + .../apps/create-installation-token.md | 17 + docs/examples/apps/create-key.md | 16 + docs/examples/apps/create-secret.md | 16 + docs/examples/apps/create.md | 34 + docs/examples/apps/delete-key.md | 17 + docs/examples/apps/delete-secret.md | 17 + docs/examples/apps/delete-tokens.md | 16 + docs/examples/apps/delete.md | 16 + docs/examples/apps/get-installation.md | 17 + docs/examples/apps/get-key.md | 17 + docs/examples/apps/get-secret.md | 17 + docs/examples/apps/get.md | 16 + .../examples/apps/list-installation-scopes.md | 14 + docs/examples/apps/list-installations.md | 18 + docs/examples/apps/list-keys.md | 18 + docs/examples/apps/list-o-auth-2-scopes.md | 14 + docs/examples/apps/list-secrets.md | 18 + docs/examples/apps/list.md | 17 + docs/examples/apps/update-labels.md | 17 + docs/examples/apps/update-team.md | 17 + docs/examples/apps/update.md | 35 + docs/examples/backups/create-restoration.md | 3 +- docs/examples/oauth2/approve.md | 18 + docs/examples/oauth2/authorize-post.md | 29 + docs/examples/oauth2/authorize.md | 29 + .../oauth2/create-device-authorization.md | 20 + docs/examples/oauth2/create-grant.md | 16 + docs/examples/oauth2/create-par.md | 28 + docs/examples/oauth2/create-token.md | 25 + docs/examples/oauth2/get-grant.md | 16 + docs/examples/oauth2/list-organizations.md | 18 + docs/examples/oauth2/list-projects.md | 18 + docs/examples/oauth2/reject.md | 16 + docs/examples/oauth2/revoke.md | 19 + .../organization/create-installation.md | 17 + .../organization/delete-installation.md | 16 + .../examples/organization/get-installation.md | 16 + .../organization/list-installations.md | 17 + .../organization/update-installation.md | 17 + .../project/update-o-auth-2-server.md | 1 + .../examples/sites/get-deployment-download.md | 3 +- docs/examples/tablesdb/create-failover.md | 17 + docs/examples/tablesdb/create.md | 3 +- docs/examples/tablesdb/get-replicas.md | 16 + docs/examples/tablesdb/get-status.md | 16 + docs/examples/tablesdb/list-specifications.md | 14 + docs/examples/tablesdb/update.md | 3 +- docs/examples/teams/create-installation.md | 18 + docs/examples/teams/delete-installation.md | 17 + docs/examples/teams/get-installation.md | 17 + docs/examples/teams/list-installations.md | 18 + docs/examples/teams/update-installation.md | 18 + lib/appwrite.rb | 38 + lib/appwrite/client.rb | 2 +- lib/appwrite/enums/database_status.rb | 11 + lib/appwrite/enums/database_type.rb | 3 + lib/appwrite/enums/organization_key_scopes.rb | 2 + lib/appwrite/enums/project_key_scopes.rb | 3 + lib/appwrite/models/activity_event.rb | 61 +- lib/appwrite/models/app.rb | 152 ++++ lib/appwrite/models/app_installation.rb | 72 ++ lib/appwrite/models/app_installation_list.rb | 32 + lib/appwrite/models/app_key.rb | 67 ++ lib/appwrite/models/app_key_list.rb | 32 + lib/appwrite/models/app_scope.rb | 47 + lib/appwrite/models/app_scope_list.rb | 32 + lib/appwrite/models/app_secret.rb | 67 ++ lib/appwrite/models/app_secret_list.rb | 32 + lib/appwrite/models/app_secret_plaintext.rb | 67 ++ lib/appwrite/models/apps_list.rb | 32 + lib/appwrite/models/billing_plan.rb | 5 + lib/appwrite/models/database.rb | 41 +- lib/appwrite/models/database_status.rb | 62 ++ .../models/database_status_connections.rb | 32 + .../models/database_status_replica.rb | 42 + lib/appwrite/models/database_status_volume.rb | 42 + lib/appwrite/models/dedicated_database.rb | 267 ++++++ .../models/dedicated_database_member.rb | 42 + .../models/dedicated_database_replicas.rb | 37 + .../dedicated_database_specification.rb | 67 ++ .../dedicated_database_specification_list.rb | 37 + ...edicated_database_specification_pricing.rb | 47 + lib/appwrite/models/oauth2_approve.rb | 27 + lib/appwrite/models/oauth2_authorize.rb | 32 + lib/appwrite/models/oauth2_consent.rb | 72 ++ lib/appwrite/models/oauth2_consent_list.rb | 32 + lib/appwrite/models/oauth2_consent_token.rb | 77 ++ .../models/oauth2_consent_token_list.rb | 32 + .../models/oauth2_device_authorization.rb | 52 ++ lib/appwrite/models/oauth2_grant.rb | 82 ++ lib/appwrite/models/oauth2_organization.rb | 27 + .../models/oauth2_organization_list.rb | 32 + lib/appwrite/models/oauth2_par.rb | 32 + lib/appwrite/models/oauth2_project.rb | 37 + lib/appwrite/models/oauth2_project_list.rb | 32 + lib/appwrite/models/oauth2_reject.rb | 27 + lib/appwrite/models/oauth2_token.rb | 57 ++ lib/appwrite/models/project.rb | 10 + lib/appwrite/services/account.rb | 209 +++++ lib/appwrite/services/apps.rb | 813 ++++++++++++++++++ lib/appwrite/services/backups.rb | 37 +- lib/appwrite/services/oauth2.rb | 525 +++++++++++ lib/appwrite/services/organization.rb | 168 ++++ lib/appwrite/services/project.rb | 4 +- lib/appwrite/services/sites.rb | 4 +- lib/appwrite/services/tables_db.rb | 136 ++- lib/appwrite/services/teams.rb | 198 +++++ 115 files changed, 5191 insertions(+), 32 deletions(-) create mode 100644 docs/examples/account/delete-consent-token.md create mode 100644 docs/examples/account/delete-consent.md create mode 100644 docs/examples/account/get-consent-token.md create mode 100644 docs/examples/account/get-consent.md create mode 100644 docs/examples/account/list-consent-tokens.md create mode 100644 docs/examples/account/list-consents.md create mode 100644 docs/examples/apps/create-installation-token.md create mode 100644 docs/examples/apps/create-key.md create mode 100644 docs/examples/apps/create-secret.md create mode 100644 docs/examples/apps/create.md create mode 100644 docs/examples/apps/delete-key.md create mode 100644 docs/examples/apps/delete-secret.md create mode 100644 docs/examples/apps/delete-tokens.md create mode 100644 docs/examples/apps/delete.md create mode 100644 docs/examples/apps/get-installation.md create mode 100644 docs/examples/apps/get-key.md create mode 100644 docs/examples/apps/get-secret.md create mode 100644 docs/examples/apps/get.md create mode 100644 docs/examples/apps/list-installation-scopes.md create mode 100644 docs/examples/apps/list-installations.md create mode 100644 docs/examples/apps/list-keys.md create mode 100644 docs/examples/apps/list-o-auth-2-scopes.md create mode 100644 docs/examples/apps/list-secrets.md create mode 100644 docs/examples/apps/list.md create mode 100644 docs/examples/apps/update-labels.md create mode 100644 docs/examples/apps/update-team.md create mode 100644 docs/examples/apps/update.md create mode 100644 docs/examples/oauth2/approve.md create mode 100644 docs/examples/oauth2/authorize-post.md create mode 100644 docs/examples/oauth2/authorize.md create mode 100644 docs/examples/oauth2/create-device-authorization.md create mode 100644 docs/examples/oauth2/create-grant.md create mode 100644 docs/examples/oauth2/create-par.md create mode 100644 docs/examples/oauth2/create-token.md create mode 100644 docs/examples/oauth2/get-grant.md create mode 100644 docs/examples/oauth2/list-organizations.md create mode 100644 docs/examples/oauth2/list-projects.md create mode 100644 docs/examples/oauth2/reject.md create mode 100644 docs/examples/oauth2/revoke.md create mode 100644 docs/examples/organization/create-installation.md create mode 100644 docs/examples/organization/delete-installation.md create mode 100644 docs/examples/organization/get-installation.md create mode 100644 docs/examples/organization/list-installations.md create mode 100644 docs/examples/organization/update-installation.md create mode 100644 docs/examples/tablesdb/create-failover.md create mode 100644 docs/examples/tablesdb/get-replicas.md create mode 100644 docs/examples/tablesdb/get-status.md create mode 100644 docs/examples/tablesdb/list-specifications.md create mode 100644 docs/examples/teams/create-installation.md create mode 100644 docs/examples/teams/delete-installation.md create mode 100644 docs/examples/teams/get-installation.md create mode 100644 docs/examples/teams/list-installations.md create mode 100644 docs/examples/teams/update-installation.md create mode 100644 lib/appwrite/models/app.rb create mode 100644 lib/appwrite/models/app_installation.rb create mode 100644 lib/appwrite/models/app_installation_list.rb create mode 100644 lib/appwrite/models/app_key.rb create mode 100644 lib/appwrite/models/app_key_list.rb create mode 100644 lib/appwrite/models/app_scope.rb create mode 100644 lib/appwrite/models/app_scope_list.rb create mode 100644 lib/appwrite/models/app_secret.rb create mode 100644 lib/appwrite/models/app_secret_list.rb create mode 100644 lib/appwrite/models/app_secret_plaintext.rb create mode 100644 lib/appwrite/models/apps_list.rb create mode 100644 lib/appwrite/models/database_status.rb create mode 100644 lib/appwrite/models/database_status_connections.rb create mode 100644 lib/appwrite/models/database_status_replica.rb create mode 100644 lib/appwrite/models/database_status_volume.rb create mode 100644 lib/appwrite/models/dedicated_database.rb create mode 100644 lib/appwrite/models/dedicated_database_member.rb create mode 100644 lib/appwrite/models/dedicated_database_replicas.rb create mode 100644 lib/appwrite/models/dedicated_database_specification.rb create mode 100644 lib/appwrite/models/dedicated_database_specification_list.rb create mode 100644 lib/appwrite/models/dedicated_database_specification_pricing.rb create mode 100644 lib/appwrite/models/oauth2_approve.rb create mode 100644 lib/appwrite/models/oauth2_authorize.rb create mode 100644 lib/appwrite/models/oauth2_consent.rb create mode 100644 lib/appwrite/models/oauth2_consent_list.rb create mode 100644 lib/appwrite/models/oauth2_consent_token.rb create mode 100644 lib/appwrite/models/oauth2_consent_token_list.rb create mode 100644 lib/appwrite/models/oauth2_device_authorization.rb create mode 100644 lib/appwrite/models/oauth2_grant.rb create mode 100644 lib/appwrite/models/oauth2_organization.rb create mode 100644 lib/appwrite/models/oauth2_organization_list.rb create mode 100644 lib/appwrite/models/oauth2_par.rb create mode 100644 lib/appwrite/models/oauth2_project.rb create mode 100644 lib/appwrite/models/oauth2_project_list.rb create mode 100644 lib/appwrite/models/oauth2_reject.rb create mode 100644 lib/appwrite/models/oauth2_token.rb create mode 100644 lib/appwrite/services/apps.rb create mode 100644 lib/appwrite/services/oauth2.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 37d2172a..bdf22ea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 26.1.0 + +* Added: `Apps` service for managing OAuth2 applications, keys, and installations +* Added: `OAuth2` service with authorize, grant, device authorization, and consent flows +* Added: account OAuth2 consent methods `list_consents`, `get_consent`, `delete_consent`, and consent token methods +* Added: app installation management methods to `Organization` and `Teams` services +* Added: `installation_access_token_duration` parameter to `project.update_o_auth2_server` +* Added: `token` parameter to `sites.get_deployment_download` +* Added: `oauth2.introspect` and organization installation key scopes + ## 26.0.0 * Breaking: Removed `Health` service and all health models and enums diff --git a/appwrite.gemspec b/appwrite.gemspec index 1233f9c1..bc428bcb 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '26.0.0' + spec.version = '26.1.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/account/delete-consent-token.md b/docs/examples/account/delete-consent-token.md new file mode 100644 index 00000000..3e3c11e5 --- /dev/null +++ b/docs/examples/account/delete-consent-token.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_consent_token( + consent_id: '', + token_id: '' +) +``` diff --git a/docs/examples/account/delete-consent.md b/docs/examples/account/delete-consent.md new file mode 100644 index 00000000..b673c204 --- /dev/null +++ b/docs/examples/account/delete-consent.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_consent( + consent_id: '' +) +``` diff --git a/docs/examples/account/get-consent-token.md b/docs/examples/account/get-consent-token.md new file mode 100644 index 00000000..d65e22dd --- /dev/null +++ b/docs/examples/account/get-consent-token.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get_consent_token( + consent_id: '', + token_id: '' +) +``` diff --git a/docs/examples/account/get-consent.md b/docs/examples/account/get-consent.md new file mode 100644 index 00000000..8fe59764 --- /dev/null +++ b/docs/examples/account/get-consent.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get_consent( + consent_id: '' +) +``` diff --git a/docs/examples/account/list-consent-tokens.md b/docs/examples/account/list-consent-tokens.md new file mode 100644 index 00000000..1d7f6049 --- /dev/null +++ b/docs/examples/account/list-consent-tokens.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_consent_tokens( + consent_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/account/list-consents.md b/docs/examples/account/list-consents.md new file mode 100644 index 00000000..968c1e55 --- /dev/null +++ b/docs/examples/account/list-consents.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_consents( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md new file mode 100644 index 00000000..7c71cecc --- /dev/null +++ b/docs/examples/apps/create-installation-token.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +apps = Apps.new(client) + +result = apps.create_installation_token( + app_id: '', + installation_id: '' +) +``` diff --git a/docs/examples/apps/create-key.md b/docs/examples/apps/create-key.md new file mode 100644 index 00000000..31243477 --- /dev/null +++ b/docs/examples/apps/create-key.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.create_key( + app_id: '' +) +``` diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md new file mode 100644 index 00000000..7b26ea6a --- /dev/null +++ b/docs/examples/apps/create-secret.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.create_secret( + app_id: '' +) +``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md new file mode 100644 index 00000000..94da7f01 --- /dev/null +++ b/docs/examples/apps/create.md @@ -0,0 +1,34 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.create( + app_id: '', + name: '', + redirect_uris: [], + description: '', # optional + client_uri: 'https://example.com', # optional + logo_uri: 'https://example.com', # optional + privacy_policy_url: 'https://example.com', # optional + terms_url: 'https://example.com', # optional + contacts: [], # optional + tagline: '', # optional + tags: [], # optional + images: [], # optional + support_url: 'https://example.com', # optional + data_deletion_url: 'https://example.com', # optional + post_logout_redirect_uris: [], # optional + enabled: false, # optional + type: 'public', # optional + device_flow: false, # optional + team_id: '' # optional +) +``` diff --git a/docs/examples/apps/delete-key.md b/docs/examples/apps/delete-key.md new file mode 100644 index 00000000..70ea81fa --- /dev/null +++ b/docs/examples/apps/delete-key.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.delete_key( + app_id: '', + key_id: '' +) +``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md new file mode 100644 index 00000000..a0335204 --- /dev/null +++ b/docs/examples/apps/delete-secret.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.delete_secret( + app_id: '', + secret_id: '' +) +``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md new file mode 100644 index 00000000..e15cf22b --- /dev/null +++ b/docs/examples/apps/delete-tokens.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.delete_tokens( + app_id: '' +) +``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md new file mode 100644 index 00000000..614c5027 --- /dev/null +++ b/docs/examples/apps/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.delete( + app_id: '' +) +``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md new file mode 100644 index 00000000..5db2961b --- /dev/null +++ b/docs/examples/apps/get-installation.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +apps = Apps.new(client) + +result = apps.get_installation( + app_id: '', + installation_id: '' +) +``` diff --git a/docs/examples/apps/get-key.md b/docs/examples/apps/get-key.md new file mode 100644 index 00000000..b6b1c2af --- /dev/null +++ b/docs/examples/apps/get-key.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.get_key( + app_id: '', + key_id: '' +) +``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md new file mode 100644 index 00000000..57adff38 --- /dev/null +++ b/docs/examples/apps/get-secret.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.get_secret( + app_id: '', + secret_id: '' +) +``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md new file mode 100644 index 00000000..9f06a501 --- /dev/null +++ b/docs/examples/apps/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.get( + app_id: '' +) +``` diff --git a/docs/examples/apps/list-installation-scopes.md b/docs/examples/apps/list-installation-scopes.md new file mode 100644 index 00000000..eef52129 --- /dev/null +++ b/docs/examples/apps/list-installation-scopes.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.list_installation_scopes() +``` diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md new file mode 100644 index 00000000..da01dc8e --- /dev/null +++ b/docs/examples/apps/list-installations.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +apps = Apps.new(client) + +result = apps.list_installations( + app_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/apps/list-keys.md b/docs/examples/apps/list-keys.md new file mode 100644 index 00000000..9a7e19ec --- /dev/null +++ b/docs/examples/apps/list-keys.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.list_keys( + app_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/apps/list-o-auth-2-scopes.md b/docs/examples/apps/list-o-auth-2-scopes.md new file mode 100644 index 00000000..92cbb804 --- /dev/null +++ b/docs/examples/apps/list-o-auth-2-scopes.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.list_o_auth2_scopes() +``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md new file mode 100644 index 00000000..f7728903 --- /dev/null +++ b/docs/examples/apps/list-secrets.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.list_secrets( + app_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md new file mode 100644 index 00000000..75ab272e --- /dev/null +++ b/docs/examples/apps/list.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.list( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/apps/update-labels.md b/docs/examples/apps/update-labels.md new file mode 100644 index 00000000..1705f8bf --- /dev/null +++ b/docs/examples/apps/update-labels.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +apps = Apps.new(client) + +result = apps.update_labels( + app_id: '', + labels: [] +) +``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md new file mode 100644 index 00000000..a47a58e5 --- /dev/null +++ b/docs/examples/apps/update-team.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.update_team( + app_id: '', + team_id: '' +) +``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md new file mode 100644 index 00000000..f8fd0a32 --- /dev/null +++ b/docs/examples/apps/update.md @@ -0,0 +1,35 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +apps = Apps.new(client) + +result = apps.update( + app_id: '', + name: '', + description: '', # optional + client_uri: 'https://example.com', # optional + logo_uri: 'https://example.com', # optional + privacy_policy_url: 'https://example.com', # optional + terms_url: 'https://example.com', # optional + contacts: [], # optional + tagline: '', # optional + tags: [], # optional + images: [], # optional + support_url: 'https://example.com', # optional + data_deletion_url: 'https://example.com', # optional + enabled: false, # optional + redirect_uris: [], # optional + post_logout_redirect_uris: [], # optional + type: 'public', # optional + device_flow: false, # optional + installation_scopes: [], # optional + installation_redirect_url: 'https://example.com' # optional +) +``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 831c2aa1..f6509087 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -15,7 +15,6 @@ result = backups.create_restoration( archive_id: '', services: [BackupServices::DATABASES], new_resource_id: '', # optional - new_resource_name: '', # optional - new_specification: 'serverless' # optional + new_resource_name: '' # optional ) ``` diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md new file mode 100644 index 00000000..6576dbec --- /dev/null +++ b/docs/examples/oauth2/approve.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.approve( + grant_id: '', + authorization_details: '', # optional + scope: '' # optional +) +``` diff --git a/docs/examples/oauth2/authorize-post.md b/docs/examples/oauth2/authorize-post.md new file mode 100644 index 00000000..75f092a2 --- /dev/null +++ b/docs/examples/oauth2/authorize-post.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.authorize_post( + client_id: '', # optional + redirect_uri: 'https://example.com', # optional + response_type: '', # optional + scope: '', # optional + state: '', # optional + nonce: '', # optional + code_challenge: '', # optional + code_challenge_method: 's256', # optional + prompt: '', # optional + max_age: 0, # optional + authorization_details: '', # optional + resource: '', # optional + audience: '', # optional + request_uri: '' # optional +) +``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md new file mode 100644 index 00000000..d7d5befc --- /dev/null +++ b/docs/examples/oauth2/authorize.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.authorize( + client_id: '', # optional + redirect_uri: 'https://example.com', # optional + response_type: '', # optional + scope: '', # optional + state: '', # optional + nonce: '', # optional + code_challenge: '', # optional + code_challenge_method: 's256', # optional + prompt: '', # optional + max_age: 0, # optional + authorization_details: '', # optional + resource: '', # optional + audience: '', # optional + request_uri: '' # optional +) +``` diff --git a/docs/examples/oauth2/create-device-authorization.md b/docs/examples/oauth2/create-device-authorization.md new file mode 100644 index 00000000..102671db --- /dev/null +++ b/docs/examples/oauth2/create-device-authorization.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.create_device_authorization( + client_id: '', # optional + scope: '', # optional + authorization_details: '', # optional + resource: '', # optional + audience: '' # optional +) +``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md new file mode 100644 index 00000000..9184cbf7 --- /dev/null +++ b/docs/examples/oauth2/create-grant.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.create_grant( + user_code: '' +) +``` diff --git a/docs/examples/oauth2/create-par.md b/docs/examples/oauth2/create-par.md new file mode 100644 index 00000000..192e5ff1 --- /dev/null +++ b/docs/examples/oauth2/create-par.md @@ -0,0 +1,28 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.create_par( + client_id: '', + redirect_uri: 'https://example.com', + response_type: 'code', + scope: '', # optional + state: '', # optional + nonce: '', # optional + code_challenge: '', # optional + code_challenge_method: 's256', # optional + prompt: '', # optional + max_age: 0, # optional + authorization_details: '', # optional + resource: '', # optional + audience: '' # optional +) +``` diff --git a/docs/examples/oauth2/create-token.md b/docs/examples/oauth2/create-token.md new file mode 100644 index 00000000..6e0cabc1 --- /dev/null +++ b/docs/examples/oauth2/create-token.md @@ -0,0 +1,25 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.create_token( + grant_type: '', + code: '', # optional + refresh_token: '', # optional + device_code: '', # optional + client_id: '', # optional + client_secret: '', # optional + code_verifier: '', # optional + redirect_uri: 'https://example.com', # optional + resource: '', # optional + audience: '' # optional +) +``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md new file mode 100644 index 00000000..e6b80763 --- /dev/null +++ b/docs/examples/oauth2/get-grant.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.get_grant( + grant_id: '' +) +``` diff --git a/docs/examples/oauth2/list-organizations.md b/docs/examples/oauth2/list-organizations.md new file mode 100644 index 00000000..28b026e4 --- /dev/null +++ b/docs/examples/oauth2/list-organizations.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.list_organizations( + limit: 1, # optional + offset: 0, # optional + search: '' # optional +) +``` diff --git a/docs/examples/oauth2/list-projects.md b/docs/examples/oauth2/list-projects.md new file mode 100644 index 00000000..3f8c64f2 --- /dev/null +++ b/docs/examples/oauth2/list-projects.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.list_projects( + limit: 1, # optional + offset: 0, # optional + search: '' # optional +) +``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md new file mode 100644 index 00000000..bf00d990 --- /dev/null +++ b/docs/examples/oauth2/reject.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.reject( + grant_id: '' +) +``` diff --git a/docs/examples/oauth2/revoke.md b/docs/examples/oauth2/revoke.md new file mode 100644 index 00000000..6b709451 --- /dev/null +++ b/docs/examples/oauth2/revoke.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_project('') # Your project ID + +oauth2 = Oauth2.new(client) + +result = oauth2.revoke( + token: '', + token_type_hint: 'access_token', # optional + client_id: '', # optional + client_secret: '' # optional +) +``` diff --git a/docs/examples/organization/create-installation.md b/docs/examples/organization/create-installation.md new file mode 100644 index 00000000..a36a41e0 --- /dev/null +++ b/docs/examples/organization/create-installation.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +organization = Organization.new(client) + +result = organization.create_installation( + app_id: '', + authorization_details: '' # optional +) +``` diff --git a/docs/examples/organization/delete-installation.md b/docs/examples/organization/delete-installation.md new file mode 100644 index 00000000..c906fc18 --- /dev/null +++ b/docs/examples/organization/delete-installation.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +organization = Organization.new(client) + +result = organization.delete_installation( + installation_id: '' +) +``` diff --git a/docs/examples/organization/get-installation.md b/docs/examples/organization/get-installation.md new file mode 100644 index 00000000..32c08766 --- /dev/null +++ b/docs/examples/organization/get-installation.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +organization = Organization.new(client) + +result = organization.get_installation( + installation_id: '' +) +``` diff --git a/docs/examples/organization/list-installations.md b/docs/examples/organization/list-installations.md new file mode 100644 index 00000000..92214d26 --- /dev/null +++ b/docs/examples/organization/list-installations.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +organization = Organization.new(client) + +result = organization.list_installations( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/organization/update-installation.md b/docs/examples/organization/update-installation.md new file mode 100644 index 00000000..db7c932e --- /dev/null +++ b/docs/examples/organization/update-installation.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +organization = Organization.new(client) + +result = organization.update_installation( + installation_id: '', + authorization_details: '' # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index b3ab3399..92a56d27 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -19,6 +19,7 @@ result = project.update_o_auth2_server( refresh_token_duration: 60, # optional public_access_token_duration: 60, # optional public_refresh_token_duration: 60, # optional + installation_access_token_duration: 60, # optional confidential_pkce: false, # optional verification_url: 'https://example.com', # optional user_code_length: 6, # optional diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 0fe19a3c..55206b43 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -14,6 +14,7 @@ sites = Sites.new(client) result = sites.get_deployment_download( site_id: '', deployment_id: '', - type: DeploymentDownloadType::SOURCE # optional + type: DeploymentDownloadType::SOURCE, # optional + token: '' # optional ) ``` diff --git a/docs/examples/tablesdb/create-failover.md b/docs/examples/tablesdb/create-failover.md new file mode 100644 index 00000000..4935f32d --- /dev/null +++ b/docs/examples/tablesdb/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 10ab1a45..433b5b72 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -14,6 +14,7 @@ result = tables_db.create( database_id: '', name: '', enabled: false, # optional - specification: 'serverless' # optional + specification: 'serverless', # optional + replicas: 0 # optional ) ``` diff --git a/docs/examples/tablesdb/get-replicas.md b/docs/examples/tablesdb/get-replicas.md new file mode 100644 index 00000000..a8fb122c --- /dev/null +++ b/docs/examples/tablesdb/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/tablesdb/get-status.md b/docs/examples/tablesdb/get-status.md new file mode 100644 index 00000000..c0b68e56 --- /dev/null +++ b/docs/examples/tablesdb/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_status( + database_id: '' +) +``` diff --git a/docs/examples/tablesdb/list-specifications.md b/docs/examples/tablesdb/list-specifications.md new file mode 100644 index 00000000..8aa6987b --- /dev/null +++ b/docs/examples/tablesdb/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_specifications() +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 28377a61..4257090a 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -13,6 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.update( database_id: '', name: '', # optional - enabled: false # optional + enabled: false, # optional + replicas: 0 # optional ) ``` diff --git a/docs/examples/teams/create-installation.md b/docs/examples/teams/create-installation.md new file mode 100644 index 00000000..326c84cc --- /dev/null +++ b/docs/examples/teams/create-installation.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.create_installation( + team_id: '', + app_id: '', + authorization_details: '' # optional +) +``` diff --git a/docs/examples/teams/delete-installation.md b/docs/examples/teams/delete-installation.md new file mode 100644 index 00000000..420b289d --- /dev/null +++ b/docs/examples/teams/delete-installation.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.delete_installation( + team_id: '', + installation_id: '' +) +``` diff --git a/docs/examples/teams/get-installation.md b/docs/examples/teams/get-installation.md new file mode 100644 index 00000000..f1200564 --- /dev/null +++ b/docs/examples/teams/get-installation.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.get_installation( + team_id: '', + installation_id: '' +) +``` diff --git a/docs/examples/teams/list-installations.md b/docs/examples/teams/list-installations.md new file mode 100644 index 00000000..cfd7ea61 --- /dev/null +++ b/docs/examples/teams/list-installations.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.list_installations( + team_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/teams/update-installation.md b/docs/examples/teams/update-installation.md new file mode 100644 index 00000000..66609320 --- /dev/null +++ b/docs/examples/teams/update-installation.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.update_installation( + team_id: '', + installation_id: '', + authorization_details: '' # optional +) +``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 2b14b4a3..03d3826f 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -234,6 +234,10 @@ require_relative 'appwrite/models/billing_plan_dedicated_database_limits' require_relative 'appwrite/models/billing_plan_supported_addons' require_relative 'appwrite/models/block' +require_relative 'appwrite/models/dedicated_database' +require_relative 'appwrite/models/database_status' +require_relative 'appwrite/models/dedicated_database_member' +require_relative 'appwrite/models/dedicated_database_replicas' require_relative 'appwrite/models/organization' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/policy_deny_aliased_email' @@ -242,11 +246,43 @@ require_relative 'appwrite/models/policy_deny_corporate_email' require_relative 'appwrite/models/program' require_relative 'appwrite/models/backup_restoration' +require_relative 'appwrite/models/dedicated_database_specification' +require_relative 'appwrite/models/dedicated_database_specification_list' +require_relative 'appwrite/models/dedicated_database_specification_pricing' +require_relative 'appwrite/models/database_status_connections' +require_relative 'appwrite/models/database_status_replica' +require_relative 'appwrite/models/database_status_volume' require_relative 'appwrite/models/usage_billing_plan' +require_relative 'appwrite/models/app' +require_relative 'appwrite/models/app_secret' +require_relative 'appwrite/models/app_secret_plaintext' +require_relative 'appwrite/models/app_scope' +require_relative 'appwrite/models/app_installation' +require_relative 'appwrite/models/app_key' +require_relative 'appwrite/models/oauth2_authorize' +require_relative 'appwrite/models/oauth2_approve' +require_relative 'appwrite/models/oauth2_reject' +require_relative 'appwrite/models/oauth2_grant' +require_relative 'appwrite/models/oauth2_device_authorization' +require_relative 'appwrite/models/oauth2_par' +require_relative 'appwrite/models/oauth2_token' +require_relative 'appwrite/models/oauth2_consent' +require_relative 'appwrite/models/oauth2_consent_token' +require_relative 'appwrite/models/oauth2_project' +require_relative 'appwrite/models/oauth2_organization' +require_relative 'appwrite/models/oauth2_project_list' +require_relative 'appwrite/models/oauth2_organization_list' +require_relative 'appwrite/models/oauth2_consent_list' +require_relative 'appwrite/models/oauth2_consent_token_list' require_relative 'appwrite/models/activity_event_list' require_relative 'appwrite/models/backup_archive_list' require_relative 'appwrite/models/backup_policy_list' require_relative 'appwrite/models/backup_restoration_list' +require_relative 'appwrite/models/apps_list' +require_relative 'appwrite/models/app_secret_list' +require_relative 'appwrite/models/app_scope_list' +require_relative 'appwrite/models/app_installation_list' +require_relative 'appwrite/models/app_key_list' require_relative 'appwrite/enums/authenticator_type' require_relative 'appwrite/enums/authentication_factor' @@ -311,6 +347,7 @@ require_relative 'appwrite/services/account' require_relative 'appwrite/services/activities' +require_relative 'appwrite/services/apps' require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' @@ -318,6 +355,7 @@ require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/messaging' +require_relative 'appwrite/services/oauth2' require_relative 'appwrite/services/organization' require_relative 'appwrite/services/presences' require_relative 'appwrite/services/project' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 94eb7fb0..aeae118a 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '26.0.0', + 'x-sdk-version'=> '26.1.0', 'X-Appwrite-Response-Format' => '1.9.5' } @endpoint = 'https://cloud.appwrite.io/v1' diff --git a/lib/appwrite/enums/database_status.rb b/lib/appwrite/enums/database_status.rb index e0e488b2..a35fbbc6 100644 --- a/lib/appwrite/enums/database_status.rb +++ b/lib/appwrite/enums/database_status.rb @@ -3,7 +3,18 @@ module Enums module DatabaseStatus PROVISIONING = 'provisioning' READY = 'ready' + INACTIVE = 'inactive' + PAUSED = 'paused' FAILED = 'failed' + DELETING = 'deleting' + DELETED = 'deleted' + RESTORING = 'restoring' + SCALING = 'scaling' + UPGRADING = 'upgrading' + MIGRATING = 'migrating' + PAUSING = 'pausing' + RESUMING = 'resuming' + FAILING_OVER = 'failing-over' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/database_type.rb b/lib/appwrite/enums/database_type.rb index 1fd3996c..1803082a 100644 --- a/lib/appwrite/enums/database_type.rb +++ b/lib/appwrite/enums/database_type.rb @@ -5,6 +5,9 @@ module DatabaseType TABLESDB = 'tablesdb' DOCUMENTSDB = 'documentsdb' VECTORSDB = 'vectorsdb' + MYSQL = 'mysql' + POSTGRESQL = 'postgresql' + MONGODB = 'mongodb' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/organization_key_scopes.rb b/lib/appwrite/enums/organization_key_scopes.rb index 0263ef82..92b7da23 100644 --- a/lib/appwrite/enums/organization_key_scopes.rb +++ b/lib/appwrite/enums/organization_key_scopes.rb @@ -7,6 +7,8 @@ module OrganizationKeyScopes DEVKEYS_WRITE = 'devKeys.write' ORGANIZATION_KEYS_READ = 'organization.keys.read' ORGANIZATION_KEYS_WRITE = 'organization.keys.write' + ORGANIZATION_INSTALLATIONS_READ = 'organization.installations.read' + ORGANIZATION_INSTALLATIONS_WRITE = 'organization.installations.write' ORGANIZATION_MEMBERSHIPS_READ = 'organization.memberships.read' ORGANIZATION_MEMBERSHIPS_WRITE = 'organization.memberships.write' ORGANIZATION_READ = 'organization.read' diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index ba1b7ee1..a7ed8076 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -96,11 +96,14 @@ module ProjectKeyScopes DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute' DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' + WAFRULES_READ = 'wafRules.read' + WAFRULES_WRITE = 'wafRules.write' EVENTS_READ = 'events.read' APPS_READ = 'apps.read' APPS_WRITE = 'apps.write' OAUTH2_READ = 'oauth2.read' OAUTH2_WRITE = 'oauth2.write' + OAUTH2_INTROSPECT = 'oauth2.introspect' USAGE_READ = 'usage.read' end end diff --git a/lib/appwrite/models/activity_event.rb b/lib/appwrite/models/activity_event.rb index 0a746eef..3a000a25 100644 --- a/lib/appwrite/models/activity_event.rb +++ b/lib/appwrite/models/activity_event.rb @@ -17,10 +17,21 @@ class ActivityEvent attr_reader :ip attr_reader :mode attr_reader :country + attr_reader :continent_code + attr_reader :city + attr_reader :subdivisions + attr_reader :isp + attr_reader :autonomous_system_number + attr_reader :autonomous_system_organization + attr_reader :connection_type + attr_reader :connection_usage_type + attr_reader :connection_organization attr_reader :time attr_reader :project_id attr_reader :team_id attr_reader :hostname + attr_reader :sdk + attr_reader :sdk_version def initialize( id:, @@ -37,10 +48,21 @@ def initialize( ip:, mode:, country:, + continent_code:, + city:, + subdivisions:, + isp:, + autonomous_system_number:, + autonomous_system_organization:, + connection_type:, + connection_usage_type:, + connection_organization:, time:, project_id:, team_id:, - hostname: + hostname:, + sdk:, + sdk_version: ) @id = id @actor_type = actor_type @@ -56,10 +78,21 @@ def initialize( @ip = ip @mode = mode @country = country + @continent_code = continent_code + @city = city + @subdivisions = subdivisions + @isp = isp + @autonomous_system_number = autonomous_system_number + @autonomous_system_organization = autonomous_system_organization + @connection_type = connection_type + @connection_usage_type = connection_usage_type + @connection_organization = connection_organization @time = time @project_id = project_id @team_id = team_id @hostname = hostname + @sdk = sdk + @sdk_version = sdk_version end def self.from(map:) @@ -78,10 +111,21 @@ def self.from(map:) ip: map["ip"], mode: map["mode"], country: map["country"], + continent_code: map["continentCode"], + city: map["city"], + subdivisions: map["subdivisions"], + isp: map["isp"], + autonomous_system_number: map["autonomousSystemNumber"], + autonomous_system_organization: map["autonomousSystemOrganization"], + connection_type: map["connectionType"], + connection_usage_type: map["connectionUsageType"], + connection_organization: map["connectionOrganization"], time: map["time"], project_id: map["projectId"], team_id: map["teamId"], - hostname: map["hostname"] + hostname: map["hostname"], + sdk: map["sdk"], + sdk_version: map["sdkVersion"] ) end @@ -101,10 +145,21 @@ def to_map "ip": @ip, "mode": @mode, "country": @country, + "continentCode": @continent_code, + "city": @city, + "subdivisions": @subdivisions, + "isp": @isp, + "autonomousSystemNumber": @autonomous_system_number, + "autonomousSystemOrganization": @autonomous_system_organization, + "connectionType": @connection_type, + "connectionUsageType": @connection_usage_type, + "connectionOrganization": @connection_organization, "time": @time, "projectId": @project_id, "teamId": @team_id, - "hostname": @hostname + "hostname": @hostname, + "sdk": @sdk, + "sdkVersion": @sdk_version } end end diff --git a/lib/appwrite/models/app.rb b/lib/appwrite/models/app.rb new file mode 100644 index 00000000..e0337643 --- /dev/null +++ b/lib/appwrite/models/app.rb @@ -0,0 +1,152 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class App + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :name + attr_reader :description + attr_reader :client_uri + attr_reader :logo_uri + attr_reader :privacy_policy_url + attr_reader :terms_url + attr_reader :contacts + attr_reader :tagline + attr_reader :tags + attr_reader :labels + attr_reader :images + attr_reader :support_url + attr_reader :data_deletion_url + attr_reader :redirect_uris + attr_reader :post_logout_redirect_uris + attr_reader :enabled + attr_reader :type + attr_reader :device_flow + attr_reader :team_id + attr_reader :user_id + attr_reader :installation_scopes + attr_reader :installation_redirect_url + attr_reader :secrets + + def initialize( + id:, + created_at:, + updated_at:, + name:, + description:, + client_uri:, + logo_uri:, + privacy_policy_url:, + terms_url:, + contacts:, + tagline:, + tags:, + labels:, + images:, + support_url:, + data_deletion_url:, + redirect_uris:, + post_logout_redirect_uris:, + enabled:, + type:, + device_flow:, + team_id:, + user_id:, + installation_scopes:, + installation_redirect_url:, + secrets: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @name = name + @description = description + @client_uri = client_uri + @logo_uri = logo_uri + @privacy_policy_url = privacy_policy_url + @terms_url = terms_url + @contacts = contacts + @tagline = tagline + @tags = tags + @labels = labels + @images = images + @support_url = support_url + @data_deletion_url = data_deletion_url + @redirect_uris = redirect_uris + @post_logout_redirect_uris = post_logout_redirect_uris + @enabled = enabled + @type = type + @device_flow = device_flow + @team_id = team_id + @user_id = user_id + @installation_scopes = installation_scopes + @installation_redirect_url = installation_redirect_url + @secrets = secrets + end + + def self.from(map:) + App.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + name: map["name"], + description: map["description"], + client_uri: map["clientUri"], + logo_uri: map["logoUri"], + privacy_policy_url: map["privacyPolicyUrl"], + terms_url: map["termsUrl"], + contacts: map["contacts"], + tagline: map["tagline"], + tags: map["tags"], + labels: map["labels"], + images: map["images"], + support_url: map["supportUrl"], + data_deletion_url: map["dataDeletionUrl"], + redirect_uris: map["redirectUris"], + post_logout_redirect_uris: map["postLogoutRedirectUris"], + enabled: map["enabled"], + type: map["type"], + device_flow: map["deviceFlow"], + team_id: map["teamId"], + user_id: map["userId"], + installation_scopes: map["installationScopes"], + installation_redirect_url: map["installationRedirectUrl"], + secrets: map["secrets"].map { |it| AppSecret.from(map: it) } + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "name": @name, + "description": @description, + "clientUri": @client_uri, + "logoUri": @logo_uri, + "privacyPolicyUrl": @privacy_policy_url, + "termsUrl": @terms_url, + "contacts": @contacts, + "tagline": @tagline, + "tags": @tags, + "labels": @labels, + "images": @images, + "supportUrl": @support_url, + "dataDeletionUrl": @data_deletion_url, + "redirectUris": @redirect_uris, + "postLogoutRedirectUris": @post_logout_redirect_uris, + "enabled": @enabled, + "type": @type, + "deviceFlow": @device_flow, + "teamId": @team_id, + "userId": @user_id, + "installationScopes": @installation_scopes, + "installationRedirectUrl": @installation_redirect_url, + "secrets": @secrets.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/app_installation.rb b/lib/appwrite/models/app_installation.rb new file mode 100644 index 00000000..e369d232 --- /dev/null +++ b/lib/appwrite/models/app_installation.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppInstallation + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :app_id + attr_reader :team_id + attr_reader :scopes + attr_reader :authorization_details + attr_reader :created_by_id + attr_reader :created_by_name + attr_reader :last_accessed_at + + def initialize( + id:, + created_at:, + updated_at:, + app_id:, + team_id:, + scopes:, + authorization_details:, + created_by_id:, + created_by_name:, + last_accessed_at: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @app_id = app_id + @team_id = team_id + @scopes = scopes + @authorization_details = authorization_details + @created_by_id = created_by_id + @created_by_name = created_by_name + @last_accessed_at = last_accessed_at + end + + def self.from(map:) + AppInstallation.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + app_id: map["appId"], + team_id: map["teamId"], + scopes: map["scopes"], + authorization_details: map["authorizationDetails"], + created_by_id: map["createdById"], + created_by_name: map["createdByName"], + last_accessed_at: map["lastAccessedAt"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "appId": @app_id, + "teamId": @team_id, + "scopes": @scopes, + "authorizationDetails": @authorization_details, + "createdById": @created_by_id, + "createdByName": @created_by_name, + "lastAccessedAt": @last_accessed_at + } + end + end + end +end diff --git a/lib/appwrite/models/app_installation_list.rb b/lib/appwrite/models/app_installation_list.rb new file mode 100644 index 00000000..1c0f16fa --- /dev/null +++ b/lib/appwrite/models/app_installation_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppInstallationList + attr_reader :total + attr_reader :installations + + def initialize( + total:, + installations: + ) + @total = total + @installations = installations + end + + def self.from(map:) + AppInstallationList.new( + total: map["total"], + installations: map["installations"].map { |it| AppInstallation.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "installations": @installations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/app_key.rb b/lib/appwrite/models/app_key.rb new file mode 100644 index 00000000..a9f1c28a --- /dev/null +++ b/lib/appwrite/models/app_key.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppKey + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :app_id + attr_reader :secret + attr_reader :hint + attr_reader :created_by_id + attr_reader :created_by_name + attr_reader :last_accessed_at + + def initialize( + id:, + created_at:, + updated_at:, + app_id:, + secret:, + hint:, + created_by_id:, + created_by_name:, + last_accessed_at: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @app_id = app_id + @secret = secret + @hint = hint + @created_by_id = created_by_id + @created_by_name = created_by_name + @last_accessed_at = last_accessed_at + end + + def self.from(map:) + AppKey.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + app_id: map["appId"], + secret: map["secret"], + hint: map["hint"], + created_by_id: map["createdById"], + created_by_name: map["createdByName"], + last_accessed_at: map["lastAccessedAt"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "appId": @app_id, + "secret": @secret, + "hint": @hint, + "createdById": @created_by_id, + "createdByName": @created_by_name, + "lastAccessedAt": @last_accessed_at + } + end + end + end +end diff --git a/lib/appwrite/models/app_key_list.rb b/lib/appwrite/models/app_key_list.rb new file mode 100644 index 00000000..6d3198f5 --- /dev/null +++ b/lib/appwrite/models/app_key_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppKeyList + attr_reader :total + attr_reader :keys + + def initialize( + total:, + keys: + ) + @total = total + @keys = keys + end + + def self.from(map:) + AppKeyList.new( + total: map["total"], + keys: map["keys"].map { |it| AppKey.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "keys": @keys.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/app_scope.rb b/lib/appwrite/models/app_scope.rb new file mode 100644 index 00000000..5044bb68 --- /dev/null +++ b/lib/appwrite/models/app_scope.rb @@ -0,0 +1,47 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppScope + attr_reader :value + attr_reader :description + attr_reader :type + attr_reader :category + attr_reader :deprecated + + def initialize( + value:, + description:, + type:, + category:, + deprecated: + ) + @value = value + @description = description + @type = type + @category = category + @deprecated = deprecated + end + + def self.from(map:) + AppScope.new( + value: map["value"], + description: map["description"], + type: map["type"], + category: map["category"], + deprecated: map["deprecated"] + ) + end + + def to_map + { + "value": @value, + "description": @description, + "type": @type, + "category": @category, + "deprecated": @deprecated + } + end + end + end +end diff --git a/lib/appwrite/models/app_scope_list.rb b/lib/appwrite/models/app_scope_list.rb new file mode 100644 index 00000000..21d13fb8 --- /dev/null +++ b/lib/appwrite/models/app_scope_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppScopeList + attr_reader :total + attr_reader :scopes + + def initialize( + total:, + scopes: + ) + @total = total + @scopes = scopes + end + + def self.from(map:) + AppScopeList.new( + total: map["total"], + scopes: map["scopes"].map { |it| AppScope.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "scopes": @scopes.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/app_secret.rb b/lib/appwrite/models/app_secret.rb new file mode 100644 index 00000000..7f5aa95a --- /dev/null +++ b/lib/appwrite/models/app_secret.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppSecret + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :app_id + attr_reader :secret + attr_reader :hint + attr_reader :created_by_id + attr_reader :created_by_name + attr_reader :last_accessed_at + + def initialize( + id:, + created_at:, + updated_at:, + app_id:, + secret:, + hint:, + created_by_id:, + created_by_name:, + last_accessed_at: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @app_id = app_id + @secret = secret + @hint = hint + @created_by_id = created_by_id + @created_by_name = created_by_name + @last_accessed_at = last_accessed_at + end + + def self.from(map:) + AppSecret.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + app_id: map["appId"], + secret: map["secret"], + hint: map["hint"], + created_by_id: map["createdById"], + created_by_name: map["createdByName"], + last_accessed_at: map["lastAccessedAt"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "appId": @app_id, + "secret": @secret, + "hint": @hint, + "createdById": @created_by_id, + "createdByName": @created_by_name, + "lastAccessedAt": @last_accessed_at + } + end + end + end +end diff --git a/lib/appwrite/models/app_secret_list.rb b/lib/appwrite/models/app_secret_list.rb new file mode 100644 index 00000000..09a33029 --- /dev/null +++ b/lib/appwrite/models/app_secret_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppSecretList + attr_reader :total + attr_reader :secrets + + def initialize( + total:, + secrets: + ) + @total = total + @secrets = secrets + end + + def self.from(map:) + AppSecretList.new( + total: map["total"], + secrets: map["secrets"].map { |it| AppSecret.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "secrets": @secrets.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/app_secret_plaintext.rb b/lib/appwrite/models/app_secret_plaintext.rb new file mode 100644 index 00000000..9060824f --- /dev/null +++ b/lib/appwrite/models/app_secret_plaintext.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppSecretPlaintext + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :app_id + attr_reader :secret + attr_reader :hint + attr_reader :created_by_id + attr_reader :created_by_name + attr_reader :last_accessed_at + + def initialize( + id:, + created_at:, + updated_at:, + app_id:, + secret:, + hint:, + created_by_id:, + created_by_name:, + last_accessed_at: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @app_id = app_id + @secret = secret + @hint = hint + @created_by_id = created_by_id + @created_by_name = created_by_name + @last_accessed_at = last_accessed_at + end + + def self.from(map:) + AppSecretPlaintext.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + app_id: map["appId"], + secret: map["secret"], + hint: map["hint"], + created_by_id: map["createdById"], + created_by_name: map["createdByName"], + last_accessed_at: map["lastAccessedAt"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "appId": @app_id, + "secret": @secret, + "hint": @hint, + "createdById": @created_by_id, + "createdByName": @created_by_name, + "lastAccessedAt": @last_accessed_at + } + end + end + end +end diff --git a/lib/appwrite/models/apps_list.rb b/lib/appwrite/models/apps_list.rb new file mode 100644 index 00000000..cf911684 --- /dev/null +++ b/lib/appwrite/models/apps_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AppsList + attr_reader :total + attr_reader :apps + + def initialize( + total:, + apps: + ) + @total = total + @apps = apps + end + + def self.from(map:) + AppsList.new( + total: map["total"], + apps: map["apps"].map { |it| App.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "apps": @apps.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index ad31ce7f..aac36f6f 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -15,6 +15,7 @@ class BillingPlan attr_reader :screenshots_generated attr_reader :members attr_reader :webhooks + attr_reader :waf_rules attr_reader :projects attr_reader :platforms attr_reader :users @@ -85,6 +86,7 @@ def initialize( screenshots_generated:, members:, webhooks:, + waf_rules:, projects:, platforms:, users:, @@ -154,6 +156,7 @@ def initialize( @screenshots_generated = screenshots_generated @members = members @webhooks = webhooks + @waf_rules = waf_rules @projects = projects @platforms = platforms @users = users @@ -226,6 +229,7 @@ def self.from(map:) screenshots_generated: map["screenshotsGenerated"], members: map["members"], webhooks: map["webhooks"], + waf_rules: map["wafRules"], projects: map["projects"], platforms: map["platforms"], users: map["users"], @@ -299,6 +303,7 @@ def to_map "screenshotsGenerated": @screenshots_generated, "members": @members, "webhooks": @webhooks, + "wafRules": @waf_rules, "projects": @projects, "platforms": @platforms, "users": @users, diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 015903f1..0adf3e21 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -10,6 +10,9 @@ class Database attr_reader :enabled attr_reader :type attr_reader :status + attr_reader :engine + attr_reader :specification + attr_reader :replicas attr_reader :policies attr_reader :archives @@ -21,8 +24,11 @@ def initialize( enabled:, type:, status: , - policies:, - archives: + engine: , + specification: , + replicas: , + policies: , + archives: ) @id = id @name = name @@ -31,6 +37,9 @@ def initialize( @enabled = enabled @type = validate_type(type) @status = status.nil? ? status : validate_status(status) + @engine = engine + @specification = specification + @replicas = replicas @policies = policies @archives = archives end @@ -44,8 +53,11 @@ def self.from(map:) enabled: map["enabled"], type: map["type"], status: map["status"], - policies: map["policies"].map { |it| BackupPolicy.from(map: it) }, - archives: map["archives"].map { |it| BackupArchive.from(map: it) } + engine: map["engine"], + specification: map["specification"], + replicas: map["replicas"], + policies: map["policies"]&.map { |it| BackupPolicy.from(map: it) }, + archives: map["archives"]&.map { |it| BackupArchive.from(map: it) } ) end @@ -58,8 +70,11 @@ def to_map "enabled": @enabled, "type": @type, "status": @status, - "policies": @policies.map { |it| it.to_map }, - "archives": @archives.map { |it| it.to_map } + "engine": @engine, + "specification": @specification, + "replicas": @replicas, + "policies": @policies&.map { |it| it.to_map }, + "archives": @archives&.map { |it| it.to_map } } end @@ -71,6 +86,9 @@ def validate_type(type) Appwrite::Enums::DatabaseType::TABLESDB, Appwrite::Enums::DatabaseType::DOCUMENTSDB, Appwrite::Enums::DatabaseType::VECTORSDB, + Appwrite::Enums::DatabaseType::MYSQL, + Appwrite::Enums::DatabaseType::POSTGRESQL, + Appwrite::Enums::DatabaseType::MONGODB, ] unless valid_type.include?(type) @@ -84,7 +102,18 @@ def validate_status(status) valid_status = [ Appwrite::Enums::DatabaseStatus::PROVISIONING, Appwrite::Enums::DatabaseStatus::READY, + Appwrite::Enums::DatabaseStatus::INACTIVE, + Appwrite::Enums::DatabaseStatus::PAUSED, Appwrite::Enums::DatabaseStatus::FAILED, + Appwrite::Enums::DatabaseStatus::DELETING, + Appwrite::Enums::DatabaseStatus::DELETED, + Appwrite::Enums::DatabaseStatus::RESTORING, + Appwrite::Enums::DatabaseStatus::SCALING, + Appwrite::Enums::DatabaseStatus::UPGRADING, + Appwrite::Enums::DatabaseStatus::MIGRATING, + Appwrite::Enums::DatabaseStatus::PAUSING, + Appwrite::Enums::DatabaseStatus::RESUMING, + Appwrite::Enums::DatabaseStatus::FAILING-OVER, ] unless valid_status.include?(status) diff --git a/lib/appwrite/models/database_status.rb b/lib/appwrite/models/database_status.rb new file mode 100644 index 00000000..3807f173 --- /dev/null +++ b/lib/appwrite/models/database_status.rb @@ -0,0 +1,62 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseStatus + attr_reader :health + attr_reader :ready + attr_reader :engine + attr_reader :version + attr_reader :uptime + attr_reader :connections + attr_reader :replicas + attr_reader :volumes + + def initialize( + health:, + ready:, + engine:, + version:, + uptime:, + connections:, + replicas:, + volumes: + ) + @health = health + @ready = ready + @engine = engine + @version = version + @uptime = uptime + @connections = connections + @replicas = replicas + @volumes = volumes + end + + def self.from(map:) + DatabaseStatus.new( + health: map["health"], + ready: map["ready"], + engine: map["engine"], + version: map["version"], + uptime: map["uptime"], + connections: DatabaseStatusConnections.from(map: map["connections"]), + replicas: map["replicas"].map { |it| DatabaseStatusReplica.from(map: it) }, + volumes: map["volumes"].map { |it| DatabaseStatusVolume.from(map: it) } + ) + end + + def to_map + { + "health": @health, + "ready": @ready, + "engine": @engine, + "version": @version, + "uptime": @uptime, + "connections": @connections.to_map, + "replicas": @replicas.map { |it| it.to_map }, + "volumes": @volumes.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/database_status_connections.rb b/lib/appwrite/models/database_status_connections.rb new file mode 100644 index 00000000..bbf23950 --- /dev/null +++ b/lib/appwrite/models/database_status_connections.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseStatusConnections + attr_reader :current + attr_reader :max + + def initialize( + current:, + max: + ) + @current = current + @max = max + end + + def self.from(map:) + DatabaseStatusConnections.new( + current: map["current"], + max: map["max"] + ) + end + + def to_map + { + "current": @current, + "max": @max + } + end + end + end +end diff --git a/lib/appwrite/models/database_status_replica.rb b/lib/appwrite/models/database_status_replica.rb new file mode 100644 index 00000000..d88c2cb3 --- /dev/null +++ b/lib/appwrite/models/database_status_replica.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseStatusReplica + attr_reader :index + attr_reader :role + attr_reader :healthy + attr_reader :lag_seconds + + def initialize( + index:, + role:, + healthy:, + lag_seconds: + ) + @index = index + @role = role + @healthy = healthy + @lag_seconds = lag_seconds + end + + def self.from(map:) + DatabaseStatusReplica.new( + index: map["index"], + role: map["role"], + healthy: map["healthy"], + lag_seconds: map["lagSeconds"] + ) + end + + def to_map + { + "index": @index, + "role": @role, + "healthy": @healthy, + "lagSeconds": @lag_seconds + } + end + end + end +end diff --git a/lib/appwrite/models/database_status_volume.rb b/lib/appwrite/models/database_status_volume.rb new file mode 100644 index 00000000..7ace12c9 --- /dev/null +++ b/lib/appwrite/models/database_status_volume.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseStatusVolume + attr_reader :xpath + attr_reader :used_percent + attr_reader :available + attr_reader :mounted + + def initialize( + xpath:, + used_percent:, + available:, + mounted: + ) + @xpath = xpath + @used_percent = used_percent + @available = available + @mounted = mounted + end + + def self.from(map:) + DatabaseStatusVolume.new( + xpath: map["path"], + used_percent: map["usedPercent"], + available: map["available"], + mounted: map["mounted"] + ) + end + + def to_map + { + "path": @xpath, + "usedPercent": @used_percent, + "available": @available, + "mounted": @mounted + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database.rb b/lib/appwrite/models/dedicated_database.rb new file mode 100644 index 00000000..43d3e8d8 --- /dev/null +++ b/lib/appwrite/models/dedicated_database.rb @@ -0,0 +1,267 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabase + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :project_id + attr_reader :name + attr_reader :api + attr_reader :engine + attr_reader :version + attr_reader :specification + attr_reader :backend + attr_reader :hostname + attr_reader :connection_port + attr_reader :connection_user + attr_reader :connection_password + attr_reader :connection_string + attr_reader :ssl + attr_reader :status + attr_reader :container_status + attr_reader :last_accessed_at + attr_reader :idle_until + attr_reader :lifecycle_state + attr_reader :idle_timeout_minutes + attr_reader :cpu + attr_reader :memory + attr_reader :storage + attr_reader :storage_class + attr_reader :storage_max_gb + attr_reader :node_pool + attr_reader :replicas + attr_reader :sync_mode + attr_reader :cross_region_replicas + attr_reader :network_max_connections + attr_reader :network_idle_timeout_seconds + attr_reader :network_ip_allowlist + attr_reader :backup_enabled + attr_reader :pitr + attr_reader :pitr_retention_days + attr_reader :storage_autoscaling + attr_reader :storage_autoscaling_threshold_percent + attr_reader :storage_autoscaling_max_gb + attr_reader :maintenance_window_day + attr_reader :maintenance_window_hour_utc + attr_reader :metrics_enabled + attr_reader :sql_api_enabled + attr_reader :sql_api_allowed_statements + attr_reader :sql_api_max_rows + attr_reader :sql_api_max_bytes + attr_reader :sql_api_timeout_seconds + attr_reader :error + + def initialize( + id:, + created_at:, + updated_at:, + project_id:, + name:, + api:, + engine:, + version:, + specification:, + backend:, + hostname:, + connection_port:, + connection_user:, + connection_password:, + connection_string:, + ssl:, + status:, + container_status:, + last_accessed_at: , + idle_until: , + lifecycle_state:, + idle_timeout_minutes:, + cpu:, + memory:, + storage:, + storage_class:, + storage_max_gb:, + node_pool:, + replicas:, + sync_mode:, + cross_region_replicas:, + network_max_connections:, + network_idle_timeout_seconds:, + network_ip_allowlist:, + backup_enabled:, + pitr:, + pitr_retention_days:, + storage_autoscaling:, + storage_autoscaling_threshold_percent:, + storage_autoscaling_max_gb:, + maintenance_window_day:, + maintenance_window_hour_utc:, + metrics_enabled:, + sql_api_enabled:, + sql_api_allowed_statements:, + sql_api_max_rows:, + sql_api_max_bytes:, + sql_api_timeout_seconds:, + error: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @project_id = project_id + @name = name + @api = api + @engine = engine + @version = version + @specification = specification + @backend = backend + @hostname = hostname + @connection_port = connection_port + @connection_user = connection_user + @connection_password = connection_password + @connection_string = connection_string + @ssl = ssl + @status = status + @container_status = container_status + @last_accessed_at = last_accessed_at + @idle_until = idle_until + @lifecycle_state = lifecycle_state + @idle_timeout_minutes = idle_timeout_minutes + @cpu = cpu + @memory = memory + @storage = storage + @storage_class = storage_class + @storage_max_gb = storage_max_gb + @node_pool = node_pool + @replicas = replicas + @sync_mode = sync_mode + @cross_region_replicas = cross_region_replicas + @network_max_connections = network_max_connections + @network_idle_timeout_seconds = network_idle_timeout_seconds + @network_ip_allowlist = network_ip_allowlist + @backup_enabled = backup_enabled + @pitr = pitr + @pitr_retention_days = pitr_retention_days + @storage_autoscaling = storage_autoscaling + @storage_autoscaling_threshold_percent = storage_autoscaling_threshold_percent + @storage_autoscaling_max_gb = storage_autoscaling_max_gb + @maintenance_window_day = maintenance_window_day + @maintenance_window_hour_utc = maintenance_window_hour_utc + @metrics_enabled = metrics_enabled + @sql_api_enabled = sql_api_enabled + @sql_api_allowed_statements = sql_api_allowed_statements + @sql_api_max_rows = sql_api_max_rows + @sql_api_max_bytes = sql_api_max_bytes + @sql_api_timeout_seconds = sql_api_timeout_seconds + @error = error + end + + def self.from(map:) + DedicatedDatabase.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + project_id: map["projectId"], + name: map["name"], + api: map["api"], + engine: map["engine"], + version: map["version"], + specification: map["specification"], + backend: map["backend"], + hostname: map["hostname"], + connection_port: map["connectionPort"], + connection_user: map["connectionUser"], + connection_password: map["connectionPassword"], + connection_string: map["connectionString"], + ssl: map["ssl"], + status: map["status"], + container_status: map["containerStatus"], + last_accessed_at: map["lastAccessedAt"], + idle_until: map["idleUntil"], + lifecycle_state: map["lifecycleState"], + idle_timeout_minutes: map["idleTimeoutMinutes"], + cpu: map["cpu"], + memory: map["memory"], + storage: map["storage"], + storage_class: map["storageClass"], + storage_max_gb: map["storageMaxGb"], + node_pool: map["nodePool"], + replicas: map["replicas"], + sync_mode: map["syncMode"], + cross_region_replicas: map["crossRegionReplicas"], + network_max_connections: map["networkMaxConnections"], + network_idle_timeout_seconds: map["networkIdleTimeoutSeconds"], + network_ip_allowlist: map["networkIPAllowlist"], + backup_enabled: map["backupEnabled"], + pitr: map["pitr"], + pitr_retention_days: map["pitrRetentionDays"], + storage_autoscaling: map["storageAutoscaling"], + storage_autoscaling_threshold_percent: map["storageAutoscalingThresholdPercent"], + storage_autoscaling_max_gb: map["storageAutoscalingMaxGb"], + maintenance_window_day: map["maintenanceWindowDay"], + maintenance_window_hour_utc: map["maintenanceWindowHourUtc"], + metrics_enabled: map["metricsEnabled"], + sql_api_enabled: map["sqlApiEnabled"], + sql_api_allowed_statements: map["sqlApiAllowedStatements"], + sql_api_max_rows: map["sqlApiMaxRows"], + sql_api_max_bytes: map["sqlApiMaxBytes"], + sql_api_timeout_seconds: map["sqlApiTimeoutSeconds"], + error: map["error"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "projectId": @project_id, + "name": @name, + "api": @api, + "engine": @engine, + "version": @version, + "specification": @specification, + "backend": @backend, + "hostname": @hostname, + "connectionPort": @connection_port, + "connectionUser": @connection_user, + "connectionPassword": @connection_password, + "connectionString": @connection_string, + "ssl": @ssl, + "status": @status, + "containerStatus": @container_status, + "lastAccessedAt": @last_accessed_at, + "idleUntil": @idle_until, + "lifecycleState": @lifecycle_state, + "idleTimeoutMinutes": @idle_timeout_minutes, + "cpu": @cpu, + "memory": @memory, + "storage": @storage, + "storageClass": @storage_class, + "storageMaxGb": @storage_max_gb, + "nodePool": @node_pool, + "replicas": @replicas, + "syncMode": @sync_mode, + "crossRegionReplicas": @cross_region_replicas, + "networkMaxConnections": @network_max_connections, + "networkIdleTimeoutSeconds": @network_idle_timeout_seconds, + "networkIPAllowlist": @network_ip_allowlist, + "backupEnabled": @backup_enabled, + "pitr": @pitr, + "pitrRetentionDays": @pitr_retention_days, + "storageAutoscaling": @storage_autoscaling, + "storageAutoscalingThresholdPercent": @storage_autoscaling_threshold_percent, + "storageAutoscalingMaxGb": @storage_autoscaling_max_gb, + "maintenanceWindowDay": @maintenance_window_day, + "maintenanceWindowHourUtc": @maintenance_window_hour_utc, + "metricsEnabled": @metrics_enabled, + "sqlApiEnabled": @sql_api_enabled, + "sqlApiAllowedStatements": @sql_api_allowed_statements, + "sqlApiMaxRows": @sql_api_max_rows, + "sqlApiMaxBytes": @sql_api_max_bytes, + "sqlApiTimeoutSeconds": @sql_api_timeout_seconds, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_member.rb b/lib/appwrite/models/dedicated_database_member.rb new file mode 100644 index 00000000..3f88817b --- /dev/null +++ b/lib/appwrite/models/dedicated_database_member.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseMember + attr_reader :id + attr_reader :role + attr_reader :status + attr_reader :lag_seconds + + def initialize( + id:, + role:, + status:, + lag_seconds: + ) + @id = id + @role = role + @status = status + @lag_seconds = lag_seconds + end + + def self.from(map:) + DedicatedDatabaseMember.new( + id: map["$id"], + role: map["role"], + status: map["status"], + lag_seconds: map["lagSeconds"] + ) + end + + def to_map + { + "$id": @id, + "role": @role, + "status": @status, + "lagSeconds": @lag_seconds + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_replicas.rb b/lib/appwrite/models/dedicated_database_replicas.rb new file mode 100644 index 00000000..3cbdc5cc --- /dev/null +++ b/lib/appwrite/models/dedicated_database_replicas.rb @@ -0,0 +1,37 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseReplicas + attr_reader :replicas + attr_reader :sync_mode + attr_reader :members + + def initialize( + replicas:, + sync_mode:, + members: + ) + @replicas = replicas + @sync_mode = sync_mode + @members = members + end + + def self.from(map:) + DedicatedDatabaseReplicas.new( + replicas: map["replicas"], + sync_mode: map["syncMode"], + members: map["members"].map { |it| DedicatedDatabaseMember.from(map: it) } + ) + end + + def to_map + { + "replicas": @replicas, + "syncMode": @sync_mode, + "members": @members.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_specification.rb b/lib/appwrite/models/dedicated_database_specification.rb new file mode 100644 index 00000000..ceb55948 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_specification.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseSpecification + attr_reader :slug + attr_reader :name + attr_reader :price + attr_reader :cpu + attr_reader :memory + attr_reader :max_connections + attr_reader :included_storage + attr_reader :included_bandwidth + attr_reader :enabled + + def initialize( + slug:, + name:, + price:, + cpu:, + memory:, + max_connections:, + included_storage:, + included_bandwidth:, + enabled: + ) + @slug = slug + @name = name + @price = price + @cpu = cpu + @memory = memory + @max_connections = max_connections + @included_storage = included_storage + @included_bandwidth = included_bandwidth + @enabled = enabled + end + + def self.from(map:) + DedicatedDatabaseSpecification.new( + slug: map["slug"], + name: map["name"], + price: map["price"], + cpu: map["cpu"], + memory: map["memory"], + max_connections: map["maxConnections"], + included_storage: map["includedStorage"], + included_bandwidth: map["includedBandwidth"], + enabled: map["enabled"] + ) + end + + def to_map + { + "slug": @slug, + "name": @name, + "price": @price, + "cpu": @cpu, + "memory": @memory, + "maxConnections": @max_connections, + "includedStorage": @included_storage, + "includedBandwidth": @included_bandwidth, + "enabled": @enabled + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_specification_list.rb b/lib/appwrite/models/dedicated_database_specification_list.rb new file mode 100644 index 00000000..7201593c --- /dev/null +++ b/lib/appwrite/models/dedicated_database_specification_list.rb @@ -0,0 +1,37 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseSpecificationList + attr_reader :specifications + attr_reader :total + attr_reader :pricing + + def initialize( + specifications:, + total:, + pricing: + ) + @specifications = specifications + @total = total + @pricing = pricing + end + + def self.from(map:) + DedicatedDatabaseSpecificationList.new( + specifications: map["specifications"].map { |it| DedicatedDatabaseSpecification.from(map: it) }, + total: map["total"], + pricing: DedicatedDatabaseSpecificationPricing.from(map: map["pricing"]) + ) + end + + def to_map + { + "specifications": @specifications.map { |it| it.to_map }, + "total": @total, + "pricing": @pricing.to_map + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_specification_pricing.rb b/lib/appwrite/models/dedicated_database_specification_pricing.rb new file mode 100644 index 00000000..ed68de88 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_specification_pricing.rb @@ -0,0 +1,47 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseSpecificationPricing + attr_reader :storage_overage_rate + attr_reader :bandwidth_overage_rate + attr_reader :replica_rate + attr_reader :cross_region_replica_rate + attr_reader :pitr_rate + + def initialize( + storage_overage_rate:, + bandwidth_overage_rate:, + replica_rate:, + cross_region_replica_rate:, + pitr_rate: + ) + @storage_overage_rate = storage_overage_rate + @bandwidth_overage_rate = bandwidth_overage_rate + @replica_rate = replica_rate + @cross_region_replica_rate = cross_region_replica_rate + @pitr_rate = pitr_rate + end + + def self.from(map:) + DedicatedDatabaseSpecificationPricing.new( + storage_overage_rate: map["storageOverageRate"], + bandwidth_overage_rate: map["bandwidthOverageRate"], + replica_rate: map["replicaRate"], + cross_region_replica_rate: map["crossRegionReplicaRate"], + pitr_rate: map["pitrRate"] + ) + end + + def to_map + { + "storageOverageRate": @storage_overage_rate, + "bandwidthOverageRate": @bandwidth_overage_rate, + "replicaRate": @replica_rate, + "crossRegionReplicaRate": @cross_region_replica_rate, + "pitrRate": @pitr_rate + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_approve.rb b/lib/appwrite/models/oauth2_approve.rb new file mode 100644 index 00000000..a1539195 --- /dev/null +++ b/lib/appwrite/models/oauth2_approve.rb @@ -0,0 +1,27 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Approve + attr_reader :redirect_url + + def initialize( + redirect_url: + ) + @redirect_url = redirect_url + end + + def self.from(map:) + Oauth2Approve.new( + redirect_url: map["redirectUrl"] + ) + end + + def to_map + { + "redirectUrl": @redirect_url + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_authorize.rb b/lib/appwrite/models/oauth2_authorize.rb new file mode 100644 index 00000000..82a0c3c8 --- /dev/null +++ b/lib/appwrite/models/oauth2_authorize.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Authorize + attr_reader :grant_id + attr_reader :redirect_url + + def initialize( + grant_id:, + redirect_url: + ) + @grant_id = grant_id + @redirect_url = redirect_url + end + + def self.from(map:) + Oauth2Authorize.new( + grant_id: map["grantId"], + redirect_url: map["redirectUrl"] + ) + end + + def to_map + { + "grantId": @grant_id, + "redirectUrl": @redirect_url + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_consent.rb b/lib/appwrite/models/oauth2_consent.rb new file mode 100644 index 00000000..7387dddf --- /dev/null +++ b/lib/appwrite/models/oauth2_consent.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Consent + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :user_id + attr_reader :app_id + attr_reader :cimd_url + attr_reader :scopes + attr_reader :resources + attr_reader :authorization_details + attr_reader :expire + + def initialize( + id:, + created_at:, + updated_at:, + user_id:, + app_id:, + cimd_url:, + scopes:, + resources:, + authorization_details:, + expire: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @user_id = user_id + @app_id = app_id + @cimd_url = cimd_url + @scopes = scopes + @resources = resources + @authorization_details = authorization_details + @expire = expire + end + + def self.from(map:) + Oauth2Consent.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + user_id: map["userId"], + app_id: map["appId"], + cimd_url: map["cimdUrl"], + scopes: map["scopes"], + resources: map["resources"], + authorization_details: map["authorizationDetails"], + expire: map["expire"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "userId": @user_id, + "appId": @app_id, + "cimdUrl": @cimd_url, + "scopes": @scopes, + "resources": @resources, + "authorizationDetails": @authorization_details, + "expire": @expire + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_consent_list.rb b/lib/appwrite/models/oauth2_consent_list.rb new file mode 100644 index 00000000..6d48dd80 --- /dev/null +++ b/lib/appwrite/models/oauth2_consent_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2ConsentList + attr_reader :total + attr_reader :consents + + def initialize( + total:, + consents: + ) + @total = total + @consents = consents + end + + def self.from(map:) + Oauth2ConsentList.new( + total: map["total"], + consents: map["consents"].map { |it| Oauth2Consent.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "consents": @consents.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_consent_token.rb b/lib/appwrite/models/oauth2_consent_token.rb new file mode 100644 index 00000000..b98a9429 --- /dev/null +++ b/lib/appwrite/models/oauth2_consent_token.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2ConsentToken + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :consent_id + attr_reader :user_id + attr_reader :app_id + attr_reader :cimd_url + attr_reader :scopes + attr_reader :resources + attr_reader :authorization_details + attr_reader :expire + + def initialize( + id:, + created_at:, + updated_at:, + consent_id:, + user_id:, + app_id:, + cimd_url:, + scopes:, + resources:, + authorization_details:, + expire: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @consent_id = consent_id + @user_id = user_id + @app_id = app_id + @cimd_url = cimd_url + @scopes = scopes + @resources = resources + @authorization_details = authorization_details + @expire = expire + end + + def self.from(map:) + Oauth2ConsentToken.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + consent_id: map["consentId"], + user_id: map["userId"], + app_id: map["appId"], + cimd_url: map["cimdUrl"], + scopes: map["scopes"], + resources: map["resources"], + authorization_details: map["authorizationDetails"], + expire: map["expire"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "consentId": @consent_id, + "userId": @user_id, + "appId": @app_id, + "cimdUrl": @cimd_url, + "scopes": @scopes, + "resources": @resources, + "authorizationDetails": @authorization_details, + "expire": @expire + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_consent_token_list.rb b/lib/appwrite/models/oauth2_consent_token_list.rb new file mode 100644 index 00000000..a06536e2 --- /dev/null +++ b/lib/appwrite/models/oauth2_consent_token_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2ConsentTokenList + attr_reader :total + attr_reader :tokens + + def initialize( + total:, + tokens: + ) + @total = total + @tokens = tokens + end + + def self.from(map:) + Oauth2ConsentTokenList.new( + total: map["total"], + tokens: map["tokens"].map { |it| Oauth2ConsentToken.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "tokens": @tokens.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_device_authorization.rb b/lib/appwrite/models/oauth2_device_authorization.rb new file mode 100644 index 00000000..c50e3713 --- /dev/null +++ b/lib/appwrite/models/oauth2_device_authorization.rb @@ -0,0 +1,52 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2DeviceAuthorization + attr_reader :device_code + attr_reader :user_code + attr_reader :verification_uri + attr_reader :verification_uri_complete + attr_reader :expires_in + attr_reader :interval + + def initialize( + device_code:, + user_code:, + verification_uri:, + verification_uri_complete:, + expires_in:, + interval: + ) + @device_code = device_code + @user_code = user_code + @verification_uri = verification_uri + @verification_uri_complete = verification_uri_complete + @expires_in = expires_in + @interval = interval + end + + def self.from(map:) + Oauth2DeviceAuthorization.new( + device_code: map["device_code"], + user_code: map["user_code"], + verification_uri: map["verification_uri"], + verification_uri_complete: map["verification_uri_complete"], + expires_in: map["expires_in"], + interval: map["interval"] + ) + end + + def to_map + { + "device_code": @device_code, + "user_code": @user_code, + "verification_uri": @verification_uri, + "verification_uri_complete": @verification_uri_complete, + "expires_in": @expires_in, + "interval": @interval + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_grant.rb b/lib/appwrite/models/oauth2_grant.rb new file mode 100644 index 00000000..8e87f96c --- /dev/null +++ b/lib/appwrite/models/oauth2_grant.rb @@ -0,0 +1,82 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Grant + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :user_id + attr_reader :app_id + attr_reader :scopes + attr_reader :resources + attr_reader :authorization_details + attr_reader :prompt + attr_reader :redirect_uri + attr_reader :auth_time + attr_reader :expire + + def initialize( + id:, + created_at:, + updated_at:, + user_id:, + app_id:, + scopes:, + resources:, + authorization_details:, + prompt:, + redirect_uri:, + auth_time:, + expire: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @user_id = user_id + @app_id = app_id + @scopes = scopes + @resources = resources + @authorization_details = authorization_details + @prompt = prompt + @redirect_uri = redirect_uri + @auth_time = auth_time + @expire = expire + end + + def self.from(map:) + Oauth2Grant.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + user_id: map["userId"], + app_id: map["appId"], + scopes: map["scopes"], + resources: map["resources"], + authorization_details: map["authorizationDetails"], + prompt: map["prompt"], + redirect_uri: map["redirectUri"], + auth_time: map["authTime"], + expire: map["expire"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "userId": @user_id, + "appId": @app_id, + "scopes": @scopes, + "resources": @resources, + "authorizationDetails": @authorization_details, + "prompt": @prompt, + "redirectUri": @redirect_uri, + "authTime": @auth_time, + "expire": @expire + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_organization.rb b/lib/appwrite/models/oauth2_organization.rb new file mode 100644 index 00000000..c54bc380 --- /dev/null +++ b/lib/appwrite/models/oauth2_organization.rb @@ -0,0 +1,27 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Organization + attr_reader :id + + def initialize( + id: + ) + @id = id + end + + def self.from(map:) + Oauth2Organization.new( + id: map["$id"] + ) + end + + def to_map + { + "$id": @id + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_organization_list.rb b/lib/appwrite/models/oauth2_organization_list.rb new file mode 100644 index 00000000..dd9691b5 --- /dev/null +++ b/lib/appwrite/models/oauth2_organization_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2OrganizationList + attr_reader :total + attr_reader :organizations + + def initialize( + total:, + organizations: + ) + @total = total + @organizations = organizations + end + + def self.from(map:) + Oauth2OrganizationList.new( + total: map["total"], + organizations: map["organizations"].map { |it| Oauth2Organization.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "organizations": @organizations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_par.rb b/lib/appwrite/models/oauth2_par.rb new file mode 100644 index 00000000..c42f8724 --- /dev/null +++ b/lib/appwrite/models/oauth2_par.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2PAR + attr_reader :request_uri + attr_reader :expires_in + + def initialize( + request_uri:, + expires_in: + ) + @request_uri = request_uri + @expires_in = expires_in + end + + def self.from(map:) + Oauth2PAR.new( + request_uri: map["request_uri"], + expires_in: map["expires_in"] + ) + end + + def to_map + { + "request_uri": @request_uri, + "expires_in": @expires_in + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_project.rb b/lib/appwrite/models/oauth2_project.rb new file mode 100644 index 00000000..a3fdf58d --- /dev/null +++ b/lib/appwrite/models/oauth2_project.rb @@ -0,0 +1,37 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Project + attr_reader :id + attr_reader :region + attr_reader :endpoint + + def initialize( + id:, + region:, + endpoint: + ) + @id = id + @region = region + @endpoint = endpoint + end + + def self.from(map:) + Oauth2Project.new( + id: map["$id"], + region: map["region"], + endpoint: map["endpoint"] + ) + end + + def to_map + { + "$id": @id, + "region": @region, + "endpoint": @endpoint + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_project_list.rb b/lib/appwrite/models/oauth2_project_list.rb new file mode 100644 index 00000000..5063b9b0 --- /dev/null +++ b/lib/appwrite/models/oauth2_project_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2ProjectList + attr_reader :total + attr_reader :projects + + def initialize( + total:, + projects: + ) + @total = total + @projects = projects + end + + def self.from(map:) + Oauth2ProjectList.new( + total: map["total"], + projects: map["projects"].map { |it| Oauth2Project.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "projects": @projects.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_reject.rb b/lib/appwrite/models/oauth2_reject.rb new file mode 100644 index 00000000..62f80c40 --- /dev/null +++ b/lib/appwrite/models/oauth2_reject.rb @@ -0,0 +1,27 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Reject + attr_reader :redirect_url + + def initialize( + redirect_url: + ) + @redirect_url = redirect_url + end + + def self.from(map:) + Oauth2Reject.new( + redirect_url: map["redirectUrl"] + ) + end + + def to_map + { + "redirectUrl": @redirect_url + } + end + end + end +end diff --git a/lib/appwrite/models/oauth2_token.rb b/lib/appwrite/models/oauth2_token.rb new file mode 100644 index 00000000..db7630c4 --- /dev/null +++ b/lib/appwrite/models/oauth2_token.rb @@ -0,0 +1,57 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Oauth2Token + attr_reader :access_token + attr_reader :token_type + attr_reader :expires_in + attr_reader :refresh_token + attr_reader :scope + attr_reader :authorization_details + attr_reader :id_token + + def initialize( + access_token:, + token_type:, + expires_in:, + refresh_token:, + scope:, + authorization_details: , + id_token: + ) + @access_token = access_token + @token_type = token_type + @expires_in = expires_in + @refresh_token = refresh_token + @scope = scope + @authorization_details = authorization_details + @id_token = id_token + end + + def self.from(map:) + Oauth2Token.new( + access_token: map["access_token"], + token_type: map["token_type"], + expires_in: map["expires_in"], + refresh_token: map["refresh_token"], + scope: map["scope"], + authorization_details: map["authorization_details"], + id_token: map["id_token"] + ) + end + + def to_map + { + "access_token": @access_token, + "token_type": @token_type, + "expires_in": @expires_in, + "refresh_token": @refresh_token, + "scope": @scope, + "authorization_details": @authorization_details, + "id_token": @id_token + } + end + end + end +end diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index 15d5056a..94f7bb10 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -30,6 +30,7 @@ class Project attr_reader :protocols attr_reader :blocks attr_reader :console_accessed_at + attr_reader :waf_enabled attr_reader :billing_limits attr_reader :o_auth2_server_enabled attr_reader :o_auth2_server_authorization_url @@ -40,6 +41,7 @@ class Project attr_reader :o_auth2_server_refresh_token_duration attr_reader :o_auth2_server_public_access_token_duration attr_reader :o_auth2_server_public_refresh_token_duration + attr_reader :o_auth2_server_installation_access_token_duration attr_reader :o_auth2_server_confidential_pkce attr_reader :o_auth2_server_verification_url attr_reader :o_auth2_server_user_code_length @@ -75,6 +77,7 @@ def initialize( protocols:, blocks:, console_accessed_at:, + waf_enabled:, billing_limits: , o_auth2_server_enabled: , o_auth2_server_authorization_url: , @@ -85,6 +88,7 @@ def initialize( o_auth2_server_refresh_token_duration: , o_auth2_server_public_access_token_duration: , o_auth2_server_public_refresh_token_duration: , + o_auth2_server_installation_access_token_duration: , o_auth2_server_confidential_pkce: , o_auth2_server_verification_url: , o_auth2_server_user_code_length: , @@ -119,6 +123,7 @@ def initialize( @protocols = protocols @blocks = blocks @console_accessed_at = console_accessed_at + @waf_enabled = waf_enabled @billing_limits = billing_limits @o_auth2_server_enabled = o_auth2_server_enabled @o_auth2_server_authorization_url = o_auth2_server_authorization_url @@ -129,6 +134,7 @@ def initialize( @o_auth2_server_refresh_token_duration = o_auth2_server_refresh_token_duration @o_auth2_server_public_access_token_duration = o_auth2_server_public_access_token_duration @o_auth2_server_public_refresh_token_duration = o_auth2_server_public_refresh_token_duration + @o_auth2_server_installation_access_token_duration = o_auth2_server_installation_access_token_duration @o_auth2_server_confidential_pkce = o_auth2_server_confidential_pkce @o_auth2_server_verification_url = o_auth2_server_verification_url @o_auth2_server_user_code_length = o_auth2_server_user_code_length @@ -166,6 +172,7 @@ def self.from(map:) protocols: map["protocols"].map { |it| ProjectProtocol.from(map: it) }, blocks: map["blocks"].map { |it| Block.from(map: it) }, console_accessed_at: map["consoleAccessedAt"], + waf_enabled: map["wafEnabled"], billing_limits: map["billingLimits"].nil? ? nil : BillingLimits.from(map: map["billingLimits"]), o_auth2_server_enabled: map["oAuth2ServerEnabled"], o_auth2_server_authorization_url: map["oAuth2ServerAuthorizationUrl"], @@ -176,6 +183,7 @@ def self.from(map:) o_auth2_server_refresh_token_duration: map["oAuth2ServerRefreshTokenDuration"], o_auth2_server_public_access_token_duration: map["oAuth2ServerPublicAccessTokenDuration"], o_auth2_server_public_refresh_token_duration: map["oAuth2ServerPublicRefreshTokenDuration"], + o_auth2_server_installation_access_token_duration: map["oAuth2ServerInstallationAccessTokenDuration"], o_auth2_server_confidential_pkce: map["oAuth2ServerConfidentialPkce"], o_auth2_server_verification_url: map["oAuth2ServerVerificationUrl"], o_auth2_server_user_code_length: map["oAuth2ServerUserCodeLength"], @@ -214,6 +222,7 @@ def to_map "protocols": @protocols.map { |it| it.to_map }, "blocks": @blocks.map { |it| it.to_map }, "consoleAccessedAt": @console_accessed_at, + "wafEnabled": @waf_enabled, "billingLimits": @billing_limits&.to_map, "oAuth2ServerEnabled": @o_auth2_server_enabled, "oAuth2ServerAuthorizationUrl": @o_auth2_server_authorization_url, @@ -224,6 +233,7 @@ def to_map "oAuth2ServerRefreshTokenDuration": @o_auth2_server_refresh_token_duration, "oAuth2ServerPublicAccessTokenDuration": @o_auth2_server_public_access_token_duration, "oAuth2ServerPublicRefreshTokenDuration": @o_auth2_server_public_refresh_token_duration, + "oAuth2ServerInstallationAccessTokenDuration": @o_auth2_server_installation_access_token_duration, "oAuth2ServerConfidentialPkce": @o_auth2_server_confidential_pkce, "oAuth2ServerVerificationUrl": @o_auth2_server_verification_url, "oAuth2ServerUserCodeLength": @o_auth2_server_user_code_length, diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 23087c01..b917162f 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -84,6 +84,215 @@ def create(user_id:, email:, password:, name: nil) end + # Get a list of the OAuth2 consents the current user has given to third-party + # apps. + # + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [Oauth2ConsentList] + def list_consents(queries: nil, total: nil) + api_path = '/account/consents' + + 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::Oauth2ConsentList + ) + + end + + # Get an OAuth2 consent the current user has given to a third-party app by + # its unique ID. + # + # @param [String] consent_id Consent unique ID. + # + # @return [Oauth2Consent] + def get_consent(consent_id:) + api_path = '/account/consents/{consentId}' + .gsub('{consentId}', consent_id) + + if consent_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "consentId"') + 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::Oauth2Consent + ) + + end + + # Delete an OAuth2 consent by its unique ID. All token families issued under + # the consent are revoked, and the app must ask for consent again to regain + # access. + # + # @param [String] consent_id Consent unique ID. + # + # @return [] + def delete_consent(consent_id:) + api_path = '/account/consents/{consentId}' + .gsub('{consentId}', consent_id) + + if consent_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "consentId"') + 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 + + # Get a list of the token families issued under an OAuth2 consent. Each entry + # represents one authorized device or session; the token secrets themselves + # are never returned. + # + # @param [String] consent_id Consent unique ID. + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [Oauth2ConsentTokenList] + def list_consent_tokens(consent_id:, queries: nil, total: nil) + api_path = '/account/consents/{consentId}/tokens' + .gsub('{consentId}', consent_id) + + if consent_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "consentId"') + end + + 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::Oauth2ConsentTokenList + ) + + end + + # Get a token family issued under an OAuth2 consent by its unique ID. The + # token secrets themselves are never returned. + # + # @param [String] consent_id Consent unique ID. + # @param [String] token_id Token unique ID. + # + # @return [Oauth2ConsentToken] + def get_consent_token(consent_id:, token_id:) + api_path = '/account/consents/{consentId}/tokens/{tokenId}' + .gsub('{consentId}', consent_id) + .gsub('{tokenId}', token_id) + + if consent_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "consentId"') + end + + if token_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + 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::Oauth2ConsentToken + ) + + end + + # Delete a token family issued under an OAuth2 consent by its unique ID. The + # access and refresh tokens of the family stop working immediately; other + # token families and the consent itself are unaffected. + # + # @param [String] consent_id Consent unique ID. + # @param [String] token_id Token unique ID. + # + # @return [] + def delete_consent_token(consent_id:, token_id:) + api_path = '/account/consents/{consentId}/tokens/{tokenId}' + .gsub('{consentId}', consent_id) + .gsub('{tokenId}', token_id) + + if consent_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "consentId"') + end + + if token_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + 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 + # Update currently logged in user account email address. After changing user # address, the user confirmation status will get reset. A new confirmation # email is not sent automatically however you can use the send confirmation diff --git a/lib/appwrite/services/apps.rb b/lib/appwrite/services/apps.rb new file mode 100644 index 00000000..bc96e462 --- /dev/null +++ b/lib/appwrite/services/apps.rb @@ -0,0 +1,813 @@ +#frozen_string_literal: true + +module Appwrite + class Apps < Service + + def initialize(client) + @client = client + end + + # List applications. + # + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppsList] + def list(queries: nil, total: nil) + api_path = '/apps' + + 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::AppsList + ) + + end + + # Create a new application. + # + # @param [String] app_id Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Application name. + # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + # @param [String] description Application description shown to users during OAuth2 consent. + # @param [String] client_uri Application homepage URL shown to users during OAuth2 consent. + # @param [String] logo_uri Application logo URL shown to users during OAuth2 consent. + # @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent. + # @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent. + # @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed. + # @param [String] tagline Application tagline shown to users during OAuth2 consent. + # @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + # @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + # @param [String] support_url Application support URL shown to users during OAuth2 consent. + # @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent. + # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + # @param [] enabled Is application enabled? + # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + # @param [String] team_id Team unique ID. + # + # @return [App] + def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil) + api_path = '/apps' + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if redirect_uris.nil? + raise Appwrite::Exception.new('Missing required parameter: "redirectUris"') + end + + api_params = { + appId: app_id, + name: name, + description: description, + clientUri: client_uri, + logoUri: logo_uri, + privacyPolicyUrl: privacy_policy_url, + termsUrl: terms_url, + contacts: contacts, + tagline: tagline, + tags: tags, + images: images, + supportUrl: support_url, + dataDeletionUrl: data_deletion_url, + redirectUris: redirect_uris, + postLogoutRedirectUris: post_logout_redirect_uris, + enabled: enabled, + type: type, + deviceFlow: device_flow, + teamId: team_id, + } + + 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::App + ) + + end + + # List scopes an application can request when installed on a team. + # + # + # @return [AppScopeList] + def list_installation_scopes() + api_path = '/apps/scopes/installations' + + 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::AppScopeList + ) + + end + + # List scopes an application can request during the OAuth2 flow. + # + # + # @return [AppScopeList] + def list_o_auth2_scopes() + api_path = '/apps/scopes/oauth2' + + 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::AppScopeList + ) + + end + + # Get an application by its unique ID. + # + # @param [String] app_id Application unique ID or HTTPS client ID metadata document URL. + # + # @return [App] + def get(app_id:) + api_path = '/apps/{appId}' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + 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::App + ) + + end + + # Update an application by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] name Application name. + # @param [String] description Application description shown to users during OAuth2 consent. + # @param [String] client_uri Application homepage URL shown to users during OAuth2 consent. + # @param [String] logo_uri Application logo URL shown to users during OAuth2 consent. + # @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent. + # @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent. + # @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed. + # @param [String] tagline Application tagline shown to users during OAuth2 consent. + # @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + # @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + # @param [String] support_url Application support URL shown to users during OAuth2 consent. + # @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent. + # @param [] enabled Is application enabled? + # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + # @param [Array] installation_scopes Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + # @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. + # + # @return [App] + def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil) + api_path = '/apps/{appId}' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + description: description, + clientUri: client_uri, + logoUri: logo_uri, + privacyPolicyUrl: privacy_policy_url, + termsUrl: terms_url, + contacts: contacts, + tagline: tagline, + tags: tags, + images: images, + supportUrl: support_url, + dataDeletionUrl: data_deletion_url, + enabled: enabled, + redirectUris: redirect_uris, + postLogoutRedirectUris: post_logout_redirect_uris, + type: type, + deviceFlow: device_flow, + installationScopes: installation_scopes, + installationRedirectUrl: installation_redirect_url, + } + + 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::App + ) + + end + + # Delete an application by its unique ID. + # + # @param [String] app_id Application unique ID. + # + # @return [] + def delete(app_id:) + api_path = '/apps/{appId}' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + 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 + + # List installations of an application. Requires an app key sent in the + # `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + # + # @param [String] app_id Application unique ID. + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppInstallationList] + def list_installations(app_id:, queries: nil, total: nil) + api_path = '/apps/{appId}/installations' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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 + + # Get an installation of an application by its unique ID. Requires an app key + # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + # + # @param [String] app_id Application unique ID. + # @param [String] installation_id Installation unique ID. + # + # @return [AppInstallation] + def get_installation(app_id:, installation_id:) + api_path = '/apps/{appId}/installations/{installationId}' + .gsub('{appId}', app_id) + .gsub('{installationId}', installation_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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 + + # Create a token for an installation of an application. Requires an app key + # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + # The returned token carries the scopes and authorization details granted to + # the installation, and can be used as an `Authorization: Bearer` header + # everywhere OAuth2 access tokens are accepted. Multiple tokens can be active + # for the same installation at once; each token stays valid until it expires + # or the installation is updated or deleted. + # + # @param [String] app_id Application unique ID. + # @param [String] installation_id Installation unique ID. + # + # @return [Oauth2Token] + def create_installation_token(app_id:, installation_id:) + api_path = '/apps/{appId}/installations/{installationId}/tokens' + .gsub('{appId}', app_id) + .gsub('{installationId}', installation_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Token + ) + + end + + # List app keys for an application. + # + # @param [String] app_id Application unique ID. + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppKeyList] + def list_keys(app_id:, queries: nil, total: nil) + api_path = '/apps/{appId}/keys' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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::AppKeyList + ) + + end + + # Create a new app key for an application. App keys carry no scopes; send one + # in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to + # list the application's installations and create installation access tokens. + # + # @param [String] app_id Application unique ID. + # + # @return [AppKey] + def create_key(app_id:) + api_path = '/apps/{appId}/keys' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + api_params = { + } + + 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::AppKey + ) + + end + + # Get an app key by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] key_id App key unique ID. + # + # @return [AppKey] + def get_key(app_id:, key_id:) + api_path = '/apps/{appId}/keys/{keyId}' + .gsub('{appId}', app_id) + .gsub('{keyId}', key_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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::AppKey + ) + + end + + # Delete an app key by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] key_id App key unique ID. + # + # @return [] + def delete_key(app_id:, key_id:) + api_path = '/apps/{appId}/keys/{keyId}' + .gsub('{appId}', app_id) + .gsub('{keyId}', key_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + + end + + # Update the labels of an application. Labels are read-only for clients; only + # a server SDK using a project API key can set them. Replaces the previous + # labels. + # + # @param [String] app_id Application unique ID. + # @param [Array] labels Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + # + # @return [App] + def update_labels(app_id:, labels:) + api_path = '/apps/{appId}/labels' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if labels.nil? + raise Appwrite::Exception.new('Missing required parameter: "labels"') + end + + api_params = { + labels: labels, + } + + 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::App + ) + + end + + # List client secrets for an application. + # + # @param [String] app_id Application unique ID. + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppSecretList] + def list_secrets(app_id:, queries: nil, total: nil) + api_path = '/apps/{appId}/secrets' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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::AppSecretList + ) + + end + + # Create a new client secret for an application. + # + # @param [String] app_id Application unique ID. + # + # @return [AppSecretPlaintext] + def create_secret(app_id:) + api_path = '/apps/{appId}/secrets' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + api_params = { + } + + 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::AppSecretPlaintext + ) + + end + + # Get an application client secret by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] secret_id Secret unique ID. + # + # @return [AppSecret] + def get_secret(app_id:, secret_id:) + api_path = '/apps/{appId}/secrets/{secretId}' + .gsub('{appId}', app_id) + .gsub('{secretId}', secret_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if secret_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretId"') + 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::AppSecret + ) + + end + + # Delete an application client secret by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] secret_id Secret unique ID. + # + # @return [] + def delete_secret(app_id:, secret_id:) + api_path = '/apps/{appId}/secrets/{secretId}' + .gsub('{appId}', app_id) + .gsub('{secretId}', secret_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if secret_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretId"') + 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 + + # Transfer an application to another team by its unique ID. + # + # @param [String] app_id Application unique ID. + # @param [String] team_id Team ID of the team to transfer application to. + # + # @return [App] + def update_team(app_id:, team_id:) + api_path = '/apps/{appId}/team' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + api_params = { + teamId: team_id, + } + + 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::App + ) + + end + + # Revoke all tokens for an application by its unique ID. + # + # @param [String] app_id Application unique ID. + # + # @return [] + def delete_tokens(app_id:) + api_path = '/apps/{appId}/tokens' + .gsub('{appId}', app_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + 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 + + end +end diff --git a/lib/appwrite/services/backups.rb b/lib/appwrite/services/backups.rb index 936833da..f923d951 100644 --- a/lib/appwrite/services/backups.rb +++ b/lib/appwrite/services/backups.rb @@ -317,24 +317,38 @@ def delete_policy(policy_id:) # Create and trigger a new restoration for a backup on a project. # - # When restoring a DocumentsDB or VectorsDB database to a new resource, pass - # `newSpecification` to provision the restored database on a different - # specification than the archived one (for example, restoring onto a larger - # or smaller dedicated database). Use `serverless` to restore onto the shared - # pool, or a dedicated specification slug to restore onto a dedicated - # database of that size. The specification must be permitted by the - # organization's plan. `newSpecification` is not supported for - # legacy/TablesDB databases or for bucket restores. + # For a backup of one database, the restoration resolves its destination + # before it is queued. Pass `newResourceId` to restore into that database ID, + # including the archived database ID to overwrite it. When `newResourceId` is + # omitted, a new database ID is generated and returned in `options`. + # + # The restoration migration records the archived database in `resourceId` and + # `resourceType`, and the resolved database in `destinationResourceId` and + # `destinationResourceType`. Database types are stored canonically as + # `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave + # these fields empty because they do not have a single source or destination + # database. + # + # To list every migration related to one database, use its canonical type in + # a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and + # destination relation pairs: `(resourceType, resourceId)`, + # `(parentResourceType, parentResourceId)`, and `(destinationResourceType, + # destinationResourceId)`. Legacy and TablesDB databases use `database`; the + # operational `resourceType` of a table migration is not rewritten to + # `tablesdb`. + # + # When restoring a DocumentsDB or VectorsDB database to a new resource from a + # dedicated source, the restore provisions a fresh dedicated backing database + # at the source database's own specification. # # # @param [String] archive_id Backup archive ID to restore # @param [Array] services Array of services to restore - # @param [String] new_resource_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] new_resource_id Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] new_resource_name Database name. Max length: 128 chars. - # @param [String] new_specification Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. # # @return [BackupRestoration] - def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil, new_specification: nil) + def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) api_path = '/backups/restoration' if archive_id.nil? @@ -350,7 +364,6 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc services: services, newResourceId: new_resource_id, newResourceName: new_resource_name, - newSpecification: new_specification, } api_headers = { diff --git a/lib/appwrite/services/oauth2.rb b/lib/appwrite/services/oauth2.rb new file mode 100644 index 00000000..0f72a909 --- /dev/null +++ b/lib/appwrite/services/oauth2.rb @@ -0,0 +1,525 @@ +#frozen_string_literal: true + +module Appwrite + class Oauth2 < Service + + def initialize(client) + @client = client + end + + # Approve an OAuth2 grant after the user gives consent. Returns the + # `redirectUrl` the end user should be sent to. The consent screen may + # optionally pass enriched `authorization_details` to record the concrete + # resources the user selected. You can pass Accept header of + # `application/json` to receive a JSON response instead of a redirect. + # + # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. + # @param [String] authorization_details Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. + # @param [String] scope Space-separated scopes the user consented to. Must be a subset of the scopes originally requested; identity scopes such as `openid` are always retained. Optional; omit to keep the originally requested scopes. + # + # @return [Oauth2Approve] + def approve(grant_id:, authorization_details: nil, scope: nil) + api_path = '/oauth2/{project_id}/approve' + .gsub('{project_id}', @client.get_config('project')) + + if grant_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "grantId"') + end + + api_params = { + grant_id: grant_id, + authorization_details: authorization_details, + scope: scope, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Approve + ) + + end + + # Begin the OAuth2 authorization flow. When called without a session, the + # user is redirected to the consent screen without grant ID. When called with + # a session, the redirect URL includes param for grant ID. You can pass + # Accept header of `application/json` to receive a JSON response instead of a + # redirect. + # + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] redirect_uri Redirect URI where visitor will be redirected after authorization, whether successful or not. + # @param [String] response_type OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + # @param [String] scope Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + # @param [String] state OAuth2 state. You receive this back in the redirect URI. + # @param [String] nonce OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + # @param [String] code_challenge PKCE code challenge. Required when OAuth2 app is public. + # @param [String] code_challenge_method PKCE code challenge method. Required when OAuth2 app is public. + # @param [String] prompt OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + # @param [Integer] max_age OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + # @param [String] authorization_details Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + # @param [String] resource RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. + # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. + # + # @return [Oauth2Authorize] + def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + api_path = '/oauth2/{project_id}/authorize' + .gsub('{project_id}', @client.get_config('project')) + + api_params = { + client_id: client_id, + redirect_uri: redirect_uri, + response_type: response_type, + scope: scope, + state: state, + nonce: nonce, + code_challenge: code_challenge, + code_challenge_method: code_challenge_method, + prompt: prompt, + max_age: max_age, + authorization_details: authorization_details, + resource: resource, + audience: audience, + request_uri: request_uri, + } + + api_headers = { + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Authorize + ) + + end + + # Begin the OAuth2 authorization flow. When called without a session, the + # user is redirected to the consent screen without grant ID. When called with + # a session, the redirect URL includes param for grant ID. You can pass + # Accept header of `application/json` to receive a JSON response instead of a + # redirect. + # + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] redirect_uri Redirect URI where visitor will be redirected after authorization, whether successful or not. + # @param [String] response_type OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + # @param [String] scope Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + # @param [String] state OAuth2 state. You receive this back in the redirect URI. + # @param [String] nonce OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + # @param [String] code_challenge PKCE code challenge. Required when OAuth2 app is public. + # @param [String] code_challenge_method PKCE code challenge method. Required when OAuth2 app is public. + # @param [String] prompt OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + # @param [Integer] max_age OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + # @param [String] authorization_details Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + # @param [String] resource RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. + # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. + # + # @return [Oauth2Authorize] + def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + api_path = '/oauth2/{project_id}/authorize' + .gsub('{project_id}', @client.get_config('project')) + + api_params = { + client_id: client_id, + redirect_uri: redirect_uri, + response_type: response_type, + scope: scope, + state: state, + nonce: nonce, + code_challenge: code_challenge, + code_challenge_method: code_challenge_method, + prompt: prompt, + max_age: max_age, + authorization_details: authorization_details, + resource: resource, + audience: audience, + request_uri: request_uri, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Authorize + ) + + end + + # Start the OAuth2 Device Authorization Grant. Returns the device code, user + # code, verification URL, expiration, and polling interval. + # + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] scope Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. + # @param [String] authorization_details Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + # @param [String] resource RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. + # + # @return [Oauth2DeviceAuthorization] + def create_device_authorization(client_id: nil, scope: nil, authorization_details: nil, resource: nil, audience: nil) + api_path = '/oauth2/{project_id}/device_authorization' + .gsub('{project_id}', @client.get_config('project')) + + api_params = { + client_id: client_id, + scope: scope, + authorization_details: authorization_details, + resource: resource, + audience: audience, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2DeviceAuthorization + ) + + end + + # Exchange a device flow user code for an OAuth2 grant. The authenticated + # user is bound to the pending grant. Pass the returned grant ID to the get + # grant endpoint to render the consent screen, then to the approve or reject + # endpoint to complete the flow. + # + # @param [String] user_code User code displayed on the device. + # + # @return [Oauth2Grant] + def create_grant(user_code:) + api_path = '/oauth2/{project_id}/grants' + .gsub('{project_id}', @client.get_config('project')) + + if user_code.nil? + raise Appwrite::Exception.new('Missing required parameter: "userCode"') + end + + api_params = { + user_code: user_code, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Grant + ) + + end + + # Get an OAuth2 grant by its ID. Used by the consent screen to display the + # details of the authorization the user is being asked to approve. A grant + # can only be read by the user it belongs to, or by server SDK. + # + # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. + # + # @return [Oauth2Grant] + def get_grant(grant_id:) + api_path = '/oauth2/{project_id}/grants/{grant_id}' + .gsub('{project_id}', @client.get_config('project')) + .gsub('{grant_id}', grant_id) + + if grant_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "grantId"') + end + + api_params = { + } + + api_headers = { + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Grant + ) + + end + + # List the organizations the OAuth2 access token can access. Resolves the + # token's `organization` authorization details, expanding the `*` wildcard + # into the concrete set of organizations the user can see. + # + # @param [Integer] limit Maximum number of organizations to return. Between 1 and 5000. + # @param [Integer] offset Number of organizations to skip before returning results. Used for pagination. + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # + # @return [Oauth2OrganizationList] + def list_organizations(limit: nil, offset: nil, search: nil) + api_path = '/oauth2/{project_id}/organizations' + .gsub('{project_id}', @client.get_config('project')) + + api_params = { + limit: limit, + offset: offset, + search: search, + } + + api_headers = { + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2OrganizationList + ) + + end + + # Store an OAuth2 authorization request server-side and receive a short-lived + # request_uri handle for the authorize endpoint. + # + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] redirect_uri Redirect URI where visitor will be redirected after authorization, whether successful or not. + # @param [String] response_type OAuth2 / OIDC response type. + # @param [String] scope Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + # @param [String] state OAuth2 state. You receive this back in the redirect URI. + # @param [String] nonce OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + # @param [String] code_challenge PKCE code challenge. Required when OAuth2 app is public. + # @param [String] code_challenge_method PKCE code challenge method. Required when OAuth2 app is public. + # @param [String] prompt OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + # @param [Integer] max_age OIDC max_age parameter for customization of consent screen. + # @param [String] authorization_details Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + # @param [String] resource RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. + # + # @return [Oauth2PAR] + def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil) + api_path = '/oauth2/{project_id}/par' + .gsub('{project_id}', @client.get_config('project')) + + if client_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "clientId"') + end + + if redirect_uri.nil? + raise Appwrite::Exception.new('Missing required parameter: "redirectUri"') + end + + if response_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "responseType"') + end + + api_params = { + client_id: client_id, + redirect_uri: redirect_uri, + response_type: response_type, + scope: scope, + state: state, + nonce: nonce, + code_challenge: code_challenge, + code_challenge_method: code_challenge_method, + prompt: prompt, + max_age: max_age, + authorization_details: authorization_details, + resource: resource, + audience: audience, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2PAR + ) + + end + + # List the projects the OAuth2 access token can access. Resolves the token's + # `project` authorization details, expanding the `*` wildcard into the + # concrete set of projects the user can see. + # + # @param [Integer] limit Maximum number of projects to return. Between 1 and 5000. + # @param [Integer] offset Number of projects to skip before returning results. Used for pagination. + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # + # @return [Oauth2ProjectList] + def list_projects(limit: nil, offset: nil, search: nil) + api_path = '/oauth2/{project_id}/projects' + .gsub('{project_id}', @client.get_config('project')) + + api_params = { + limit: limit, + offset: offset, + search: search, + } + + api_headers = { + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2ProjectList + ) + + end + + # Reject an OAuth2 grant when the user denies consent. Returns the + # `redirectUrl` the end user should be sent to with an `access_denied` error. + # You can pass Accept header of `application/json` to receive a JSON response + # instead of a redirect. + # + # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. + # + # @return [Oauth2Reject] + def reject(grant_id:) + api_path = '/oauth2/{project_id}/reject' + .gsub('{project_id}', @client.get_config('project')) + + if grant_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "grantId"') + end + + api_params = { + grant_id: grant_id, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Reject + ) + + end + + # Revoke an OAuth2 access token or refresh token. + # + # @param [String] token The access or refresh token to revoke. + # @param [String] token_type_hint Type of token to revoke (access_token or refresh_token). + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] client_secret OAuth2 client secret. Required for confidential apps; omitted for public apps. + # + # @return [] + def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) + api_path = '/oauth2/{project_id}/revoke' + .gsub('{project_id}', @client.get_config('project')) + + if token.nil? + raise Appwrite::Exception.new('Missing required parameter: "token"') + end + + api_params = { + token: token, + token_type_hint: token_type_hint, + client_id: client_id, + client_secret: client_secret, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + ) + + end + + # Exchange an OAuth2 authorization code, refresh token, or device code for + # access and refresh tokens. + # + # @param [String] grant_type OAuth2 grant type. Can be one of: `authorization_code`, `refresh_token`, `urn:ietf:params:oauth:grant-type:device_code`. + # @param [String] code Authorization code to be exchanged for access and refresh tokens. Required for `authorization_code` grant type. + # @param [String] refresh_token Refresh token to be exchanged for a new access and refresh tokens. Required for `refresh_token` grant type. + # @param [String] device_code Device code obtained from the device authorization endpoint. Required for `urn:ietf:params:oauth:grant-type:device_code` grant type. + # @param [String] client_id OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + # @param [String] client_secret OAuth2 client secret. Required for confidential apps. + # @param [String] code_verifier PKCE code verifier. Required for public apps. + # @param [String] redirect_uri Redirect URI. Required for `authorization_code` grant type. + # @param [String] resource RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. + # + # @return [Oauth2Token] + def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, client_id: nil, client_secret: nil, code_verifier: nil, redirect_uri: nil, resource: nil, audience: nil) + api_path = '/oauth2/{project_id}/token' + .gsub('{project_id}', @client.get_config('project')) + + if grant_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "grantType"') + end + + api_params = { + grant_type: grant_type, + code: code, + refresh_token: refresh_token, + device_code: device_code, + client_id: client_id, + client_secret: client_secret, + code_verifier: code_verifier, + redirect_uri: redirect_uri, + resource: resource, + audience: audience, + } + + api_headers = { + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Oauth2Token + ) + + end + + end +end diff --git a/lib/appwrite/services/organization.rb b/lib/appwrite/services/organization.rb index 2405ffff..71a003f7 100644 --- a/lib/appwrite/services/organization.rb +++ b/lib/appwrite/services/organization.rb @@ -89,6 +89,174 @@ def delete() end + # List app installations on the organization. Any organization member can + # read installations. + # + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppInstallationList] + 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 + + # 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. + # + # @param [String] app_id Application unique ID. + # @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. + # + # @return [AppInstallation] + 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: authorization_details, + } + + 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 + + # Get an app installation on the organization by its unique ID. Any + # organization member can read installations. + # + # @param [String] installation_id Installation unique ID. + # + # @return [AppInstallation] + 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 + + # 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. + # + # @param [String] installation_id Installation unique ID. + # @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. + # + # @return [AppInstallation] + 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: authorization_details, + } + + 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 + + # 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. + # + # @param [String] installation_id Installation unique ID. + # + # @return [] + 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 + # Get a list of all API keys from the current organization. # # @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. You may filter on the following attributes: expire, accessedAt, name, scopes diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index 954ef3bf..d1eee8ff 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -569,6 +569,7 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [Integer] refresh_token_duration Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. # @param [Integer] public_access_token_duration Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. # @param [Integer] public_refresh_token_duration Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + # @param [Integer] installation_access_token_duration Access token duration in seconds for app installation access tokens. Leave empty to use default 1 hour. # @param [] confidential_pkce When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. # @param [String] verification_url URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. # @param [Integer] user_code_length Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. @@ -577,7 +578,7 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [Array] default_scopes List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. # # @return [Project] - def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil) + def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil) api_path = '/project/oauth2-server' if enabled.nil? @@ -597,6 +598,7 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati refreshTokenDuration: refresh_token_duration, publicAccessTokenDuration: public_access_token_duration, publicRefreshTokenDuration: public_refresh_token_duration, + installationAccessTokenDuration: installation_access_token_duration, confidentialPkce: confidential_pkce, verificationUrl: verification_url, userCodeLength: user_code_length, diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index b077debc..bc93d5b7 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -693,9 +693,10 @@ def delete_deployment(site_id:, deployment_id:) # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(site_id:, deployment_id:, type: nil) + def get_deployment_download(site_id:, deployment_id:, type: nil, token: nil) api_path = '/sites/{siteId}/deployments/{deploymentId}/download' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) @@ -710,6 +711,7 @@ def get_deployment_download(site_id:, deployment_id:, type: nil) api_params = { type: type, + token: token, } api_headers = { diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index a60395f6..8144d9b7 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -46,9 +46,10 @@ def list(queries: nil, search: nil, total: nil) # @param [String] name Database name. Max length: 128 chars. # @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. # @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. + # @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. # # @return [Database] - def create(database_id:, name:, enabled: nil, specification: nil) + def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil) api_path = '/tablesdb' if database_id.nil? @@ -64,6 +65,7 @@ def create(database_id:, name:, enabled: nil, specification: nil) name: name, enabled: enabled, specification: specification, + replicas: replicas, } api_headers = { @@ -82,6 +84,33 @@ def create(database_id:, name:, enabled: nil, specification: nil) end + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/tablesdb/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + + end + # List transactions across all databases. # # @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 +334,10 @@ def get(database_id:) # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. # @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. + # @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. # # @return [Database] - def update(database_id:, name: nil, enabled: nil) + def update(database_id:, name: nil, enabled: nil, replicas: nil) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) @@ -318,6 +348,7 @@ def update(database_id:, name: nil, enabled: nil) api_params = { name: name, enabled: enabled, + replicas: replicas, } api_headers = { @@ -367,6 +398,107 @@ def delete(database_id:) end + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover(database_id:, target_replica_id: nil) + api_path = '/tablesdb/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas(database_id:) + api_path = '/tablesdb/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status(database_id:) + api_path = '/tablesdb/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + + end + # Get a list of all tables that belong to the provided databaseId. You can # use the search parameter to filter your results. # diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index c41f7fa4..3ae89b4d 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -181,6 +181,204 @@ def delete(team_id:) end + # List app installations on a team. Any team member can read installations. + # + # @param [String] team_id Team ID. + # @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. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [AppInstallationList] + def list_installations(team_id:, queries: nil, total: nil) + api_path = '/teams/{teamId}/installations' + .gsub('{teamId}', team_id) + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + 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 + + # Install an app on a team. When authenticated as a user, only team members + # with the owner role can install apps. Requests using an API key or in admin + # mode can install apps on any team. The installation is granted the scopes + # the app currently requests. + # + # @param [String] team_id Team ID. + # @param [String] app_id Application unique ID. + # @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. + # + # @return [AppInstallation] + def create_installation(team_id:, app_id:, authorization_details: nil) + api_path = '/teams/{teamId}/installations' + .gsub('{teamId}', team_id) + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + api_params = { + appId: app_id, + authorizationDetails: authorization_details, + } + + 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 + + # Get an app installation on a team by its unique ID. Any team member can + # read installations. + # + # @param [String] team_id Team ID. + # @param [String] installation_id Installation unique ID. + # + # @return [AppInstallation] + def get_installation(team_id:, installation_id:) + api_path = '/teams/{teamId}/installations/{installationId}' + .gsub('{teamId}', team_id) + .gsub('{installationId}', installation_id) + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + 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 + + # Update an app installation on a team. Only team 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. + # + # @param [String] team_id Team ID. + # @param [String] installation_id Installation unique ID. + # @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. + # + # @return [AppInstallation] + def update_installation(team_id:, installation_id:, authorization_details: nil) + api_path = '/teams/{teamId}/installations/{installationId}' + .gsub('{teamId}', team_id) + .gsub('{installationId}', installation_id) + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + if installation_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "installationId"') + end + + api_params = { + authorizationDetails: authorization_details, + } + + 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 + + # Uninstall an app from a team by its installation ID. Only team members with + # the owner role can remove installations. Previously issued installation + # access tokens are revoked. + # + # @param [String] team_id Team ID. + # @param [String] installation_id Installation unique ID. + # + # @return [] + def delete_installation(team_id:, installation_id:) + api_path = '/teams/{teamId}/installations/{installationId}' + .gsub('{teamId}', team_id) + .gsub('{installationId}', installation_id) + + if team_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "teamId"') + end + + 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 + # Use this endpoint to list a team's members using the team's ID. All team # members have read access to this endpoint. Hide sensitive attributes from # the response by toggling membership privacy in the Console. From 6c8a2f5adf160dc4cbdb1da3fd29ecaf4529d71d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 23 Jul 2026 17:02:06 +0530 Subject: [PATCH 05/10] chore: update Ruby SDK to 26.1.0 --- .github/workflows/publish.yml | 4 ++-- lib/appwrite/models/database.rb | 2 +- lib/appwrite/models/project_auth_method.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 31e26c48..4ab3cc7b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Ruby - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + uses: ruby/setup-ruby@a30dfa457ad68707b8b910ac3a244714b61c0626 # v1.320.0 with: ruby-version: 2.7 bundler-cache: true diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 0adf3e21..90e95d6e 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -113,7 +113,7 @@ def validate_status(status) Appwrite::Enums::DatabaseStatus::MIGRATING, Appwrite::Enums::DatabaseStatus::PAUSING, Appwrite::Enums::DatabaseStatus::RESUMING, - Appwrite::Enums::DatabaseStatus::FAILING-OVER, + Appwrite::Enums::DatabaseStatus::FAILING_OVER, ] unless valid_status.include?(status) diff --git a/lib/appwrite/models/project_auth_method.rb b/lib/appwrite/models/project_auth_method.rb index d94439a4..17cfbbc5 100644 --- a/lib/appwrite/models/project_auth_method.rb +++ b/lib/appwrite/models/project_auth_method.rb @@ -32,9 +32,9 @@ def to_map def validate_id(id) valid_id = [ - Appwrite::Enums::ProjectAuthMethodId::EMAIL-PASSWORD, - Appwrite::Enums::ProjectAuthMethodId::MAGIC-URL, - Appwrite::Enums::ProjectAuthMethodId::EMAIL-OTP, + Appwrite::Enums::ProjectAuthMethodId::EMAIL_PASSWORD, + Appwrite::Enums::ProjectAuthMethodId::MAGIC_URL, + Appwrite::Enums::ProjectAuthMethodId::EMAIL_OTP, Appwrite::Enums::ProjectAuthMethodId::ANONYMOUS, Appwrite::Enums::ProjectAuthMethodId::INVITES, Appwrite::Enums::ProjectAuthMethodId::JWT, From 7decdbfa98e83bdf863d7c5981e4eb27eca939f3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 13:42:07 +0530 Subject: [PATCH 06/10] chore: update Ruby SDK to 27.0.0 --- CHANGELOG.md | 18 ++ README.md | 2 +- appwrite.gemspec | 2 +- docs/examples/activities/list-events.md | 2 +- .../apps/create-installation-token.md | 2 +- .../delete-installation.md} | 7 +- docs/examples/apps/get-installation.md | 2 +- docs/examples/apps/list-installations.md | 2 +- .../embeddings/create-text-embeddings.md | 18 ++ ...te-key.md => update-mfa-factors-policy.md} | 11 +- .../project/update-o-auth-2-server.md | 3 +- .../project/update-session-duration-policy.md | 2 +- .../project/update-user-limit-policy.md | 2 +- docs/examples/proxy/create-invalidation.md | 19 ++ docs/examples/storage/create-file.md | 3 +- docs/examples/tablesdb/create-migration.md | 18 ++ docs/examples/tablesdb/create.md | 3 +- docs/examples/tablesdb/cutover-migration.md | 17 ++ docs/examples/tablesdb/delete-migration.md | 17 ++ docs/examples/tablesdb/get-migration.md | 17 ++ docs/examples/tablesdb/list-migrations.md | 16 ++ docs/examples/tablesdb/list-operations.md | 19 ++ docs/examples/tablesdb/update.md | 4 +- docs/examples/users/get-mfa-challenge.md | 17 ++ lib/appwrite.rb | 12 + lib/appwrite/client.rb | 18 +- lib/appwrite/enums/authentication_factor.rb | 1 + lib/appwrite/enums/build_runtime.rb | 1 + lib/appwrite/enums/embedding_model.rb | 10 + lib/appwrite/enums/invalidation_type.rb | 9 + lib/appwrite/enums/project_key_scopes.rb | 2 + lib/appwrite/enums/project_policy_id.rb | 1 + lib/appwrite/enums/runtime.rb | 1 + lib/appwrite/models/billing_plan.rb | 8 +- lib/appwrite/models/billing_plan_addon.rb | 12 +- .../models/billing_plan_addon_details.rb | 2 +- lib/appwrite/models/database_migration.rb | 102 +++++++ .../models/database_migration_list.rb | 32 +++ lib/appwrite/models/database_status.rb | 30 +++ lib/appwrite/models/dedicated_database.rb | 5 - .../models/dedicated_database_member.rb | 2 +- .../models/dedicated_database_operation.rb | 77 ++++++ .../dedicated_database_operation_list.rb | 32 +++ .../models/dedicated_database_replicas.rb | 25 ++ ...edicated_database_specification_pricing.rb | 5 - lib/appwrite/models/embedding.rb | 42 +++ lib/appwrite/models/embedding_list.rb | 32 +++ lib/appwrite/models/file.rb | 10 + lib/appwrite/models/mfa_challenge_secret.rb | 47 ++++ lib/appwrite/models/mfa_factors.rb | 11 +- lib/appwrite/models/organization.rb | 24 +- lib/appwrite/models/policy_mfa_factors.rb | 47 ++++ lib/appwrite/models/project.rb | 5 + lib/appwrite/models/proxy_invalidation.rb | 42 +++ lib/appwrite/models/usage_billing_plan.rb | 18 +- lib/appwrite/services/account.rb | 34 +-- lib/appwrite/services/activities.rb | 2 +- lib/appwrite/services/apps.rb | 62 ++++- lib/appwrite/services/backups.rb | 20 +- lib/appwrite/services/databases.rb | 8 +- lib/appwrite/services/embeddings.rb | 48 ++++ lib/appwrite/services/functions.rb | 2 +- lib/appwrite/services/project.rb | 109 ++++---- lib/appwrite/services/proxy.rb | 44 +++ lib/appwrite/services/sites.rb | 2 +- lib/appwrite/services/storage.rb | 6 +- lib/appwrite/services/tables_db.rb | 254 +++++++++++++++++- lib/appwrite/services/users.rb | 38 +++ 68 files changed, 1325 insertions(+), 192 deletions(-) rename docs/examples/{account/create-jwt.md => apps/delete-installation.md} (68%) create mode 100644 docs/examples/embeddings/create-text-embeddings.md rename docs/examples/project/{create-key.md => update-mfa-factors-policy.md} (59%) create mode 100644 docs/examples/proxy/create-invalidation.md create mode 100644 docs/examples/tablesdb/create-migration.md create mode 100644 docs/examples/tablesdb/cutover-migration.md create mode 100644 docs/examples/tablesdb/delete-migration.md create mode 100644 docs/examples/tablesdb/get-migration.md create mode 100644 docs/examples/tablesdb/list-migrations.md create mode 100644 docs/examples/tablesdb/list-operations.md create mode 100644 docs/examples/users/get-mfa-challenge.md create mode 100644 lib/appwrite/enums/embedding_model.rb create mode 100644 lib/appwrite/enums/invalidation_type.rb create mode 100644 lib/appwrite/models/database_migration.rb create mode 100644 lib/appwrite/models/database_migration_list.rb create mode 100644 lib/appwrite/models/dedicated_database_operation.rb create mode 100644 lib/appwrite/models/dedicated_database_operation_list.rb create mode 100644 lib/appwrite/models/embedding.rb create mode 100644 lib/appwrite/models/embedding_list.rb create mode 100644 lib/appwrite/models/mfa_challenge_secret.rb create mode 100644 lib/appwrite/models/policy_mfa_factors.rb create mode 100644 lib/appwrite/models/proxy_invalidation.rb create mode 100644 lib/appwrite/services/embeddings.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index bdf22ea1..78e27c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## 27.0.0 + +* Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either +* Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke +* Breaking: `activities.listEvents` `queries` now takes an array instead of a string +* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum +* Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` +* Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum +* Added: `apps.deleteInstallation` +* Added: `users.getMFAChallenge` and the `MfaChallengeSecret` model +* Added: `project.updateMFAFactorsPolicy` and the `PolicyMfaFactors` model +* Added: `client.setOrganization` for organization-scoped requests +* Added: `folder` parameter to `storage.createFile` +* Added: `syncMode` parameter to `tablesDB.create` and `tablesDB.update`, and `specification` to `tablesDB.update` +* Added: `installationScopes` parameter to `project.updateOAuth2Server` +* Added: `custom` authentication factor, `node-26` runtime, `mfa-factors` project policy, and the `embeddings.write` and `proxy.invalidations.write` key scopes +* Updated: response format to `1.9.6` + ## 26.1.0 * Added: `Apps` service for managing OAuth2 applications, keys, and installations diff --git a/README.md b/README.md index 9b885056..5f92ccbc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Ruby SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.6-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite.gemspec b/appwrite.gemspec index bc428bcb..477ba729 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '26.1.0' + spec.version = '27.0.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md index 1d7fddd6..dd1ea354 100644 --- a/docs/examples/activities/list-events.md +++ b/docs/examples/activities/list-events.md @@ -11,6 +11,6 @@ client = Client.new activities = Activities.new(client) result = activities.list_events( - queries: '' # optional + queries: [] # optional ) ``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md index 7c71cecc..4a4ea253 100644 --- a/docs/examples/apps/create-installation-token.md +++ b/docs/examples/apps/create-installation-token.md @@ -6,7 +6,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint .set_project('') # Your project ID - .set_key('') # Your secret API key + .set_session('') # The user session to authenticate with apps = Apps.new(client) diff --git a/docs/examples/account/create-jwt.md b/docs/examples/apps/delete-installation.md similarity index 68% rename from docs/examples/account/create-jwt.md rename to docs/examples/apps/delete-installation.md index 2c722b01..d975728d 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/apps/delete-installation.md @@ -8,9 +8,10 @@ client = Client.new .set_project('') # Your project ID .set_session('') # The user session to authenticate with -account = Account.new(client) +apps = Apps.new(client) -result = account.create_jwt( - duration: 0 # optional +result = apps.delete_installation( + app_id: '', + installation_id: '' ) ``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md index 5db2961b..08a949cf 100644 --- a/docs/examples/apps/get-installation.md +++ b/docs/examples/apps/get-installation.md @@ -6,7 +6,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint .set_project('') # Your project ID - .set_key('') # Your secret API key + .set_session('') # The user session to authenticate with apps = Apps.new(client) diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md index da01dc8e..81becbcf 100644 --- a/docs/examples/apps/list-installations.md +++ b/docs/examples/apps/list-installations.md @@ -6,7 +6,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint .set_project('') # Your project ID - .set_key('') # Your secret API key + .set_session('') # The user session to authenticate with apps = Apps.new(client) diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md new file mode 100644 index 00000000..facbe573 --- /dev/null +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +embeddings = Embeddings.new(client) + +result = embeddings.create_text_embeddings( + texts: [], + model: EmbeddingModel::NOMIC_EMBED_TEXT # optional +) +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/update-mfa-factors-policy.md similarity index 59% rename from docs/examples/project/create-key.md rename to docs/examples/project/update-mfa-factors-policy.md index 0721a6b2..1849b161 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/update-mfa-factors-policy.md @@ -2,7 +2,6 @@ require 'appwrite' include Appwrite -include Appwrite::Enums client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -11,10 +10,10 @@ client = Client.new project = Project.new(client) -result = project.create_key( - key_id: '', - name: '', - scopes: [ProjectKeyScopes::PROJECT_READ], - expire: '2020-10-15T06:38:00.000+00:00' # optional +result = project.update_mfa_factors_policy( + totp: false, # optional + email: false, # optional + phone: false, # optional + custom: false # optional ) ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index 92a56d27..cfa1a0ab 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -25,6 +25,7 @@ result = project.update_o_auth2_server( user_code_length: 6, # optional user_code_format: 'numeric', # optional device_code_duration: 60, # optional - default_scopes: [] # optional + default_scopes: [], # optional + installation_scopes: [] # optional ) ``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md index 5a27a77c..ba8f1cb3 100644 --- a/docs/examples/project/update-session-duration-policy.md +++ b/docs/examples/project/update-session-duration-policy.md @@ -11,6 +11,6 @@ client = Client.new project = Project.new(client) result = project.update_session_duration_policy( - duration: 5 + duration: 60 ) ``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md index 1116435e..145906a3 100644 --- a/docs/examples/project/update-user-limit-policy.md +++ b/docs/examples/project/update-user-limit-policy.md @@ -11,6 +11,6 @@ client = Client.new project = Project.new(client) result = project.update_user_limit_policy( - total: 1 + total: 0 ) ``` diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md new file mode 100644 index 00000000..3b2858f4 --- /dev/null +++ b/docs/examples/proxy/create-invalidation.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +proxy = Proxy.new(client) + +result = proxy.create_invalidation( + domain: '', + type: InvalidationType::TAG, + reference: '' # optional +) +``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 0e03b082..cef34640 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -16,6 +16,7 @@ result = storage.create_file( bucket_id: '', file_id: '', file: InputFile.from_path('dir/file.png'), - permissions: [Permission.read(Role.any())] # optional + permissions: [Permission.read(Role.any())], # optional + folder: '' # optional ) ``` diff --git a/docs/examples/tablesdb/create-migration.md b/docs/examples/tablesdb/create-migration.md new file mode 100644 index 00000000..a7f085bd --- /dev/null +++ b/docs/examples/tablesdb/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_migration( + database_id: '', + specification: 's-1vcpu-1gb', + auto_cutover: false # optional +) +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 433b5b72..e68bb0a3 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -15,6 +15,7 @@ result = tables_db.create( name: '', enabled: false, # optional specification: 'serverless', # optional - replicas: 0 # optional + replicas: 0, # optional + sync_mode: 'async' # optional ) ``` diff --git a/docs/examples/tablesdb/cutover-migration.md b/docs/examples/tablesdb/cutover-migration.md new file mode 100644 index 00000000..62879a07 --- /dev/null +++ b/docs/examples/tablesdb/cutover-migration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.cutover_migration( + database_id: '', + migration_id: '' +) +``` diff --git a/docs/examples/tablesdb/delete-migration.md b/docs/examples/tablesdb/delete-migration.md new file mode 100644 index 00000000..d806b825 --- /dev/null +++ b/docs/examples/tablesdb/delete-migration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete_migration( + database_id: '', + migration_id: '' +) +``` diff --git a/docs/examples/tablesdb/get-migration.md b/docs/examples/tablesdb/get-migration.md new file mode 100644 index 00000000..5c9763fb --- /dev/null +++ b/docs/examples/tablesdb/get-migration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_migration( + database_id: '', + migration_id: '' +) +``` diff --git a/docs/examples/tablesdb/list-migrations.md b/docs/examples/tablesdb/list-migrations.md new file mode 100644 index 00000000..3d92f789 --- /dev/null +++ b/docs/examples/tablesdb/list-migrations.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_migrations( + database_id: '' +) +``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md new file mode 100644 index 00000000..ac41c176 --- /dev/null +++ b/docs/examples/tablesdb/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_operations( + database_id: '', + status: 'running', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 4257090a..d13b8caf 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -14,6 +14,8 @@ result = tables_db.update( database_id: '', name: '', # optional enabled: false, # optional - replicas: 0 # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional ) ``` diff --git a/docs/examples/users/get-mfa-challenge.md b/docs/examples/users/get-mfa-challenge.md new file mode 100644 index 00000000..dbdbad3b --- /dev/null +++ b/docs/examples/users/get-mfa-challenge.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +users = Users.new(client) + +result = users.get_mfa_challenge( + user_id: '', + challenge_id: '' +) +``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 03d3826f..64a08f3b 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -57,9 +57,11 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' +require_relative 'appwrite/models/embedding_list' require_relative 'appwrite/models/insight_list' require_relative 'appwrite/models/report_list' require_relative 'appwrite/models/database' +require_relative 'appwrite/models/embedding' require_relative 'appwrite/models/collection' require_relative 'appwrite/models/attribute_list' require_relative 'appwrite/models/attribute_string' @@ -194,6 +196,7 @@ require_relative 'appwrite/models/policy_session_limit' require_relative 'appwrite/models/policy_user_limit' require_relative 'appwrite/models/policy_membership_privacy' +require_relative 'appwrite/models/policy_mfa_factors' require_relative 'appwrite/models/platform_web' require_relative 'appwrite/models/platform_apple' require_relative 'appwrite/models/platform_android' @@ -211,6 +214,7 @@ require_relative 'appwrite/models/proxy_rule' require_relative 'appwrite/models/email_template' require_relative 'appwrite/models/mfa_challenge' +require_relative 'appwrite/models/mfa_challenge_secret' require_relative 'appwrite/models/mfa_recovery_codes' require_relative 'appwrite/models/mfa_type' require_relative 'appwrite/models/mfa_factors' @@ -234,10 +238,14 @@ require_relative 'appwrite/models/billing_plan_dedicated_database_limits' require_relative 'appwrite/models/billing_plan_supported_addons' require_relative 'appwrite/models/block' +require_relative 'appwrite/models/database_migration' require_relative 'appwrite/models/dedicated_database' require_relative 'appwrite/models/database_status' require_relative 'appwrite/models/dedicated_database_member' +require_relative 'appwrite/models/dedicated_database_operation' +require_relative 'appwrite/models/dedicated_database_operation_list' require_relative 'appwrite/models/dedicated_database_replicas' +require_relative 'appwrite/models/proxy_invalidation' require_relative 'appwrite/models/organization' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/policy_deny_aliased_email' @@ -278,6 +286,7 @@ require_relative 'appwrite/models/backup_archive_list' require_relative 'appwrite/models/backup_policy_list' require_relative 'appwrite/models/backup_restoration_list' +require_relative 'appwrite/models/database_migration_list' require_relative 'appwrite/models/apps_list' require_relative 'appwrite/models/app_secret_list' require_relative 'appwrite/models/app_scope_list' @@ -299,6 +308,7 @@ require_relative 'appwrite/enums/relation_mutate' require_relative 'appwrite/enums/databases_index_type' require_relative 'appwrite/enums/order_by' +require_relative 'appwrite/enums/embedding_model' require_relative 'appwrite/enums/runtime' require_relative 'appwrite/enums/project_key_scopes' require_relative 'appwrite/enums/template_reference_type' @@ -319,6 +329,7 @@ require_relative 'appwrite/enums/project_smtp_secure' require_relative 'appwrite/enums/project_email_template_id' require_relative 'appwrite/enums/project_email_template_locale' +require_relative 'appwrite/enums/invalidation_type' require_relative 'appwrite/enums/status_code' require_relative 'appwrite/enums/proxy_resource_type' require_relative 'appwrite/enums/framework' @@ -351,6 +362,7 @@ require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' +require_relative 'appwrite/services/embeddings' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index aeae118a..dfaae3a3 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,8 +15,8 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '26.1.0', - 'X-Appwrite-Response-Format' => '1.9.5' + 'x-sdk-version'=> '27.0.0', + 'X-Appwrite-Response-Format' => '1.9.6' } @endpoint = 'https://cloud.appwrite.io/v1' @config = {} @@ -49,6 +49,20 @@ def set_key(value) self end + # Set Organization + # + # Your organization ID + # + # @param [String] value The value to set for the Organization header + # + # @return [self] + def set_organization(value) + add_header('x-appwrite-organization', value) + @config['organization'] = value + + self + end + # Set JWT # # Your secret JSON Web Token diff --git a/lib/appwrite/enums/authentication_factor.rb b/lib/appwrite/enums/authentication_factor.rb index 8376b956..48669786 100644 --- a/lib/appwrite/enums/authentication_factor.rb +++ b/lib/appwrite/enums/authentication_factor.rb @@ -5,6 +5,7 @@ module AuthenticationFactor PHONE = 'phone' TOTP = 'totp' RECOVERYCODE = 'recoverycode' + CUSTOM = 'custom' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/build_runtime.rb b/lib/appwrite/enums/build_runtime.rb index 89f54786..ae67f362 100644 --- a/lib/appwrite/enums/build_runtime.rb +++ b/lib/appwrite/enums/build_runtime.rb @@ -11,6 +11,7 @@ module BuildRuntime NODE_23 = 'node-23' NODE_24 = 'node-24' NODE_25 = 'node-25' + NODE_26 = 'node-26' PHP_8_0 = 'php-8.0' PHP_8_1 = 'php-8.1' PHP_8_2 = 'php-8.2' diff --git a/lib/appwrite/enums/embedding_model.rb b/lib/appwrite/enums/embedding_model.rb new file mode 100644 index 00000000..7fce0ea6 --- /dev/null +++ b/lib/appwrite/enums/embedding_model.rb @@ -0,0 +1,10 @@ +module Appwrite + module Enums + module EmbeddingModel + NOMIC_EMBED_TEXT = 'nomic-embed-text' + EMBEDDING_GEMMA = 'embedding-gemma' + ALL_MINILM = 'all-minilm' + BGE_SMALL = 'bge-small' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/invalidation_type.rb b/lib/appwrite/enums/invalidation_type.rb new file mode 100644 index 00000000..d8fca7c9 --- /dev/null +++ b/lib/appwrite/enums/invalidation_type.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module InvalidationType + TAG = 'tag' + PATH = 'path' + ALL = 'all' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index a7ed8076..7a7670c9 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -35,6 +35,7 @@ module ProjectKeyScopes INDEXES_WRITE = 'indexes.write' ROWS_READ = 'rows.read' ROWS_WRITE = 'rows.write' + EMBEDDINGS_WRITE = 'embeddings.write' COLLECTIONS_READ = 'collections.read' COLLECTIONS_WRITE = 'collections.write' ATTRIBUTES_READ = 'attributes.read' @@ -99,6 +100,7 @@ module ProjectKeyScopes WAFRULES_READ = 'wafRules.read' WAFRULES_WRITE = 'wafRules.write' EVENTS_READ = 'events.read' + PROXY_INVALIDATIONS_WRITE = 'proxy.invalidations.write' APPS_READ = 'apps.read' APPS_WRITE = 'apps.write' OAUTH2_READ = 'oauth2.read' diff --git a/lib/appwrite/enums/project_policy_id.rb b/lib/appwrite/enums/project_policy_id.rb index 738292d4..d3052189 100644 --- a/lib/appwrite/enums/project_policy_id.rb +++ b/lib/appwrite/enums/project_policy_id.rb @@ -11,6 +11,7 @@ module ProjectPolicyId SESSION_LIMIT = 'session-limit' USER_LIMIT = 'user-limit' MEMBERSHIP_PRIVACY = 'membership-privacy' + MFA_FACTORS = 'mfa-factors' DENY_ALIASED_EMAIL = 'deny-aliased-email' DENY_DISPOSABLE_EMAIL = 'deny-disposable-email' DENY_FREE_EMAIL = 'deny-free-email' diff --git a/lib/appwrite/enums/runtime.rb b/lib/appwrite/enums/runtime.rb index 0fba21f2..bf2c4e20 100644 --- a/lib/appwrite/enums/runtime.rb +++ b/lib/appwrite/enums/runtime.rb @@ -11,6 +11,7 @@ module Runtime NODE_23 = 'node-23' NODE_24 = 'node-24' NODE_25 = 'node-25' + NODE_26 = 'node-26' PHP_8_0 = 'php-8.0' PHP_8_1 = 'php-8.1' PHP_8_2 = 'php-8.2' diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index aac36f6f..5e7bd7d8 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -84,7 +84,7 @@ def initialize( storage:, image_transformations:, screenshots_generated:, - members:, + members: , webhooks:, waf_rules:, projects:, @@ -108,7 +108,7 @@ def initialize( topics:, auth_phone:, domains:, - activity_logs:, + activity_logs: , usage_logs:, usage_logs_intervals: , project_inactivity_days:, @@ -132,10 +132,10 @@ def initialize( supports_free_email_validation:, supports_corporate_email_validation:, supports_project_specific_roles:, - backups_enabled:, + backups_enabled: , usage_per_project:, supported_addons:, - backup_policies:, + backup_policies: , deployment_size:, build_size:, databases_allow_encrypt:, diff --git a/lib/appwrite/models/billing_plan_addon.rb b/lib/appwrite/models/billing_plan_addon.rb index 5569f8a5..b128cf19 100644 --- a/lib/appwrite/models/billing_plan_addon.rb +++ b/lib/appwrite/models/billing_plan_addon.rb @@ -7,8 +7,8 @@ class BillingPlanAddon attr_reader :projects def initialize( - seats:, - projects: + seats: , + projects: ) @seats = seats @projects = projects @@ -16,15 +16,15 @@ def initialize( def self.from(map:) BillingPlanAddon.new( - seats: BillingPlanAddonDetails.from(map: map["seats"]), - projects: BillingPlanAddonDetails.from(map: map["projects"]) + seats: map["seats"].nil? ? nil : BillingPlanAddonDetails.from(map: map["seats"]), + projects: map["projects"].nil? ? nil : BillingPlanAddonDetails.from(map: map["projects"]) ) end def to_map { - "seats": @seats.to_map, - "projects": @projects.to_map + "seats": @seats&.to_map, + "projects": @projects&.to_map } end end diff --git a/lib/appwrite/models/billing_plan_addon_details.rb b/lib/appwrite/models/billing_plan_addon_details.rb index 7ca96ab1..72335b4c 100644 --- a/lib/appwrite/models/billing_plan_addon_details.rb +++ b/lib/appwrite/models/billing_plan_addon_details.rb @@ -17,7 +17,7 @@ def initialize( plan_included:, limit:, type:, - currency:, + currency: , price:, value:, invoice_desc: diff --git a/lib/appwrite/models/database_migration.rb b/lib/appwrite/models/database_migration.rb new file mode 100644 index 00000000..afd0ce65 --- /dev/null +++ b/lib/appwrite/models/database_migration.rb @@ -0,0 +1,102 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseMigration + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :project_id + attr_reader :database_id + attr_reader :specification + attr_reader :phase + attr_reader :attempt + attr_reader :last_error + attr_reader :lag_documents + attr_reader :verified_at + attr_reader :cutover_at + attr_reader :soak_until + attr_reader :auto_cutover + attr_reader :cutover_requested + attr_reader :paused + + def initialize( + id:, + created_at:, + updated_at:, + project_id:, + database_id:, + specification:, + phase:, + attempt:, + last_error:, + lag_documents:, + verified_at:, + cutover_at:, + soak_until:, + auto_cutover:, + cutover_requested:, + paused: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @project_id = project_id + @database_id = database_id + @specification = specification + @phase = phase + @attempt = attempt + @last_error = last_error + @lag_documents = lag_documents + @verified_at = verified_at + @cutover_at = cutover_at + @soak_until = soak_until + @auto_cutover = auto_cutover + @cutover_requested = cutover_requested + @paused = paused + end + + def self.from(map:) + DatabaseMigration.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + project_id: map["projectId"], + database_id: map["databaseId"], + specification: map["specification"], + phase: map["phase"], + attempt: map["attempt"], + last_error: map["lastError"], + lag_documents: map["lagDocuments"], + verified_at: map["verifiedAt"], + cutover_at: map["cutoverAt"], + soak_until: map["soakUntil"], + auto_cutover: map["autoCutover"], + cutover_requested: map["cutoverRequested"], + paused: map["paused"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "projectId": @project_id, + "databaseId": @database_id, + "specification": @specification, + "phase": @phase, + "attempt": @attempt, + "lastError": @last_error, + "lagDocuments": @lag_documents, + "verifiedAt": @verified_at, + "cutoverAt": @cutover_at, + "soakUntil": @soak_until, + "autoCutover": @auto_cutover, + "cutoverRequested": @cutover_requested, + "paused": @paused + } + end + end + end +end diff --git a/lib/appwrite/models/database_migration_list.rb b/lib/appwrite/models/database_migration_list.rb new file mode 100644 index 00000000..aa238ba0 --- /dev/null +++ b/lib/appwrite/models/database_migration_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DatabaseMigrationList + attr_reader :total + attr_reader :migrations + + def initialize( + total:, + migrations: + ) + @total = total + @migrations = migrations + end + + def self.from(map:) + DatabaseMigrationList.new( + total: map["total"], + migrations: map["migrations"].map { |it| DatabaseMigration.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "migrations": @migrations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/database_status.rb b/lib/appwrite/models/database_status.rb index 3807f173..4ed60bf7 100644 --- a/lib/appwrite/models/database_status.rb +++ b/lib/appwrite/models/database_status.rb @@ -9,6 +9,12 @@ class DatabaseStatus attr_reader :version attr_reader :uptime attr_reader :connections + attr_reader :sync_mode + attr_reader :effective_sync_mode + attr_reader :sync_degraded + attr_reader :sync_acknowledgements + attr_reader :sync_standby_count + attr_reader :sync_state_confirmed attr_reader :replicas attr_reader :volumes @@ -19,6 +25,12 @@ def initialize( version:, uptime:, connections:, + sync_mode:, + effective_sync_mode: , + sync_degraded:, + sync_acknowledgements:, + sync_standby_count:, + sync_state_confirmed: , replicas:, volumes: ) @@ -28,6 +40,12 @@ def initialize( @version = version @uptime = uptime @connections = connections + @sync_mode = sync_mode + @effective_sync_mode = effective_sync_mode + @sync_degraded = sync_degraded + @sync_acknowledgements = sync_acknowledgements + @sync_standby_count = sync_standby_count + @sync_state_confirmed = sync_state_confirmed @replicas = replicas @volumes = volumes end @@ -40,6 +58,12 @@ def self.from(map:) version: map["version"], uptime: map["uptime"], connections: DatabaseStatusConnections.from(map: map["connections"]), + sync_mode: map["syncMode"], + effective_sync_mode: map["effectiveSyncMode"], + sync_degraded: map["syncDegraded"], + sync_acknowledgements: map["syncAcknowledgements"], + sync_standby_count: map["syncStandbyCount"], + sync_state_confirmed: map["syncStateConfirmed"], replicas: map["replicas"].map { |it| DatabaseStatusReplica.from(map: it) }, volumes: map["volumes"].map { |it| DatabaseStatusVolume.from(map: it) } ) @@ -53,6 +77,12 @@ def to_map "version": @version, "uptime": @uptime, "connections": @connections.to_map, + "syncMode": @sync_mode, + "effectiveSyncMode": @effective_sync_mode, + "syncDegraded": @sync_degraded, + "syncAcknowledgements": @sync_acknowledgements, + "syncStandbyCount": @sync_standby_count, + "syncStateConfirmed": @sync_state_confirmed, "replicas": @replicas.map { |it| it.to_map }, "volumes": @volumes.map { |it| it.to_map } } diff --git a/lib/appwrite/models/dedicated_database.rb b/lib/appwrite/models/dedicated_database.rb index 43d3e8d8..d53b19fa 100644 --- a/lib/appwrite/models/dedicated_database.rb +++ b/lib/appwrite/models/dedicated_database.rb @@ -33,7 +33,6 @@ class DedicatedDatabase attr_reader :node_pool attr_reader :replicas attr_reader :sync_mode - attr_reader :cross_region_replicas attr_reader :network_max_connections attr_reader :network_idle_timeout_seconds attr_reader :network_ip_allowlist @@ -84,7 +83,6 @@ def initialize( node_pool:, replicas:, sync_mode:, - cross_region_replicas:, network_max_connections:, network_idle_timeout_seconds:, network_ip_allowlist:, @@ -134,7 +132,6 @@ def initialize( @node_pool = node_pool @replicas = replicas @sync_mode = sync_mode - @cross_region_replicas = cross_region_replicas @network_max_connections = network_max_connections @network_idle_timeout_seconds = network_idle_timeout_seconds @network_ip_allowlist = network_ip_allowlist @@ -187,7 +184,6 @@ def self.from(map:) node_pool: map["nodePool"], replicas: map["replicas"], sync_mode: map["syncMode"], - cross_region_replicas: map["crossRegionReplicas"], network_max_connections: map["networkMaxConnections"], network_idle_timeout_seconds: map["networkIdleTimeoutSeconds"], network_ip_allowlist: map["networkIPAllowlist"], @@ -241,7 +237,6 @@ def to_map "nodePool": @node_pool, "replicas": @replicas, "syncMode": @sync_mode, - "crossRegionReplicas": @cross_region_replicas, "networkMaxConnections": @network_max_connections, "networkIdleTimeoutSeconds": @network_idle_timeout_seconds, "networkIPAllowlist": @network_ip_allowlist, diff --git a/lib/appwrite/models/dedicated_database_member.rb b/lib/appwrite/models/dedicated_database_member.rb index 3f88817b..dcb0a6d8 100644 --- a/lib/appwrite/models/dedicated_database_member.rb +++ b/lib/appwrite/models/dedicated_database_member.rb @@ -12,7 +12,7 @@ def initialize( id:, role:, status:, - lag_seconds: + lag_seconds: ) @id = id @role = role diff --git a/lib/appwrite/models/dedicated_database_operation.rb b/lib/appwrite/models/dedicated_database_operation.rb new file mode 100644 index 00000000..b5f9d8b0 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_operation.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseOperation + attr_reader :id + attr_reader :created_at + attr_reader :database_id + attr_reader :type + attr_reader :status + attr_reader :attempts + attr_reader :requested_at + attr_reader :started_at + attr_reader :completed_at + attr_reader :error_code + attr_reader :error_message + + def initialize( + id:, + created_at:, + database_id:, + type:, + status:, + attempts:, + requested_at: , + started_at: , + completed_at: , + error_code:, + error_message: + ) + @id = id + @created_at = created_at + @database_id = database_id + @type = type + @status = status + @attempts = attempts + @requested_at = requested_at + @started_at = started_at + @completed_at = completed_at + @error_code = error_code + @error_message = error_message + end + + def self.from(map:) + DedicatedDatabaseOperation.new( + id: map["$id"], + created_at: map["$createdAt"], + database_id: map["databaseId"], + type: map["type"], + status: map["status"], + attempts: map["attempts"], + requested_at: map["requestedAt"], + started_at: map["startedAt"], + completed_at: map["completedAt"], + error_code: map["errorCode"], + error_message: map["errorMessage"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "databaseId": @database_id, + "type": @type, + "status": @status, + "attempts": @attempts, + "requestedAt": @requested_at, + "startedAt": @started_at, + "completedAt": @completed_at, + "errorCode": @error_code, + "errorMessage": @error_message + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_operation_list.rb b/lib/appwrite/models/dedicated_database_operation_list.rb new file mode 100644 index 00000000..8ed7a8c1 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_operation_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseOperationList + attr_reader :total + attr_reader :operations + + def initialize( + total:, + operations: + ) + @total = total + @operations = operations + end + + def self.from(map:) + DedicatedDatabaseOperationList.new( + total: map["total"], + operations: map["operations"].map { |it| DedicatedDatabaseOperation.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "operations": @operations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_replicas.rb b/lib/appwrite/models/dedicated_database_replicas.rb index 3cbdc5cc..7773340a 100644 --- a/lib/appwrite/models/dedicated_database_replicas.rb +++ b/lib/appwrite/models/dedicated_database_replicas.rb @@ -5,15 +5,30 @@ module Models class DedicatedDatabaseReplicas attr_reader :replicas attr_reader :sync_mode + attr_reader :effective_sync_mode + attr_reader :sync_degraded + attr_reader :sync_acknowledgements + attr_reader :sync_standby_count + attr_reader :sync_state_confirmed attr_reader :members def initialize( replicas:, sync_mode:, + effective_sync_mode: , + sync_degraded:, + sync_acknowledgements:, + sync_standby_count:, + sync_state_confirmed: , members: ) @replicas = replicas @sync_mode = sync_mode + @effective_sync_mode = effective_sync_mode + @sync_degraded = sync_degraded + @sync_acknowledgements = sync_acknowledgements + @sync_standby_count = sync_standby_count + @sync_state_confirmed = sync_state_confirmed @members = members end @@ -21,6 +36,11 @@ def self.from(map:) DedicatedDatabaseReplicas.new( replicas: map["replicas"], sync_mode: map["syncMode"], + effective_sync_mode: map["effectiveSyncMode"], + sync_degraded: map["syncDegraded"], + sync_acknowledgements: map["syncAcknowledgements"], + sync_standby_count: map["syncStandbyCount"], + sync_state_confirmed: map["syncStateConfirmed"], members: map["members"].map { |it| DedicatedDatabaseMember.from(map: it) } ) end @@ -29,6 +49,11 @@ def to_map { "replicas": @replicas, "syncMode": @sync_mode, + "effectiveSyncMode": @effective_sync_mode, + "syncDegraded": @sync_degraded, + "syncAcknowledgements": @sync_acknowledgements, + "syncStandbyCount": @sync_standby_count, + "syncStateConfirmed": @sync_state_confirmed, "members": @members.map { |it| it.to_map } } end diff --git a/lib/appwrite/models/dedicated_database_specification_pricing.rb b/lib/appwrite/models/dedicated_database_specification_pricing.rb index ed68de88..e9a679b7 100644 --- a/lib/appwrite/models/dedicated_database_specification_pricing.rb +++ b/lib/appwrite/models/dedicated_database_specification_pricing.rb @@ -6,20 +6,17 @@ class DedicatedDatabaseSpecificationPricing attr_reader :storage_overage_rate attr_reader :bandwidth_overage_rate attr_reader :replica_rate - attr_reader :cross_region_replica_rate attr_reader :pitr_rate def initialize( storage_overage_rate:, bandwidth_overage_rate:, replica_rate:, - cross_region_replica_rate:, pitr_rate: ) @storage_overage_rate = storage_overage_rate @bandwidth_overage_rate = bandwidth_overage_rate @replica_rate = replica_rate - @cross_region_replica_rate = cross_region_replica_rate @pitr_rate = pitr_rate end @@ -28,7 +25,6 @@ def self.from(map:) storage_overage_rate: map["storageOverageRate"], bandwidth_overage_rate: map["bandwidthOverageRate"], replica_rate: map["replicaRate"], - cross_region_replica_rate: map["crossRegionReplicaRate"], pitr_rate: map["pitrRate"] ) end @@ -38,7 +34,6 @@ def to_map "storageOverageRate": @storage_overage_rate, "bandwidthOverageRate": @bandwidth_overage_rate, "replicaRate": @replica_rate, - "crossRegionReplicaRate": @cross_region_replica_rate, "pitrRate": @pitr_rate } end diff --git a/lib/appwrite/models/embedding.rb b/lib/appwrite/models/embedding.rb new file mode 100644 index 00000000..991b6e57 --- /dev/null +++ b/lib/appwrite/models/embedding.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Embedding + attr_reader :model + attr_reader :dimension + attr_reader :embedding + attr_reader :error + + def initialize( + model:, + dimension:, + embedding:, + error: + ) + @model = model + @dimension = dimension + @embedding = embedding + @error = error + end + + def self.from(map:) + Embedding.new( + model: map["model"], + dimension: map["dimension"], + embedding: map["embedding"], + error: map["error"] + ) + end + + def to_map + { + "model": @model, + "dimension": @dimension, + "embedding": @embedding, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/embedding_list.rb b/lib/appwrite/models/embedding_list.rb new file mode 100644 index 00000000..770ca0e5 --- /dev/null +++ b/lib/appwrite/models/embedding_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class EmbeddingList + attr_reader :total + attr_reader :embeddings + + def initialize( + total:, + embeddings: + ) + @total = total + @embeddings = embeddings + end + + def self.from(map:) + EmbeddingList.new( + total: map["total"], + embeddings: map["embeddings"].map { |it| Embedding.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "embeddings": @embeddings.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/file.rb b/lib/appwrite/models/file.rb index a356c10a..525a88b3 100644 --- a/lib/appwrite/models/file.rb +++ b/lib/appwrite/models/file.rb @@ -9,6 +9,8 @@ class File attr_reader :updated_at attr_reader :permissions attr_reader :name + attr_reader :folder + attr_reader :key attr_reader :signature attr_reader :mime_type attr_reader :size_original @@ -25,6 +27,8 @@ def initialize( updated_at:, permissions:, name:, + folder:, + key:, signature:, mime_type:, size_original:, @@ -40,6 +44,8 @@ def initialize( @updated_at = updated_at @permissions = permissions @name = name + @folder = folder + @key = key @signature = signature @mime_type = mime_type @size_original = size_original @@ -58,6 +64,8 @@ def self.from(map:) updated_at: map["$updatedAt"], permissions: map["$permissions"], name: map["name"], + folder: map["folder"], + key: map["key"], signature: map["signature"], mime_type: map["mimeType"], size_original: map["sizeOriginal"], @@ -77,6 +85,8 @@ def to_map "$updatedAt": @updated_at, "$permissions": @permissions, "name": @name, + "folder": @folder, + "key": @key, "signature": @signature, "mimeType": @mime_type, "sizeOriginal": @size_original, diff --git a/lib/appwrite/models/mfa_challenge_secret.rb b/lib/appwrite/models/mfa_challenge_secret.rb new file mode 100644 index 00000000..e17abe4c --- /dev/null +++ b/lib/appwrite/models/mfa_challenge_secret.rb @@ -0,0 +1,47 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class MfaChallengeSecret + attr_reader :id + attr_reader :created_at + attr_reader :user_id + attr_reader :expire + attr_reader :code + + def initialize( + id:, + created_at:, + user_id:, + expire:, + code: + ) + @id = id + @created_at = created_at + @user_id = user_id + @expire = expire + @code = code + end + + def self.from(map:) + MfaChallengeSecret.new( + id: map["$id"], + created_at: map["$createdAt"], + user_id: map["userId"], + expire: map["expire"], + code: map["code"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "userId": @user_id, + "expire": @expire, + "code": @code + } + end + end + end +end diff --git a/lib/appwrite/models/mfa_factors.rb b/lib/appwrite/models/mfa_factors.rb index 583bba0e..ed0d6e1e 100644 --- a/lib/appwrite/models/mfa_factors.rb +++ b/lib/appwrite/models/mfa_factors.rb @@ -7,17 +7,20 @@ class MfaFactors attr_reader :phone attr_reader :email attr_reader :recovery_code + attr_reader :custom def initialize( totp:, phone:, email:, - recovery_code: + recovery_code:, + custom: ) @totp = totp @phone = phone @email = email @recovery_code = recovery_code + @custom = custom end def self.from(map:) @@ -25,7 +28,8 @@ def self.from(map:) totp: map["totp"], phone: map["phone"], email: map["email"], - recovery_code: map["recoveryCode"] + recovery_code: map["recoveryCode"], + custom: map["custom"] ) end @@ -34,7 +38,8 @@ def to_map "totp": @totp, "phone": @phone, "email": @email, - "recoveryCode": @recovery_code + "recoveryCode": @recovery_code, + "custom": @custom } end end diff --git a/lib/appwrite/models/organization.rb b/lib/appwrite/models/organization.rb index 2cdbe8e0..d3aa9fe9 100644 --- a/lib/appwrite/models/organization.rb +++ b/lib/appwrite/models/organization.rb @@ -46,7 +46,7 @@ def initialize( name:, total:, prefs:, - billing_budget:, + billing_budget: , budget_alerts:, billing_plan:, billing_plan_id:, @@ -55,23 +55,23 @@ def initialize( billing_start_date:, billing_current_invoice_date:, billing_next_invoice_date:, - billing_trial_start_date:, + billing_trial_start_date: , billing_trial_days:, billing_aggregation_id:, billing_invoice_id:, payment_method_id:, - billing_address_id:, - backup_payment_method_id:, + billing_address_id: , + backup_payment_method_id: , status:, - remarks:, - agreement_baa:, - program_manager_name:, - program_manager_calendar:, - program_discord_channel_name:, - program_discord_channel_url:, + remarks: , + agreement_baa: , + program_manager_name: , + program_manager_calendar: , + program_discord_channel_name: , + program_discord_channel_url: , billing_limits: , - billing_plan_downgrade:, - billing_tax_id:, + billing_plan_downgrade: , + billing_tax_id: , marked_for_deletion:, platform:, projects: diff --git a/lib/appwrite/models/policy_mfa_factors.rb b/lib/appwrite/models/policy_mfa_factors.rb new file mode 100644 index 00000000..158c12ff --- /dev/null +++ b/lib/appwrite/models/policy_mfa_factors.rb @@ -0,0 +1,47 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class PolicyMfaFactors + attr_reader :id + attr_reader :totp + attr_reader :email + attr_reader :phone + attr_reader :custom + + def initialize( + id:, + totp:, + email:, + phone:, + custom: + ) + @id = id + @totp = totp + @email = email + @phone = phone + @custom = custom + end + + def self.from(map:) + PolicyMfaFactors.new( + id: map["$id"], + totp: map["totp"], + email: map["email"], + phone: map["phone"], + custom: map["custom"] + ) + end + + def to_map + { + "$id": @id, + "totp": @totp, + "email": @email, + "phone": @phone, + "custom": @custom + } + end + end + end +end diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index 94f7bb10..bf6fc02e 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -36,6 +36,7 @@ class Project attr_reader :o_auth2_server_authorization_url attr_reader :o_auth2_server_scopes attr_reader :o_auth2_server_default_scopes + attr_reader :o_auth2_server_installation_scopes attr_reader :o_auth2_server_authorization_details_types attr_reader :o_auth2_server_access_token_duration attr_reader :o_auth2_server_refresh_token_duration @@ -83,6 +84,7 @@ def initialize( o_auth2_server_authorization_url: , o_auth2_server_scopes: , o_auth2_server_default_scopes: , + o_auth2_server_installation_scopes: , o_auth2_server_authorization_details_types: , o_auth2_server_access_token_duration: , o_auth2_server_refresh_token_duration: , @@ -129,6 +131,7 @@ def initialize( @o_auth2_server_authorization_url = o_auth2_server_authorization_url @o_auth2_server_scopes = o_auth2_server_scopes @o_auth2_server_default_scopes = o_auth2_server_default_scopes + @o_auth2_server_installation_scopes = o_auth2_server_installation_scopes @o_auth2_server_authorization_details_types = o_auth2_server_authorization_details_types @o_auth2_server_access_token_duration = o_auth2_server_access_token_duration @o_auth2_server_refresh_token_duration = o_auth2_server_refresh_token_duration @@ -178,6 +181,7 @@ def self.from(map:) o_auth2_server_authorization_url: map["oAuth2ServerAuthorizationUrl"], o_auth2_server_scopes: map["oAuth2ServerScopes"], o_auth2_server_default_scopes: map["oAuth2ServerDefaultScopes"], + o_auth2_server_installation_scopes: map["oAuth2ServerInstallationScopes"], o_auth2_server_authorization_details_types: map["oAuth2ServerAuthorizationDetailsTypes"], o_auth2_server_access_token_duration: map["oAuth2ServerAccessTokenDuration"], o_auth2_server_refresh_token_duration: map["oAuth2ServerRefreshTokenDuration"], @@ -228,6 +232,7 @@ def to_map "oAuth2ServerAuthorizationUrl": @o_auth2_server_authorization_url, "oAuth2ServerScopes": @o_auth2_server_scopes, "oAuth2ServerDefaultScopes": @o_auth2_server_default_scopes, + "oAuth2ServerInstallationScopes": @o_auth2_server_installation_scopes, "oAuth2ServerAuthorizationDetailsTypes": @o_auth2_server_authorization_details_types, "oAuth2ServerAccessTokenDuration": @o_auth2_server_access_token_duration, "oAuth2ServerRefreshTokenDuration": @o_auth2_server_refresh_token_duration, diff --git a/lib/appwrite/models/proxy_invalidation.rb b/lib/appwrite/models/proxy_invalidation.rb new file mode 100644 index 00000000..d87b4b19 --- /dev/null +++ b/lib/appwrite/models/proxy_invalidation.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ProxyInvalidation + attr_reader :domain + attr_reader :type + attr_reader :reference + attr_reader :status + + def initialize( + domain:, + type:, + reference:, + status: + ) + @domain = domain + @type = type + @reference = reference + @status = status + end + + def self.from(map:) + ProxyInvalidation.new( + domain: map["domain"], + type: map["type"], + reference: map["reference"], + status: map["status"] + ) + end + + def to_map + { + "domain": @domain, + "type": @type, + "reference": @reference, + "status": @status + } + end + end + end +end diff --git a/lib/appwrite/models/usage_billing_plan.rb b/lib/appwrite/models/usage_billing_plan.rb index ec694844..23521586 100644 --- a/lib/appwrite/models/usage_billing_plan.rb +++ b/lib/appwrite/models/usage_billing_plan.rb @@ -18,15 +18,15 @@ class UsageBillingPlan def initialize( bandwidth:, executions:, - member:, + member: , realtime:, realtime_messages:, - realtime_bandwidth:, + realtime_bandwidth: , storage:, users:, gb_hours:, image_transformations:, - credits: + credits: ) @bandwidth = bandwidth @executions = executions @@ -45,15 +45,15 @@ def self.from(map:) UsageBillingPlan.new( bandwidth: AdditionalResource.from(map: map["bandwidth"]), executions: AdditionalResource.from(map: map["executions"]), - member: AdditionalResource.from(map: map["member"]), + member: map["member"].nil? ? nil : AdditionalResource.from(map: map["member"]), realtime: AdditionalResource.from(map: map["realtime"]), realtime_messages: AdditionalResource.from(map: map["realtimeMessages"]), - realtime_bandwidth: AdditionalResource.from(map: map["realtimeBandwidth"]), + realtime_bandwidth: map["realtimeBandwidth"].nil? ? nil : AdditionalResource.from(map: map["realtimeBandwidth"]), storage: AdditionalResource.from(map: map["storage"]), users: AdditionalResource.from(map: map["users"]), gb_hours: AdditionalResource.from(map: map["GBHours"]), image_transformations: AdditionalResource.from(map: map["imageTransformations"]), - credits: AdditionalResource.from(map: map["credits"]) + credits: map["credits"].nil? ? nil : AdditionalResource.from(map: map["credits"]) ) end @@ -61,15 +61,15 @@ def to_map { "bandwidth": @bandwidth.to_map, "executions": @executions.to_map, - "member": @member.to_map, + "member": @member&.to_map, "realtime": @realtime.to_map, "realtimeMessages": @realtime_messages.to_map, - "realtimeBandwidth": @realtime_bandwidth.to_map, + "realtimeBandwidth": @realtime_bandwidth&.to_map, "storage": @storage.to_map, "users": @users.to_map, "GBHours": @gb_hours.to_map, "imageTransformations": @image_transformations.to_map, - "credits": @credits.to_map + "credits": @credits&.to_map } end end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index b917162f..7b2bcb73 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -397,38 +397,6 @@ def delete_identity(identity_id:) end - # Use this endpoint to create a JSON Web Token. You can use the resulting JWT - # to authenticate on behalf of the current user when working with the - # Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes - # from its creation and will be invalid if the user will logout in that time - # frame. - # - # @param [Integer] duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - # - # @return [Jwt] - def create_jwt(duration: nil) - api_path = '/account/jwts' - - api_params = { - duration: duration, - } - - 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::Jwt - ) - - end - # Get the list of latest security activity logs for the currently logged in # user. Each log returns user IP address, location and date and time of log. # @@ -600,7 +568,7 @@ def delete_mfa_authenticator(type:) # [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) # method. # - # @param [AuthenticationFactor] factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + # @param [AuthenticationFactor] factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. # # @return [MfaChallenge] def create_mfa_challenge(factor:) diff --git a/lib/appwrite/services/activities.rb b/lib/appwrite/services/activities.rb index e14db113..27b91242 100644 --- a/lib/appwrite/services/activities.rb +++ b/lib/appwrite/services/activities.rb @@ -9,7 +9,7 @@ def initialize(client) # List all events for selected filters. # - # @param [String] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. # # @return [ActivityEventList] def list_events(queries: nil) diff --git a/lib/appwrite/services/apps.rb b/lib/appwrite/services/apps.rb index bc96e462..b55b8d88 100644 --- a/lib/appwrite/services/apps.rb +++ b/lib/appwrite/services/apps.rb @@ -164,7 +164,7 @@ def list_o_auth2_scopes() # Get an application by its unique ID. # - # @param [String] app_id Application unique ID or HTTPS client ID metadata document URL. + # @param [String] app_id Application unique ID. # # @return [App] def get(app_id:) @@ -213,7 +213,7 @@ def get(app_id:) # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - # @param [Array] installation_scopes Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. # @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. # # @return [App] @@ -299,7 +299,8 @@ def delete(app_id:) end # List installations of an application. Requires an app key sent in the - # `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + # `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller + # with update access to the app. # # @param [String] app_id Application unique ID. # @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. @@ -335,7 +336,8 @@ def list_installations(app_id:, queries: nil, total: nil) end # Get an installation of an application by its unique ID. Requires an app key - # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, + # or a caller with update access to the app. # # @param [String] app_id Application unique ID. # @param [String] installation_id Installation unique ID. @@ -372,13 +374,53 @@ def get_installation(app_id:, installation_id:) end + # Delete an installation of an application by its unique ID. Requires a + # caller with update access to the app. Previously issued installation access + # tokens are revoked. + # + # @param [String] app_id Application unique ID. + # @param [String] installation_id Installation unique ID. + # + # @return [] + def delete_installation(app_id:, installation_id:) + api_path = '/apps/{appId}/installations/{installationId}' + .gsub('{appId}', app_id) + .gsub('{installationId}', installation_id) + + if app_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "appId"') + end + + 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 + # Create a token for an installation of an application. Requires an app key - # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. - # The returned token carries the scopes and authorization details granted to - # the installation, and can be used as an `Authorization: Bearer` header - # everywhere OAuth2 access tokens are accepted. Multiple tokens can be active - # for the same installation at once; each token stays valid until it expires - # or the installation is updated or deleted. + # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, + # or a caller with update access to the app. The returned token carries the + # scopes and authorization details granted to the installation, and can be + # used as an `Authorization: Bearer` header everywhere OAuth2 access tokens + # are accepted. Multiple tokens can be active for the same installation at + # once; each token stays valid until it expires or the installation is + # updated or deleted. # # @param [String] app_id Application unique ID. # @param [String] installation_id Installation unique ID. diff --git a/lib/appwrite/services/backups.rb b/lib/appwrite/services/backups.rb index f923d951..10a8b3eb 100644 --- a/lib/appwrite/services/backups.rb +++ b/lib/appwrite/services/backups.rb @@ -318,9 +318,10 @@ def delete_policy(policy_id:) # Create and trigger a new restoration for a backup on a project. # # For a backup of one database, the restoration resolves its destination - # before it is queued. Pass `newResourceId` to restore into that database ID, - # including the archived database ID to overwrite it. When `newResourceId` is - # omitted, a new database ID is generated and returned in `options`. + # before it is queued. When `newResourceId` is omitted, the archived database + # is restored in place and its own ID is returned in `options`. Pass a + # different `newResourceId` to restore alongside it as a new database + # instead. # # The restoration migration records the archived database in `resourceId` and # `resourceType`, and the resolved database in `destinationResourceId` and @@ -337,14 +338,19 @@ def delete_policy(policy_id:) # operational `resourceType` of a table migration is not rewritten to # `tablesdb`. # - # When restoring a DocumentsDB or VectorsDB database to a new resource from a - # dedicated source, the restore provisions a fresh dedicated backing database - # at the source database's own specification. + # When restoring a DocumentsDB or VectorsDB database from a dedicated source, + # the restore provisions a fresh dedicated backing database at the source + # database's own specification and lands the data there. An in-place restore + # swaps the database onto that backing only once the restore has succeeded, + # and retires the backing it displaced only once that swap is confirmed, so + # the source keeps serving its own data until the restored data is in place + # and any failure leaves it untouched. A serverless source has no dedicated + # backing to clone and restores onto the archived database instead. # # # @param [String] archive_id Backup archive ID to restore # @param [Array] services Array of services to restore - # @param [String] new_resource_id Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] new_resource_name Database name. Max length: 128 chars. # # @return [BackupRestoration] diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index c4f6341c..57466163 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -453,7 +453,7 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) # @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). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + # @param [Array] attributes Array of attribute definitions to create. Each attribute 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. # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Collection] @@ -2275,11 +2275,11 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [String] related_collection_id Related Collection ID. - # @param [RelationshipType] type Relation type + # @param [RelationshipType] type Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. # @param [] two_way Is Two Way? # @param [String] key Attribute Key. # @param [String] two_way_key Two Way Attribute Key. - # @param [RelationMutate] on_delete Constraints option + # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [AttributeRelationship] def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) @@ -2338,7 +2338,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. - # @param [RelationMutate] on_delete Constraints option + # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # @param [String] new_key New Attribute Key. # # @return [AttributeRelationship] diff --git a/lib/appwrite/services/embeddings.rb b/lib/appwrite/services/embeddings.rb new file mode 100644 index 00000000..5056314f --- /dev/null +++ b/lib/appwrite/services/embeddings.rb @@ -0,0 +1,48 @@ +#frozen_string_literal: true + +module Appwrite + class Embeddings < Service + + def initialize(client) + @client = client + end + + # Generate vector embeddings for an array of text using the selected + # embedding model. Use the returned vectors to power semantic search and + # similarity queries against your vector collections. + # + # + # @param [Array] texts Array of text to generate embeddings. + # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings. + # + # @return [EmbeddingList] + def create_text_embeddings(texts:, model: nil) + api_path = '/embeddings/text' + + if texts.nil? + raise Appwrite::Exception.new('Missing required parameter: "texts"') + end + + api_params = { + texts: texts, + model: model, + } + + 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::EmbeddingList + ) + + end + + end +end diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index 20132479..c0a16a74 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -151,7 +151,7 @@ def list_runtimes() # List allowed function specifications for this instance. # - # @param [String] type Specification type to list. Can be one of: runtimes, builds. + # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] def list_specifications(type: nil) diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index d1eee8ff..ada33927 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -123,56 +123,6 @@ def list_keys(queries: nil, total: nil) end - # Create a new API key. It's recommended to have multiple API keys with - # strict scopes for separate functions within your project. - # - # You can also create an ephemeral API key if you need a short-lived key - # instead. - # - # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] name Key name. Max length: 128 chars. - # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. - # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - # - # @return [Key] - def create_key(key_id:, name:, scopes:, expire: nil) - api_path = '/project/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 a new ephemeral API key. It's recommended to have multiple API keys # with strict scopes for separate functions within your project. # @@ -576,9 +526,10 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [String] user_code_format Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. # @param [Integer] device_code_duration Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. # @param [Array] default_scopes List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. + # @param [Array] installation_scopes List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long. # # @return [Project] - def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil) + def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil, installation_scopes: nil) api_path = '/project/oauth2-server' if enabled.nil? @@ -605,6 +556,7 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati userCodeFormat: user_code_format, deviceCodeDuration: device_code_duration, defaultScopes: default_scopes, + installationScopes: installation_scopes, } api_headers = { @@ -3051,6 +3003,44 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: end + # Updating this policy allows you to control which factors users can use to + # complete an MFA challenge. Disabled factors cannot be used to create a + # challenge and are reported as unavailable when listing factors. The custom + # factor is disabled by default; enable it to deliver challenge codes through + # your own channel. Recovery codes always remain available as a fallback. + # + # @param [] totp Set to true to allow TOTP to complete an MFA challenge, or false to disable it. + # @param [] email Set to true to allow email to complete an MFA challenge, or false to disable it. + # @param [] phone Set to true to allow phone (SMS) to complete an MFA challenge, or false to disable it. + # @param [] custom Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. + # + # @return [Project] + def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) + api_path = '/project/policies/mfa-factors' + + api_params = { + totp: totp, + email: email, + phone: phone, + custom: custom, + } + + 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 + # Updating this policy allows you to control if new passwords are checked # against most common passwords dictionary. When enabled, and user changes # their password, password must not be contained in the dictionary. @@ -3095,7 +3085,7 @@ def update_password_dictionary_policy(enabled:) # users, and it will only start to collect and enforce the policy on password # changes since the policy is enabled. # - # @param [Integer] total Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. + # @param [Integer] total Set the password history length per user. Value can be between 1 and 20, or null to disable the limit. # # @return [Project] def update_password_history_policy(total:) @@ -3235,7 +3225,7 @@ def update_session_alert_policy(enabled:) # Update maximum duration how long sessions created within a project should # stay active for. # - # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. + # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds. # # @return [Project] def update_session_duration_policy(duration:) @@ -3302,7 +3292,7 @@ def update_session_invalidation_policy(enabled:) # Update the maximum number of sessions allowed per user. When the limit is # hit, the oldest session will be deleted to make room for new one. # - # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 100. # # @return [Project] def update_session_limit_policy(total:) @@ -3336,7 +3326,7 @@ def update_session_limit_policy(total:) # amount of existing users already exceeded the limit, all users remain # active, but new user sign up will be prohibited. # - # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. + # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit. # # @return [Project] def update_user_limit_policy(total:) @@ -3369,9 +3359,9 @@ def update_user_limit_policy(total:) # Get a policy by its unique ID. This endpoint returns the current # configuration for the requested project policy. # - # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. + # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. # - # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail] + # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail] def get_policy(policy_id:) api_path = '/project/policies/{policyId}' .gsub('{policyId}', policy_id) @@ -3449,6 +3439,11 @@ def get_policy(policy_id:) return Models::PolicyMembershipPrivacy.from(map: response) end + if response['$id'] == 'mfa-factors' + + return Models::PolicyMfaFactors.from(map: response) + end + if response['$id'] == 'deny-aliased-email' return Models::PolicyDenyAliasedEmail.from(map: response) diff --git a/lib/appwrite/services/proxy.rb b/lib/appwrite/services/proxy.rb index 8fa472e8..206c395a 100644 --- a/lib/appwrite/services/proxy.rb +++ b/lib/appwrite/services/proxy.rb @@ -7,6 +7,50 @@ def initialize(client) @client = client end + # Create a new CDN cache invalidation for a domain. Executes a hard purge of + # cached content. + # + # Depending on type, the invalidation purges a single cache tag, a single URL + # path, or all cached content for the domain. + # + # @param [String] domain Domain name. + # @param [InvalidationType] type Type of reference passed. Allowed values are: tag, path, all + # @param [String] reference Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. + # + # @return [ProxyInvalidation] + def create_invalidation(domain:, type:, reference: nil) + api_path = '/proxy/invalidations' + + if domain.nil? + raise Appwrite::Exception.new('Missing required parameter: "domain"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + api_params = { + domain: domain, + type: type, + reference: reference, + } + + 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::ProxyInvalidation + ) + + end + # Get a list of all the proxy rules. You can use the query params to filter # your results. # diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index bc93d5b7..b6028f09 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -155,7 +155,7 @@ def list_frameworks() # List allowed site specifications for this instance. # - # @param [String] type Specification type to list. Can be one of: runtimes, builds. + # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] def list_specifications(type: nil) diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index fcc5a98c..705617f1 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -217,7 +217,7 @@ def delete_bucket(bucket_id:) # your results. # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - # @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. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + # @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. You may filter on the following attributes: name, folder, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded # @param [String] search Search term to filter your list results. Max length: 256 chars. # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # @@ -274,9 +274,10 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. # # @return [File] - def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) + def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_progress: nil) api_path = '/storage/buckets/{bucketId}/files' .gsub('{bucketId}', bucket_id) @@ -296,6 +297,7 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) fileId: file_id, file: file, permissions: permissions, + folder: folder, } api_headers = { diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 8144d9b7..ed032867 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -47,9 +47,10 @@ def list(queries: nil, search: nil, total: nil) # @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. # @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. # @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. + # @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. # # @return [Database] - def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil) + def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) api_path = '/tablesdb' if database_id.nil? @@ -66,6 +67,7 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil) enabled: enabled, specification: specification, replicas: replicas, + syncMode: sync_mode, } api_headers = { @@ -334,10 +336,12 @@ def get(database_id:) # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. # @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. + # @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. # @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. + # @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. # # @return [Database] - def update(database_id:, name: nil, enabled: nil, replicas: nil) + def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) @@ -348,7 +352,9 @@ def update(database_id:, name: nil, enabled: nil, replicas: nil) api_params = { name: name, enabled: enabled, + specification: specification, replicas: replicas, + syncMode: sync_mode, } api_headers = { @@ -400,7 +406,9 @@ def delete(database_id:) # Trigger a manual failover for a dedicated database with high availability # enabled. Promotes a replica to primary. The failover runs asynchronously; - # poll the database document for status updates. + # poll the database document for status updates. A database left + # mid-operation by a failover that did not finish also accepts this call as a + # repair, provided `targetReplicaId` names the member to promote. # # @param [String] database_id Database ID. # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. @@ -434,6 +442,238 @@ def create_failover(database_id:, target_replica_id: nil) end + # List the dedicated migrations for a TablesDB database. A database has at + # most one in-flight migration. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseMigrationList] + def list_migrations(database_id:) + api_path = '/tablesdb/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseMigrationList + ) + + end + + # Start migrating a serverless TablesDB database onto a dedicated MySQL + # compute. Data is copied to the target while the source stays live, with a + # brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @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. + # @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. + # + # @return [DatabaseMigration] + def create_migration(database_id:, specification:, auto_cutover: nil) + api_path = '/tablesdb/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if specification.nil? + raise Appwrite::Exception.new('Missing required parameter: "specification"') + end + + api_params = { + specification: specification, + autoCutover: auto_cutover, + } + + 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::DatabaseMigration + ) + + end + + # Get a single dedicated migration for a TablesDB database by its ID. + # + # @param [String] database_id Database ID. + # @param [String] migration_id Migration ID. + # + # @return [DatabaseMigration] + def get_migration(database_id:, migration_id:) + api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' + .gsub('{databaseId}', database_id) + .gsub('{migrationId}', migration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if migration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + 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::DatabaseMigration + ) + + end + + # Abort an in-flight TablesDB dedicated migration. Only allowed before + # cutover; once the migration has cut over it cannot be aborted. + # + # @param [String] database_id Database ID. + # @param [String] migration_id Migration ID. + # + # @return [] + def delete_migration(database_id:, migration_id:) + api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' + .gsub('{databaseId}', database_id) + .gsub('{migrationId}', migration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if migration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + 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 + + # Cut a verified TablesDB migration over to its dedicated compute. Only + # applies to a migration created with `autoCutover` disabled, which waits at + # `ready_to_cutover` until this is called. The routing flip happens shortly + # after this returns, with a brief read-only window. One call buys one + # attempt: a cutover that fails a check returns the migration to `verifying` + # and parks it again, so call this once more to retry. + # + # @param [String] database_id Database ID. + # @param [String] migration_id Migration ID. + # + # @return [DatabaseMigration] + def cutover_migration(database_id:, migration_id:) + api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover' + .gsub('{databaseId}', database_id) + .gsub('{migrationId}', migration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if migration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + end + + api_params = { + } + + 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::DatabaseMigration + ) + + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations(database_id:, status: nil, limit: nil, offset: nil) + api_path = '/tablesdb/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + + end + # Get high availability status for a dedicated database. Returns replica # statuses, replication lag, and sync mode. # @@ -548,7 +788,7 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) # @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). # @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). # @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. - # @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. + # @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. # @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). # # @return [Table] @@ -2276,11 +2516,11 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [String] database_id Database ID. # @param [String] table_id Table ID. # @param [String] related_table_id Related Table ID. - # @param [RelationshipType] type Relation type + # @param [RelationshipType] type Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. # @param [] two_way Is Two Way? # @param [String] key Column Key. # @param [String] two_way_key Two Way Column Key. - # @param [RelationMutate] on_delete Constraints option + # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [ColumnRelationship] def create_relationship_column(database_id:, table_id:, related_table_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) @@ -2964,7 +3204,7 @@ def delete_column(database_id:, table_id:, key:) # @param [String] database_id Database ID. # @param [String] table_id Table ID. # @param [String] key Column Key. - # @param [RelationMutate] on_delete Constraints option + # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # @param [String] new_key New Column Key. # # @return [ColumnRelationship] diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 472df7f3..a3c19251 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -908,6 +908,44 @@ def delete_mfa_authenticator(user_id:, type:) end + # Get a custom MFA challenge for a user, including the code to be delivered + # through your own channel. + # + # @param [String] user_id User ID. + # @param [String] challenge_id ID of the challenge. + # + # @return [MfaChallengeSecret] + def get_mfa_challenge(user_id:, challenge_id:) + api_path = '/users/{userId}/mfa/challenges/{challengeId}' + .gsub('{userId}', user_id) + .gsub('{challengeId}', challenge_id) + + if user_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "userId"') + end + + if challenge_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "challengeId"') + 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::MfaChallengeSecret + ) + + end + # List the factors available on the account to be used as a MFA challange. # # @param [String] user_id User ID. From 66adb1e855f1e4ce6d9eaa081bef666567a882a3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 13:51:00 +0530 Subject: [PATCH 07/10] chore: update Ruby SDK to 27.0.0 --- CHANGELOG.md | 1 - .../embeddings/create-text-embeddings.md | 18 ------- lib/appwrite.rb | 4 -- lib/appwrite/enums/embedding_model.rb | 10 ---- lib/appwrite/models/embedding.rb | 42 ---------------- lib/appwrite/models/embedding_list.rb | 32 ------------- lib/appwrite/services/embeddings.rb | 48 ------------------- 7 files changed, 155 deletions(-) delete mode 100644 docs/examples/embeddings/create-text-embeddings.md delete mode 100644 lib/appwrite/enums/embedding_model.rb delete mode 100644 lib/appwrite/models/embedding.rb delete mode 100644 lib/appwrite/models/embedding_list.rb delete mode 100644 lib/appwrite/services/embeddings.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e27c2e..08988d8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either * Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke * Breaking: `activities.listEvents` `queries` now takes an array instead of a string -* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum * Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` * Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum * Added: `apps.deleteInstallation` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md deleted file mode 100644 index facbe573..00000000 --- a/docs/examples/embeddings/create-text-embeddings.md +++ /dev/null @@ -1,18 +0,0 @@ -```ruby -require 'appwrite' - -include Appwrite -include Appwrite::Enums - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID - .set_key('') # Your secret API key - -embeddings = Embeddings.new(client) - -result = embeddings.create_text_embeddings( - texts: [], - model: EmbeddingModel::NOMIC_EMBED_TEXT # optional -) -``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 64a08f3b..f70c35b3 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -57,11 +57,9 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' -require_relative 'appwrite/models/embedding_list' require_relative 'appwrite/models/insight_list' require_relative 'appwrite/models/report_list' require_relative 'appwrite/models/database' -require_relative 'appwrite/models/embedding' require_relative 'appwrite/models/collection' require_relative 'appwrite/models/attribute_list' require_relative 'appwrite/models/attribute_string' @@ -308,7 +306,6 @@ require_relative 'appwrite/enums/relation_mutate' require_relative 'appwrite/enums/databases_index_type' require_relative 'appwrite/enums/order_by' -require_relative 'appwrite/enums/embedding_model' require_relative 'appwrite/enums/runtime' require_relative 'appwrite/enums/project_key_scopes' require_relative 'appwrite/enums/template_reference_type' @@ -362,7 +359,6 @@ require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' -require_relative 'appwrite/services/embeddings' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' diff --git a/lib/appwrite/enums/embedding_model.rb b/lib/appwrite/enums/embedding_model.rb deleted file mode 100644 index 7fce0ea6..00000000 --- a/lib/appwrite/enums/embedding_model.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Appwrite - module Enums - module EmbeddingModel - NOMIC_EMBED_TEXT = 'nomic-embed-text' - EMBEDDING_GEMMA = 'embedding-gemma' - ALL_MINILM = 'all-minilm' - BGE_SMALL = 'bge-small' - end - end -end \ No newline at end of file diff --git a/lib/appwrite/models/embedding.rb b/lib/appwrite/models/embedding.rb deleted file mode 100644 index 991b6e57..00000000 --- a/lib/appwrite/models/embedding.rb +++ /dev/null @@ -1,42 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class Embedding - attr_reader :model - attr_reader :dimension - attr_reader :embedding - attr_reader :error - - def initialize( - model:, - dimension:, - embedding:, - error: - ) - @model = model - @dimension = dimension - @embedding = embedding - @error = error - end - - def self.from(map:) - Embedding.new( - model: map["model"], - dimension: map["dimension"], - embedding: map["embedding"], - error: map["error"] - ) - end - - def to_map - { - "model": @model, - "dimension": @dimension, - "embedding": @embedding, - "error": @error - } - end - end - end -end diff --git a/lib/appwrite/models/embedding_list.rb b/lib/appwrite/models/embedding_list.rb deleted file mode 100644 index 770ca0e5..00000000 --- a/lib/appwrite/models/embedding_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class EmbeddingList - attr_reader :total - attr_reader :embeddings - - def initialize( - total:, - embeddings: - ) - @total = total - @embeddings = embeddings - end - - def self.from(map:) - EmbeddingList.new( - total: map["total"], - embeddings: map["embeddings"].map { |it| Embedding.from(map: it) } - ) - end - - def to_map - { - "total": @total, - "embeddings": @embeddings.map { |it| it.to_map } - } - end - end - end -end diff --git a/lib/appwrite/services/embeddings.rb b/lib/appwrite/services/embeddings.rb deleted file mode 100644 index 5056314f..00000000 --- a/lib/appwrite/services/embeddings.rb +++ /dev/null @@ -1,48 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - class Embeddings < Service - - def initialize(client) - @client = client - end - - # Generate vector embeddings for an array of text using the selected - # embedding model. Use the returned vectors to power semantic search and - # similarity queries against your vector collections. - # - # - # @param [Array] texts Array of text to generate embeddings. - # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings. - # - # @return [EmbeddingList] - def create_text_embeddings(texts:, model: nil) - api_path = '/embeddings/text' - - if texts.nil? - raise Appwrite::Exception.new('Missing required parameter: "texts"') - end - - api_params = { - texts: texts, - model: model, - } - - 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::EmbeddingList - ) - - end - - end -end From 58f35b5b3ec42500d515620d973f3a955c612dd4 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 14:00:45 +0530 Subject: [PATCH 08/10] chore: update Ruby SDK to 27.0.0 --- CHANGELOG.md | 1 + .../embeddings/create-text-embeddings.md | 18 +++++++ lib/appwrite.rb | 4 ++ lib/appwrite/enums/embedding_model.rb | 10 ++++ lib/appwrite/models/embedding.rb | 42 ++++++++++++++++ lib/appwrite/models/embedding_list.rb | 32 +++++++++++++ lib/appwrite/services/embeddings.rb | 48 +++++++++++++++++++ 7 files changed, 155 insertions(+) create mode 100644 docs/examples/embeddings/create-text-embeddings.md create mode 100644 lib/appwrite/enums/embedding_model.rb create mode 100644 lib/appwrite/models/embedding.rb create mode 100644 lib/appwrite/models/embedding_list.rb create mode 100644 lib/appwrite/services/embeddings.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 08988d8f..78e27c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either * Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke * Breaking: `activities.listEvents` `queries` now takes an array instead of a string +* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum * Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` * Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum * Added: `apps.deleteInstallation` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md new file mode 100644 index 00000000..facbe573 --- /dev/null +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +embeddings = Embeddings.new(client) + +result = embeddings.create_text_embeddings( + texts: [], + model: EmbeddingModel::NOMIC_EMBED_TEXT # optional +) +``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index f70c35b3..64a08f3b 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -57,9 +57,11 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' +require_relative 'appwrite/models/embedding_list' require_relative 'appwrite/models/insight_list' require_relative 'appwrite/models/report_list' require_relative 'appwrite/models/database' +require_relative 'appwrite/models/embedding' require_relative 'appwrite/models/collection' require_relative 'appwrite/models/attribute_list' require_relative 'appwrite/models/attribute_string' @@ -306,6 +308,7 @@ require_relative 'appwrite/enums/relation_mutate' require_relative 'appwrite/enums/databases_index_type' require_relative 'appwrite/enums/order_by' +require_relative 'appwrite/enums/embedding_model' require_relative 'appwrite/enums/runtime' require_relative 'appwrite/enums/project_key_scopes' require_relative 'appwrite/enums/template_reference_type' @@ -359,6 +362,7 @@ require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' +require_relative 'appwrite/services/embeddings' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' diff --git a/lib/appwrite/enums/embedding_model.rb b/lib/appwrite/enums/embedding_model.rb new file mode 100644 index 00000000..7fce0ea6 --- /dev/null +++ b/lib/appwrite/enums/embedding_model.rb @@ -0,0 +1,10 @@ +module Appwrite + module Enums + module EmbeddingModel + NOMIC_EMBED_TEXT = 'nomic-embed-text' + EMBEDDING_GEMMA = 'embedding-gemma' + ALL_MINILM = 'all-minilm' + BGE_SMALL = 'bge-small' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/models/embedding.rb b/lib/appwrite/models/embedding.rb new file mode 100644 index 00000000..991b6e57 --- /dev/null +++ b/lib/appwrite/models/embedding.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Embedding + attr_reader :model + attr_reader :dimension + attr_reader :embedding + attr_reader :error + + def initialize( + model:, + dimension:, + embedding:, + error: + ) + @model = model + @dimension = dimension + @embedding = embedding + @error = error + end + + def self.from(map:) + Embedding.new( + model: map["model"], + dimension: map["dimension"], + embedding: map["embedding"], + error: map["error"] + ) + end + + def to_map + { + "model": @model, + "dimension": @dimension, + "embedding": @embedding, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/embedding_list.rb b/lib/appwrite/models/embedding_list.rb new file mode 100644 index 00000000..770ca0e5 --- /dev/null +++ b/lib/appwrite/models/embedding_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class EmbeddingList + attr_reader :total + attr_reader :embeddings + + def initialize( + total:, + embeddings: + ) + @total = total + @embeddings = embeddings + end + + def self.from(map:) + EmbeddingList.new( + total: map["total"], + embeddings: map["embeddings"].map { |it| Embedding.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "embeddings": @embeddings.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/services/embeddings.rb b/lib/appwrite/services/embeddings.rb new file mode 100644 index 00000000..5056314f --- /dev/null +++ b/lib/appwrite/services/embeddings.rb @@ -0,0 +1,48 @@ +#frozen_string_literal: true + +module Appwrite + class Embeddings < Service + + def initialize(client) + @client = client + end + + # Generate vector embeddings for an array of text using the selected + # embedding model. Use the returned vectors to power semantic search and + # similarity queries against your vector collections. + # + # + # @param [Array] texts Array of text to generate embeddings. + # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings. + # + # @return [EmbeddingList] + def create_text_embeddings(texts:, model: nil) + api_path = '/embeddings/text' + + if texts.nil? + raise Appwrite::Exception.new('Missing required parameter: "texts"') + end + + api_params = { + texts: texts, + model: model, + } + + 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::EmbeddingList + ) + + end + + end +end From 095dd66f0186d7d00022aadacfcabe6518a02b4d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 27 Aug 2026 18:00:58 +0530 Subject: [PATCH 09/10] chore: update Ruby SDK to 27.1.0.rc1 --- .rubocop.yml | 26 + CHANGELOG.md | 14 + Gemfile | 2 +- appwrite.gemspec | 21 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-photo.md | 23 + .../databases/create-big-int-attribute.md | 8 +- .../databases/create-boolean-attribute.md | 2 +- .../databases/create-datetime-attribute.md | 2 +- .../databases/create-email-attribute.md | 2 +- .../databases/create-enum-attribute.md | 6 +- .../databases/create-float-attribute.md | 8 +- docs/examples/databases/create-index.md | 2 +- .../databases/create-integer-attribute.md | 8 +- .../examples/databases/create-ip-attribute.md | 4 +- .../databases/create-line-attribute.md | 2 +- .../databases/create-longtext-attribute.md | 4 +- .../databases/create-mediumtext-attribute.md | 4 +- .../databases/create-point-attribute.md | 2 +- .../databases/create-polygon-attribute.md | 2 +- .../create-relationship-attribute.md | 4 +- .../databases/create-string-attribute.md | 4 +- .../databases/create-text-attribute.md | 4 +- .../databases/create-url-attribute.md | 2 +- .../databases/create-varchar-attribute.md | 4 +- .../databases/decrement-document-attribute.md | 6 +- docs/examples/databases/delete-attribute.md | 2 +- docs/examples/databases/delete-index.md | 2 +- docs/examples/databases/get-attribute.md | 2 +- docs/examples/databases/get-index.md | 2 +- .../databases/increment-document-attribute.md | 6 +- .../databases/update-big-int-attribute.md | 10 +- .../databases/update-boolean-attribute.md | 4 +- .../databases/update-datetime-attribute.md | 4 +- .../databases/update-email-attribute.md | 4 +- .../databases/update-enum-attribute.md | 8 +- .../databases/update-float-attribute.md | 10 +- .../databases/update-integer-attribute.md | 10 +- .../examples/databases/update-ip-attribute.md | 6 +- .../databases/update-line-attribute.md | 4 +- .../databases/update-longtext-attribute.md | 6 +- .../databases/update-mediumtext-attribute.md | 6 +- .../databases/update-point-attribute.md | 4 +- .../databases/update-polygon-attribute.md | 4 +- .../update-relationship-attribute.md | 4 +- .../databases/update-string-attribute.md | 6 +- .../databases/update-text-attribute.md | 6 +- .../databases/update-url-attribute.md | 4 +- .../databases/update-varchar-attribute.md | 6 +- .../examples/documentsdb/create-collection.md | 25 + docs/examples/documentsdb/create-document.md | 28 + docs/examples/documentsdb/create-documents.md | 18 + docs/examples/documentsdb/create-failover.md | 17 + docs/examples/documentsdb/create-index.md | 23 + .../examples/documentsdb/create-operations.md | 27 + .../documentsdb/create-transaction.md | 16 + docs/examples/documentsdb/create.md | 21 + .../decrement-document-attribute.md | 22 + .../examples/documentsdb/delete-collection.md | 17 + docs/examples/documentsdb/delete-document.md | 19 + docs/examples/documentsdb/delete-documents.md | 19 + docs/examples/documentsdb/delete-index.md | 18 + .../documentsdb/delete-transaction.md | 16 + docs/examples/documentsdb/delete.md | 16 + docs/examples/documentsdb/get-collection.md | 17 + docs/examples/documentsdb/get-document.md | 20 + docs/examples/documentsdb/get-index.md | 18 + docs/examples/documentsdb/get-replicas.md | 16 + docs/examples/documentsdb/get-status.md | 16 + docs/examples/documentsdb/get-transaction.md | 16 + docs/examples/documentsdb/get.md | 16 + .../increment-document-attribute.md | 22 + docs/examples/documentsdb/list-collections.md | 19 + docs/examples/documentsdb/list-documents.md | 21 + docs/examples/documentsdb/list-indexes.md | 19 + docs/examples/documentsdb/list-operations.md | 19 + .../documentsdb/list-specifications.md | 14 + .../examples/documentsdb/list-transactions.md | 16 + docs/examples/documentsdb/list.md | 17 + .../examples/documentsdb/update-collection.md | 24 + docs/examples/documentsdb/update-document.md | 23 + docs/examples/documentsdb/update-documents.md | 20 + .../documentsdb/update-transaction.md | 18 + docs/examples/documentsdb/update.md | 21 + docs/examples/documentsdb/upsert-document.md | 23 + docs/examples/documentsdb/upsert-documents.md | 19 + docs/examples/functions/create.md | 6 +- docs/examples/functions/update.md | 6 +- .../messaging/create-mailgun-provider.md | 2 +- docs/examples/messaging/create-push.md | 2 +- .../messaging/create-smtp-provider.md | 2 +- .../messaging/update-mailgun-provider.md | 2 +- docs/examples/messaging/update-push.md | 2 +- docs/examples/mongo/create-backup-policy.md | 22 + docs/examples/mongo/create-backup.md | 17 + docs/examples/mongo/create-branch.md | 18 + docs/examples/mongo/create-failover.md | 17 + docs/examples/mongo/create-migration.md | 18 + docs/examples/mongo/create-restoration.md | 20 + docs/examples/mongo/create-upgrade.md | 17 + docs/examples/mongo/create.md | 29 + docs/examples/mongo/delete-backup-policy.md | 17 + docs/examples/mongo/delete-backup.md | 17 + docs/examples/mongo/delete-branch.md | 17 + docs/examples/mongo/delete.md | 16 + docs/examples/mongo/get-backup-policy.md | 17 + docs/examples/mongo/get-backup.md | 17 + docs/examples/mongo/get-pitr.md | 16 + docs/examples/mongo/get-replicas.md | 16 + docs/examples/mongo/get-restoration.md | 17 + docs/examples/mongo/get-status.md | 16 + docs/examples/mongo/get.md | 16 + docs/examples/mongo/list-backup-policies.md | 17 + docs/examples/mongo/list-backups.md | 17 + docs/examples/mongo/list-branches.md | 16 + docs/examples/mongo/list-operations.md | 19 + docs/examples/mongo/list-restorations.md | 20 + docs/examples/mongo/list-specifications.md | 14 + docs/examples/mongo/list.md | 16 + docs/examples/mongo/update-backup-policy.md | 21 + docs/examples/mongo/update-backup-storage.md | 23 + docs/examples/mongo/update-credentials.md | 16 + docs/examples/mongo/update-maintenance.md | 18 + docs/examples/mongo/update.md | 36 + docs/examples/mysql/create-backup-policy.md | 22 + docs/examples/mysql/create-backup.md | 17 + docs/examples/mysql/create-branch.md | 18 + docs/examples/mysql/create-execution.md | 19 + docs/examples/mysql/create-failover.md | 17 + docs/examples/mysql/create-migration.md | 18 + docs/examples/mysql/create-restoration.md | 20 + docs/examples/mysql/create-upgrade.md | 17 + docs/examples/mysql/create.md | 29 + docs/examples/mysql/delete-backup-policy.md | 17 + docs/examples/mysql/delete-backup.md | 17 + docs/examples/mysql/delete-branch.md | 17 + docs/examples/mysql/delete.md | 16 + docs/examples/mysql/get-backup-policy.md | 17 + docs/examples/mysql/get-backup.md | 17 + docs/examples/mysql/get-pitr.md | 16 + docs/examples/mysql/get-pooler.md | 16 + docs/examples/mysql/get-replicas.md | 16 + docs/examples/mysql/get-restoration.md | 17 + docs/examples/mysql/get-status.md | 16 + docs/examples/mysql/get.md | 16 + docs/examples/mysql/list-backup-policies.md | 17 + docs/examples/mysql/list-backups.md | 17 + docs/examples/mysql/list-branches.md | 16 + docs/examples/mysql/list-operations.md | 19 + docs/examples/mysql/list-restorations.md | 20 + docs/examples/mysql/list-specifications.md | 14 + docs/examples/mysql/list.md | 16 + docs/examples/mysql/update-backup-policy.md | 21 + docs/examples/mysql/update-backup-storage.md | 23 + docs/examples/mysql/update-credentials.md | 16 + docs/examples/mysql/update-maintenance.md | 18 + docs/examples/mysql/update-pooler.md | 24 + docs/examples/mysql/update.md | 36 + docs/examples/organization/create-project.md | 2 +- .../postgresql/create-backup-policy.md | 22 + docs/examples/postgresql/create-backup.md | 17 + docs/examples/postgresql/create-branch.md | 18 + docs/examples/postgresql/create-execution.md | 19 + docs/examples/postgresql/create-extension.md | 17 + docs/examples/postgresql/create-failover.md | 17 + docs/examples/postgresql/create-migration.md | 18 + .../examples/postgresql/create-restoration.md | 20 + docs/examples/postgresql/create-upgrade.md | 17 + docs/examples/postgresql/create.md | 29 + .../postgresql/delete-backup-policy.md | 17 + docs/examples/postgresql/delete-backup.md | 17 + docs/examples/postgresql/delete-branch.md | 17 + docs/examples/postgresql/delete-extension.md | 17 + docs/examples/postgresql/delete.md | 16 + docs/examples/postgresql/get-backup-policy.md | 17 + docs/examples/postgresql/get-backup.md | 17 + docs/examples/postgresql/get-pitr.md | 16 + docs/examples/postgresql/get-pooler.md | 16 + docs/examples/postgresql/get-replicas.md | 16 + docs/examples/postgresql/get-restoration.md | 17 + docs/examples/postgresql/get-status.md | 16 + docs/examples/postgresql/get.md | 16 + .../postgresql/list-backup-policies.md | 17 + docs/examples/postgresql/list-backups.md | 17 + docs/examples/postgresql/list-branches.md | 16 + docs/examples/postgresql/list-extensions.md | 16 + docs/examples/postgresql/list-operations.md | 19 + docs/examples/postgresql/list-restorations.md | 20 + .../postgresql/list-specifications.md | 14 + docs/examples/postgresql/list.md | 16 + .../postgresql/update-backup-policy.md | 21 + .../postgresql/update-backup-storage.md | 23 + .../examples/postgresql/update-credentials.md | 16 + .../examples/postgresql/update-maintenance.md | 18 + docs/examples/postgresql/update-pooler.md | 24 + docs/examples/postgresql/update.md | 36 + .../project/update-o-auth-2-hugging-face.md | 18 + docs/examples/project/update-o-auth-2-okta.md | 2 +- docs/examples/project/update-smtp.md | 4 +- docs/examples/proxy/create-api-rule.md | 2 +- docs/examples/proxy/create-function-rule.md | 2 +- docs/examples/proxy/create-invalidation.md | 2 +- docs/examples/proxy/create-redirect-rule.md | 2 +- docs/examples/proxy/create-site-rule.md | 2 +- docs/examples/sites/create.md | 7 +- docs/examples/sites/update.md | 7 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/get-file-preview.md | 4 +- .../tablesdb/create-big-int-column.md | 8 +- .../tablesdb/create-boolean-column.md | 2 +- .../tablesdb/create-datetime-column.md | 2 +- docs/examples/tablesdb/create-email-column.md | 2 +- docs/examples/tablesdb/create-enum-column.md | 6 +- docs/examples/tablesdb/create-float-column.md | 8 +- docs/examples/tablesdb/create-index.md | 2 +- .../tablesdb/create-integer-column.md | 8 +- docs/examples/tablesdb/create-ip-column.md | 4 +- docs/examples/tablesdb/create-line-column.md | 2 +- .../tablesdb/create-longtext-column.md | 4 +- .../tablesdb/create-mediumtext-column.md | 4 +- docs/examples/tablesdb/create-point-column.md | 2 +- .../tablesdb/create-polygon-column.md | 2 +- .../tablesdb/create-relationship-column.md | 4 +- .../examples/tablesdb/create-string-column.md | 4 +- docs/examples/tablesdb/create-text-column.md | 4 +- docs/examples/tablesdb/create-url-column.md | 2 +- .../tablesdb/create-varchar-column.md | 4 +- .../examples/tablesdb/decrement-row-column.md | 6 +- docs/examples/tablesdb/delete-column.md | 2 +- docs/examples/tablesdb/delete-index.md | 2 +- docs/examples/tablesdb/get-column.md | 2 +- docs/examples/tablesdb/get-index.md | 2 +- .../examples/tablesdb/increment-row-column.md | 6 +- docs/examples/tablesdb/list-operations.md | 2 +- .../tablesdb/update-big-int-column.md | 10 +- .../tablesdb/update-boolean-column.md | 4 +- .../tablesdb/update-datetime-column.md | 4 +- docs/examples/tablesdb/update-email-column.md | 4 +- docs/examples/tablesdb/update-enum-column.md | 8 +- docs/examples/tablesdb/update-float-column.md | 10 +- .../tablesdb/update-integer-column.md | 10 +- docs/examples/tablesdb/update-ip-column.md | 6 +- docs/examples/tablesdb/update-line-column.md | 4 +- .../tablesdb/update-longtext-column.md | 6 +- .../tablesdb/update-mediumtext-column.md | 6 +- docs/examples/tablesdb/update-point-column.md | 4 +- .../tablesdb/update-polygon-column.md | 4 +- .../tablesdb/update-relationship-column.md | 4 +- .../examples/tablesdb/update-string-column.md | 6 +- docs/examples/tablesdb/update-text-column.md | 6 +- docs/examples/tablesdb/update-url-column.md | 4 +- .../tablesdb/update-varchar-column.md | 6 +- docs/examples/users/create-jwt.md | 2 +- docs/examples/users/create-scrypt-user.md | 8 +- docs/examples/vectorsdb/create-collection.md | 24 + docs/examples/vectorsdb/create-document.md | 32 + docs/examples/vectorsdb/create-documents.md | 18 + docs/examples/vectorsdb/create-failover.md | 17 + docs/examples/vectorsdb/create-index.md | 23 + docs/examples/vectorsdb/create-operations.md | 27 + docs/examples/vectorsdb/create-query.md | 21 + docs/examples/vectorsdb/create-transaction.md | 16 + docs/examples/vectorsdb/create.md | 21 + docs/examples/vectorsdb/delete-collection.md | 17 + docs/examples/vectorsdb/delete-document.md | 19 + docs/examples/vectorsdb/delete-documents.md | 19 + docs/examples/vectorsdb/delete-index.md | 18 + docs/examples/vectorsdb/delete-transaction.md | 16 + docs/examples/vectorsdb/delete.md | 16 + docs/examples/vectorsdb/get-collection.md | 17 + docs/examples/vectorsdb/get-document.md | 20 + docs/examples/vectorsdb/get-index.md | 18 + docs/examples/vectorsdb/get-replicas.md | 16 + docs/examples/vectorsdb/get-status.md | 16 + docs/examples/vectorsdb/get-transaction.md | 16 + docs/examples/vectorsdb/get.md | 16 + docs/examples/vectorsdb/list-collections.md | 19 + docs/examples/vectorsdb/list-documents.md | 21 + docs/examples/vectorsdb/list-indexes.md | 19 + docs/examples/vectorsdb/list-operations.md | 19 + .../examples/vectorsdb/list-specifications.md | 14 + docs/examples/vectorsdb/list-transactions.md | 16 + docs/examples/vectorsdb/list.md | 17 + docs/examples/vectorsdb/update-collection.md | 24 + docs/examples/vectorsdb/update-document.md | 23 + docs/examples/vectorsdb/update-documents.md | 20 + docs/examples/vectorsdb/update-transaction.md | 18 + docs/examples/vectorsdb/update.md | 21 + docs/examples/vectorsdb/upsert-document.md | 23 + docs/examples/vectorsdb/upsert-documents.md | 19 + docs/examples/webhooks/create.md | 2 +- docs/examples/webhooks/update.md | 2 +- lib/appwrite.rb | 27 + lib/appwrite/client.rb | 51 +- lib/appwrite/enums/adapter.rb | 2 +- lib/appwrite/enums/attribute_status.rb | 2 +- lib/appwrite/enums/authentication_factor.rb | 2 +- lib/appwrite/enums/authenticator_type.rb | 2 +- lib/appwrite/enums/backup_services.rb | 2 +- lib/appwrite/enums/billing_plan_group.rb | 2 +- lib/appwrite/enums/browser.rb | 2 +- lib/appwrite/enums/browser_permission.rb | 2 +- lib/appwrite/enums/browser_theme.rb | 2 +- lib/appwrite/enums/build_runtime.rb | 3 +- lib/appwrite/enums/column_status.rb | 2 +- lib/appwrite/enums/compression.rb | 2 +- lib/appwrite/enums/credit_card.rb | 2 +- lib/appwrite/enums/database_status.rb | 2 +- lib/appwrite/enums/database_type.rb | 2 +- lib/appwrite/enums/databases_index_type.rb | 2 +- .../enums/deployment_download_type.rb | 2 +- lib/appwrite/enums/deployment_status.rb | 2 +- lib/appwrite/enums/documents_db_index_type.rb | 9 + lib/appwrite/enums/embedding_model.rb | 4 +- lib/appwrite/enums/execution_method.rb | 2 +- lib/appwrite/enums/execution_resource_type.rb | 8 + lib/appwrite/enums/execution_status.rb | 2 +- lib/appwrite/enums/execution_trigger.rb | 2 +- lib/appwrite/enums/flag.rb | 2 +- lib/appwrite/enums/framework.rb | 2 +- lib/appwrite/enums/image_format.rb | 2 +- lib/appwrite/enums/image_gravity.rb | 2 +- lib/appwrite/enums/index_status.rb | 2 +- lib/appwrite/enums/invalidation_type.rb | 2 +- lib/appwrite/enums/message_priority.rb | 2 +- lib/appwrite/enums/message_status.rb | 2 +- lib/appwrite/enums/messaging_provider_type.rb | 2 +- lib/appwrite/enums/o_auth2_google_prompt.rb | 2 +- lib/appwrite/enums/o_auth2_oidc_prompt.rb | 2 +- lib/appwrite/enums/o_auth_provider.rb | 3 +- lib/appwrite/enums/order_by.rb | 2 +- lib/appwrite/enums/organization_key_scopes.rb | 2 +- lib/appwrite/enums/password_hash.rb | 2 +- lib/appwrite/enums/platform_type.rb | 2 +- lib/appwrite/enums/project_auth_method_id.rb | 2 +- .../enums/project_email_template_id.rb | 2 +- .../enums/project_email_template_locale.rb | 2 +- lib/appwrite/enums/project_key_scopes.rb | 17 +- .../enums/project_o_auth2_google_prompt.rb | 2 +- .../enums/project_o_auth2_oidc_prompt.rb | 2 +- .../enums/project_o_auth_provider_id.rb | 3 +- lib/appwrite/enums/project_policy_id.rb | 2 +- lib/appwrite/enums/project_protocol_id.rb | 2 +- lib/appwrite/enums/project_service_id.rb | 2 +- lib/appwrite/enums/project_smtp_secure.rb | 2 +- lib/appwrite/enums/proxy_resource_type.rb | 2 +- .../proxy_rule_deployment_resource_type.rb | 2 +- lib/appwrite/enums/proxy_rule_status.rb | 2 +- lib/appwrite/enums/region.rb | 2 +- lib/appwrite/enums/relation_mutate.rb | 2 +- lib/appwrite/enums/relationship_type.rb | 2 +- lib/appwrite/enums/runtime.rb | 3 +- lib/appwrite/enums/smtp_encryption.rb | 2 +- lib/appwrite/enums/status_code.rb | 2 +- lib/appwrite/enums/tables_db_index_type.rb | 2 +- lib/appwrite/enums/template_reference_type.rb | 2 +- lib/appwrite/enums/timezone.rb | 2 +- lib/appwrite/enums/vcs_reference_type.rb | 2 +- lib/appwrite/enums/vectors_db_index_type.rb | 12 + lib/appwrite/exception.rb | 2 +- lib/appwrite/id.rb | 6 +- lib/appwrite/input_file.rb | 2 +- lib/appwrite/models/activity_event.rb | 2 +- lib/appwrite/models/activity_event_list.rb | 2 +- lib/appwrite/models/additional_resource.rb | 2 +- lib/appwrite/models/algo_argon2.rb | 2 +- lib/appwrite/models/algo_bcrypt.rb | 2 +- lib/appwrite/models/algo_md5.rb | 2 +- lib/appwrite/models/algo_phpass.rb | 2 +- lib/appwrite/models/algo_scrypt.rb | 2 +- lib/appwrite/models/algo_scrypt_modified.rb | 2 +- lib/appwrite/models/algo_sha.rb | 2 +- lib/appwrite/models/app.rb | 2 +- lib/appwrite/models/app_installation.rb | 4 +- lib/appwrite/models/app_installation_list.rb | 2 +- lib/appwrite/models/app_key.rb | 4 +- lib/appwrite/models/app_key_list.rb | 2 +- lib/appwrite/models/app_scope.rb | 2 +- lib/appwrite/models/app_scope_list.rb | 2 +- lib/appwrite/models/app_secret.rb | 4 +- lib/appwrite/models/app_secret_list.rb | 2 +- lib/appwrite/models/app_secret_plaintext.rb | 4 +- lib/appwrite/models/apps_list.rb | 2 +- lib/appwrite/models/attribute_bigint.rb | 11 +- lib/appwrite/models/attribute_boolean.rb | 7 +- lib/appwrite/models/attribute_datetime.rb | 7 +- lib/appwrite/models/attribute_email.rb | 7 +- lib/appwrite/models/attribute_enum.rb | 7 +- lib/appwrite/models/attribute_float.rb | 11 +- lib/appwrite/models/attribute_integer.rb | 11 +- lib/appwrite/models/attribute_ip.rb | 7 +- lib/appwrite/models/attribute_line.rb | 7 +- lib/appwrite/models/attribute_list.rb | 2 +- lib/appwrite/models/attribute_longtext.rb | 9 +- lib/appwrite/models/attribute_mediumtext.rb | 9 +- lib/appwrite/models/attribute_object.rb | 80 + lib/appwrite/models/attribute_point.rb | 7 +- lib/appwrite/models/attribute_polygon.rb | 7 +- lib/appwrite/models/attribute_relationship.rb | 5 +- lib/appwrite/models/attribute_string.rb | 9 +- lib/appwrite/models/attribute_text.rb | 9 +- lib/appwrite/models/attribute_url.rb | 7 +- lib/appwrite/models/attribute_varchar.rb | 9 +- lib/appwrite/models/attribute_vector.rb | 85 + lib/appwrite/models/backup_archive.rb | 6 +- lib/appwrite/models/backup_archive_list.rb | 2 +- lib/appwrite/models/backup_policy.rb | 6 +- lib/appwrite/models/backup_policy_list.rb | 2 +- lib/appwrite/models/backup_restoration.rb | 2 +- .../models/backup_restoration_list.rb | 2 +- lib/appwrite/models/billing_limits.rb | 18 +- lib/appwrite/models/billing_plan.rb | 29 +- lib/appwrite/models/billing_plan_addon.rb | 6 +- .../models/billing_plan_addon_details.rb | 4 +- .../billing_plan_dedicated_database_limits.rb | 40 +- lib/appwrite/models/billing_plan_limits.rb | 6 +- .../models/billing_plan_supported_addons.rb | 2 +- lib/appwrite/models/block.rb | 6 +- lib/appwrite/models/bucket.rb | 2 +- lib/appwrite/models/bucket_list.rb | 2 +- lib/appwrite/models/collection.rb | 2 +- lib/appwrite/models/collection_list.rb | 2 +- lib/appwrite/models/column_bigint.rb | 11 +- lib/appwrite/models/column_boolean.rb | 7 +- lib/appwrite/models/column_datetime.rb | 7 +- lib/appwrite/models/column_email.rb | 7 +- lib/appwrite/models/column_enum.rb | 7 +- lib/appwrite/models/column_float.rb | 11 +- lib/appwrite/models/column_index.rb | 4 +- lib/appwrite/models/column_index_list.rb | 2 +- lib/appwrite/models/column_integer.rb | 11 +- lib/appwrite/models/column_ip.rb | 7 +- lib/appwrite/models/column_line.rb | 7 +- lib/appwrite/models/column_list.rb | 2 +- lib/appwrite/models/column_longtext.rb | 9 +- lib/appwrite/models/column_mediumtext.rb | 9 +- lib/appwrite/models/column_point.rb | 7 +- lib/appwrite/models/column_polygon.rb | 7 +- lib/appwrite/models/column_relationship.rb | 5 +- lib/appwrite/models/column_string.rb | 9 +- lib/appwrite/models/column_text.rb | 9 +- lib/appwrite/models/column_url.rb | 7 +- lib/appwrite/models/column_varchar.rb | 9 +- lib/appwrite/models/continent.rb | 2 +- lib/appwrite/models/continent_list.rb | 2 +- lib/appwrite/models/country.rb | 2 +- lib/appwrite/models/country_list.rb | 2 +- lib/appwrite/models/currency.rb | 2 +- lib/appwrite/models/currency_list.rb | 2 +- lib/appwrite/models/database.rb | 30 +- lib/appwrite/models/database_list.rb | 2 +- lib/appwrite/models/database_migration.rb | 7 +- .../models/database_migration_list.rb | 2 +- lib/appwrite/models/database_status.rb | 6 +- .../models/database_status_connections.rb | 2 +- .../models/database_status_replica.rb | 9 +- lib/appwrite/models/database_status_volume.rb | 2 +- lib/appwrite/models/dedicated_database.rb | 6 +- .../models/dedicated_database_backup.rb | 107 ++ .../models/dedicated_database_backup_list.rb | 32 + .../dedicated_database_backup_storage.rb | 47 + .../models/dedicated_database_branch.rb | 82 + .../models/dedicated_database_branch_list.rb | 32 + .../models/dedicated_database_execution.rb | 52 + .../dedicated_database_execution_column.rb | 32 + .../models/dedicated_database_extensions.rb | 37 + .../models/dedicated_database_list.rb | 32 + .../models/dedicated_database_member.rb | 9 +- .../models/dedicated_database_operation.rb | 8 +- .../dedicated_database_operation_list.rb | 2 +- .../models/dedicated_database_pitr_windows.rb | 32 + .../models/dedicated_database_pooler.rb | 72 + .../models/dedicated_database_replicas.rb | 6 +- .../models/dedicated_database_restoration.rb | 82 + .../dedicated_database_restoration_list.rb | 32 + .../dedicated_database_specification.rb | 2 +- .../dedicated_database_specification_list.rb | 2 +- ...edicated_database_specification_pricing.rb | 2 +- lib/appwrite/models/deployment.rb | 3 +- lib/appwrite/models/deployment_list.rb | 2 +- lib/appwrite/models/dev_key.rb | 2 +- lib/appwrite/models/document.rb | 2 +- lib/appwrite/models/document_list.rb | 2 +- lib/appwrite/models/email_template.rb | 2 +- lib/appwrite/models/email_template_list.rb | 2 +- lib/appwrite/models/embedding.rb | 2 +- lib/appwrite/models/embedding_list.rb | 2 +- lib/appwrite/models/ephemeral_key.rb | 2 +- lib/appwrite/models/execution.rb | 33 +- lib/appwrite/models/execution_list.rb | 2 +- lib/appwrite/models/file.rb | 2 +- lib/appwrite/models/file_list.rb | 2 +- lib/appwrite/models/framework.rb | 2 +- lib/appwrite/models/framework_adapter.rb | 2 +- lib/appwrite/models/framework_list.rb | 2 +- lib/appwrite/models/function.rb | 2 +- lib/appwrite/models/function_list.rb | 2 +- lib/appwrite/models/headers.rb | 2 +- lib/appwrite/models/identity.rb | 2 +- lib/appwrite/models/identity_list.rb | 2 +- lib/appwrite/models/index.rb | 5 +- lib/appwrite/models/index_list.rb | 2 +- lib/appwrite/models/insight.rb | 8 +- lib/appwrite/models/insight_cta.rb | 2 +- lib/appwrite/models/insight_list.rb | 2 +- lib/appwrite/models/jwt.rb | 2 +- lib/appwrite/models/key.rb | 2 +- lib/appwrite/models/key_list.rb | 2 +- lib/appwrite/models/language.rb | 2 +- lib/appwrite/models/language_list.rb | 2 +- lib/appwrite/models/locale.rb | 24 +- lib/appwrite/models/locale_code.rb | 2 +- lib/appwrite/models/locale_code_list.rb | 2 +- lib/appwrite/models/log.rb | 2 +- lib/appwrite/models/log_list.rb | 2 +- lib/appwrite/models/membership.rb | 2 +- lib/appwrite/models/membership_list.rb | 2 +- lib/appwrite/models/message.rb | 9 +- lib/appwrite/models/message_list.rb | 2 +- lib/appwrite/models/mfa_challenge.rb | 2 +- lib/appwrite/models/mfa_challenge_secret.rb | 2 +- lib/appwrite/models/mfa_factors.rb | 2 +- lib/appwrite/models/mfa_recovery_codes.rb | 2 +- lib/appwrite/models/mfa_type.rb | 2 +- lib/appwrite/models/mock_number.rb | 2 +- lib/appwrite/models/mock_number_list.rb | 2 +- lib/appwrite/models/o_auth2_amazon.rb | 2 +- lib/appwrite/models/o_auth2_apple.rb | 2 +- lib/appwrite/models/o_auth2_appwrite.rb | 2 +- lib/appwrite/models/o_auth2_auth0.rb | 2 +- lib/appwrite/models/o_auth2_authentik.rb | 2 +- lib/appwrite/models/o_auth2_autodesk.rb | 2 +- lib/appwrite/models/o_auth2_bitbucket.rb | 2 +- lib/appwrite/models/o_auth2_bitly.rb | 2 +- lib/appwrite/models/o_auth2_box.rb | 2 +- lib/appwrite/models/o_auth2_dailymotion.rb | 2 +- lib/appwrite/models/o_auth2_discord.rb | 2 +- lib/appwrite/models/o_auth2_disqus.rb | 2 +- lib/appwrite/models/o_auth2_dropbox.rb | 2 +- lib/appwrite/models/o_auth2_etsy.rb | 2 +- lib/appwrite/models/o_auth2_facebook.rb | 2 +- lib/appwrite/models/o_auth2_figma.rb | 2 +- lib/appwrite/models/o_auth2_fusion_auth.rb | 2 +- lib/appwrite/models/o_auth2_github.rb | 2 +- lib/appwrite/models/o_auth2_gitlab.rb | 2 +- lib/appwrite/models/o_auth2_google.rb | 20 +- lib/appwrite/models/o_auth2_hugging_face.rb | 42 + lib/appwrite/models/o_auth2_keycloak.rb | 2 +- lib/appwrite/models/o_auth2_kick.rb | 2 +- lib/appwrite/models/o_auth2_linkedin.rb | 2 +- lib/appwrite/models/o_auth2_microsoft.rb | 2 +- lib/appwrite/models/o_auth2_notion.rb | 2 +- lib/appwrite/models/o_auth2_oidc.rb | 23 +- lib/appwrite/models/o_auth2_okta.rb | 2 +- lib/appwrite/models/o_auth2_paypal.rb | 2 +- lib/appwrite/models/o_auth2_podio.rb | 2 +- lib/appwrite/models/o_auth2_provider_list.rb | 2 +- lib/appwrite/models/o_auth2_salesforce.rb | 2 +- lib/appwrite/models/o_auth2_slack.rb | 2 +- lib/appwrite/models/o_auth2_spotify.rb | 2 +- lib/appwrite/models/o_auth2_stripe.rb | 2 +- lib/appwrite/models/o_auth2_tradeshift.rb | 2 +- lib/appwrite/models/o_auth2_twitch.rb | 2 +- lib/appwrite/models/o_auth2_word_press.rb | 2 +- lib/appwrite/models/o_auth2_x.rb | 2 +- lib/appwrite/models/o_auth2_yahoo.rb | 2 +- lib/appwrite/models/o_auth2_yandex.rb | 2 +- lib/appwrite/models/o_auth2_zoho.rb | 2 +- lib/appwrite/models/o_auth2_zoom.rb | 2 +- lib/appwrite/models/oauth2_approve.rb | 2 +- lib/appwrite/models/oauth2_authorize.rb | 2 +- lib/appwrite/models/oauth2_consent.rb | 2 +- lib/appwrite/models/oauth2_consent_list.rb | 2 +- lib/appwrite/models/oauth2_consent_token.rb | 2 +- .../models/oauth2_consent_token_list.rb | 2 +- .../models/oauth2_device_authorization.rb | 2 +- lib/appwrite/models/oauth2_grant.rb | 2 +- lib/appwrite/models/oauth2_organization.rb | 2 +- .../models/oauth2_organization_list.rb | 2 +- lib/appwrite/models/oauth2_par.rb | 2 +- lib/appwrite/models/oauth2_project.rb | 2 +- lib/appwrite/models/oauth2_project_list.rb | 2 +- lib/appwrite/models/oauth2_reject.rb | 2 +- lib/appwrite/models/oauth2_token.rb | 6 +- lib/appwrite/models/organization.rb | 28 +- lib/appwrite/models/phone.rb | 2 +- lib/appwrite/models/phone_list.rb | 2 +- lib/appwrite/models/platform_android.rb | 3 +- lib/appwrite/models/platform_apple.rb | 3 +- lib/appwrite/models/platform_linux.rb | 3 +- lib/appwrite/models/platform_list.rb | 2 +- lib/appwrite/models/platform_web.rb | 3 +- lib/appwrite/models/platform_windows.rb | 3 +- .../models/policy_deny_aliased_email.rb | 2 +- .../models/policy_deny_corporate_email.rb | 2 +- .../models/policy_deny_disposable_email.rb | 2 +- lib/appwrite/models/policy_deny_free_email.rb | 2 +- lib/appwrite/models/policy_list.rb | 2 +- .../models/policy_membership_privacy.rb | 2 +- lib/appwrite/models/policy_mfa_factors.rb | 2 +- .../models/policy_password_dictionary.rb | 2 +- .../models/policy_password_history.rb | 2 +- .../models/policy_password_personal_data.rb | 2 +- .../models/policy_password_strength.rb | 2 +- lib/appwrite/models/policy_session_alert.rb | 2 +- .../models/policy_session_duration.rb | 2 +- .../models/policy_session_invalidation.rb | 2 +- lib/appwrite/models/policy_session_limit.rb | 2 +- lib/appwrite/models/policy_user_limit.rb | 2 +- lib/appwrite/models/postgres_extension.rb | 42 + lib/appwrite/models/preferences.rb | 2 +- lib/appwrite/models/presence.rb | 8 +- lib/appwrite/models/presence_list.rb | 2 +- lib/appwrite/models/program.rb | 2 +- lib/appwrite/models/project.rb | 38 +- lib/appwrite/models/project_auth_method.rb | 3 +- lib/appwrite/models/project_list.rb | 2 +- lib/appwrite/models/project_protocol.rb | 3 +- lib/appwrite/models/project_service.rb | 3 +- lib/appwrite/models/provider.rb | 4 +- lib/appwrite/models/provider_list.rb | 2 +- lib/appwrite/models/proxy_invalidation.rb | 2 +- lib/appwrite/models/proxy_rule.rb | 5 +- lib/appwrite/models/proxy_rule_list.rb | 2 +- lib/appwrite/models/report.rb | 4 +- lib/appwrite/models/report_list.rb | 2 +- lib/appwrite/models/resource_token.rb | 2 +- lib/appwrite/models/resource_token_list.rb | 2 +- lib/appwrite/models/row.rb | 2 +- lib/appwrite/models/row_list.rb | 2 +- lib/appwrite/models/runtime.rb | 2 +- lib/appwrite/models/runtime_list.rb | 2 +- lib/appwrite/models/session.rb | 2 +- lib/appwrite/models/session_list.rb | 2 +- lib/appwrite/models/site.rb | 7 +- lib/appwrite/models/site_list.rb | 2 +- lib/appwrite/models/specification.rb | 2 +- lib/appwrite/models/specification_list.rb | 2 +- lib/appwrite/models/subscriber.rb | 2 +- lib/appwrite/models/subscriber_list.rb | 2 +- lib/appwrite/models/table.rb | 2 +- lib/appwrite/models/table_list.rb | 2 +- lib/appwrite/models/target.rb | 4 +- lib/appwrite/models/target_list.rb | 2 +- lib/appwrite/models/team.rb | 2 +- lib/appwrite/models/team_list.rb | 2 +- lib/appwrite/models/token.rb | 2 +- lib/appwrite/models/topic.rb | 2 +- lib/appwrite/models/topic_list.rb | 2 +- lib/appwrite/models/transaction.rb | 2 +- lib/appwrite/models/transaction_list.rb | 2 +- lib/appwrite/models/usage_billing_plan.rb | 8 +- lib/appwrite/models/user.rb | 22 +- lib/appwrite/models/user_list.rb | 2 +- lib/appwrite/models/variable.rb | 2 +- lib/appwrite/models/variable_list.rb | 2 +- lib/appwrite/models/vectorsdb_collection.rb | 87 + .../models/vectorsdb_collection_list.rb | 32 + lib/appwrite/models/webhook.rb | 2 +- lib/appwrite/models/webhook_list.rb | 2 +- lib/appwrite/operator.rb | 6 + lib/appwrite/permission.rb | 4 + lib/appwrite/query.rb | 8 +- lib/appwrite/role.rb | 26 +- lib/appwrite/service.rb | 2 +- lib/appwrite/services/account.rb | 617 +++--- lib/appwrite/services/activities.rb | 27 +- lib/appwrite/services/advisor.rb | 78 +- lib/appwrite/services/apps.rb | 315 +-- lib/appwrite/services/avatars.rb | 211 ++- lib/appwrite/services/backups.rb | 185 +- lib/appwrite/services/databases.rb | 1383 +++++++++----- lib/appwrite/services/documents_db.rb | 1683 +++++++++++++++++ lib/appwrite/services/embeddings.rb | 18 +- lib/appwrite/services/functions.rb | 448 +++-- lib/appwrite/services/graphql.rb | 24 +- lib/appwrite/services/locale.rb | 56 +- lib/appwrite/services/messaging.rb | 803 +++++--- lib/appwrite/services/mongo.rb | 1359 +++++++++++++ lib/appwrite/services/mysql.rb | 1503 +++++++++++++++ lib/appwrite/services/oauth2.rb | 175 +- lib/appwrite/services/organization.rb | 276 +-- lib/appwrite/services/postgresql.rb | 1615 ++++++++++++++++ lib/appwrite/services/presences.rb | 84 +- lib/appwrite/services/project.rb | 1370 ++++++++------ lib/appwrite/services/proxy.rb | 131 +- lib/appwrite/services/sites.rb | 433 +++-- lib/appwrite/services/storage.rb | 243 ++- lib/appwrite/services/tables_db.rb | 1515 +++++++++------ lib/appwrite/services/teams.rb | 283 +-- lib/appwrite/services/tokens.rb | 69 +- lib/appwrite/services/users.rb | 650 ++++--- lib/appwrite/services/vectors_db.rb | 1614 ++++++++++++++++ lib/appwrite/services/webhooks.rb | 99 +- 694 files changed, 19049 insertions(+), 4631 deletions(-) create mode 100644 .rubocop.yml create mode 100644 docs/examples/avatars/get-photo.md create mode 100644 docs/examples/documentsdb/create-collection.md create mode 100644 docs/examples/documentsdb/create-document.md create mode 100644 docs/examples/documentsdb/create-documents.md create mode 100644 docs/examples/documentsdb/create-failover.md create mode 100644 docs/examples/documentsdb/create-index.md create mode 100644 docs/examples/documentsdb/create-operations.md create mode 100644 docs/examples/documentsdb/create-transaction.md create mode 100644 docs/examples/documentsdb/create.md create mode 100644 docs/examples/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/documentsdb/delete-collection.md create mode 100644 docs/examples/documentsdb/delete-document.md create mode 100644 docs/examples/documentsdb/delete-documents.md create mode 100644 docs/examples/documentsdb/delete-index.md create mode 100644 docs/examples/documentsdb/delete-transaction.md create mode 100644 docs/examples/documentsdb/delete.md create mode 100644 docs/examples/documentsdb/get-collection.md create mode 100644 docs/examples/documentsdb/get-document.md create mode 100644 docs/examples/documentsdb/get-index.md create mode 100644 docs/examples/documentsdb/get-replicas.md create mode 100644 docs/examples/documentsdb/get-status.md create mode 100644 docs/examples/documentsdb/get-transaction.md create mode 100644 docs/examples/documentsdb/get.md create mode 100644 docs/examples/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/documentsdb/list-collections.md create mode 100644 docs/examples/documentsdb/list-documents.md create mode 100644 docs/examples/documentsdb/list-indexes.md create mode 100644 docs/examples/documentsdb/list-operations.md create mode 100644 docs/examples/documentsdb/list-specifications.md create mode 100644 docs/examples/documentsdb/list-transactions.md create mode 100644 docs/examples/documentsdb/list.md create mode 100644 docs/examples/documentsdb/update-collection.md create mode 100644 docs/examples/documentsdb/update-document.md create mode 100644 docs/examples/documentsdb/update-documents.md create mode 100644 docs/examples/documentsdb/update-transaction.md create mode 100644 docs/examples/documentsdb/update.md create mode 100644 docs/examples/documentsdb/upsert-document.md create mode 100644 docs/examples/documentsdb/upsert-documents.md create mode 100644 docs/examples/mongo/create-backup-policy.md create mode 100644 docs/examples/mongo/create-backup.md create mode 100644 docs/examples/mongo/create-branch.md create mode 100644 docs/examples/mongo/create-failover.md create mode 100644 docs/examples/mongo/create-migration.md create mode 100644 docs/examples/mongo/create-restoration.md create mode 100644 docs/examples/mongo/create-upgrade.md create mode 100644 docs/examples/mongo/create.md create mode 100644 docs/examples/mongo/delete-backup-policy.md create mode 100644 docs/examples/mongo/delete-backup.md create mode 100644 docs/examples/mongo/delete-branch.md create mode 100644 docs/examples/mongo/delete.md create mode 100644 docs/examples/mongo/get-backup-policy.md create mode 100644 docs/examples/mongo/get-backup.md create mode 100644 docs/examples/mongo/get-pitr.md create mode 100644 docs/examples/mongo/get-replicas.md create mode 100644 docs/examples/mongo/get-restoration.md create mode 100644 docs/examples/mongo/get-status.md create mode 100644 docs/examples/mongo/get.md create mode 100644 docs/examples/mongo/list-backup-policies.md create mode 100644 docs/examples/mongo/list-backups.md create mode 100644 docs/examples/mongo/list-branches.md create mode 100644 docs/examples/mongo/list-operations.md create mode 100644 docs/examples/mongo/list-restorations.md create mode 100644 docs/examples/mongo/list-specifications.md create mode 100644 docs/examples/mongo/list.md create mode 100644 docs/examples/mongo/update-backup-policy.md create mode 100644 docs/examples/mongo/update-backup-storage.md create mode 100644 docs/examples/mongo/update-credentials.md create mode 100644 docs/examples/mongo/update-maintenance.md create mode 100644 docs/examples/mongo/update.md create mode 100644 docs/examples/mysql/create-backup-policy.md create mode 100644 docs/examples/mysql/create-backup.md create mode 100644 docs/examples/mysql/create-branch.md create mode 100644 docs/examples/mysql/create-execution.md create mode 100644 docs/examples/mysql/create-failover.md create mode 100644 docs/examples/mysql/create-migration.md create mode 100644 docs/examples/mysql/create-restoration.md create mode 100644 docs/examples/mysql/create-upgrade.md create mode 100644 docs/examples/mysql/create.md create mode 100644 docs/examples/mysql/delete-backup-policy.md create mode 100644 docs/examples/mysql/delete-backup.md create mode 100644 docs/examples/mysql/delete-branch.md create mode 100644 docs/examples/mysql/delete.md create mode 100644 docs/examples/mysql/get-backup-policy.md create mode 100644 docs/examples/mysql/get-backup.md create mode 100644 docs/examples/mysql/get-pitr.md create mode 100644 docs/examples/mysql/get-pooler.md create mode 100644 docs/examples/mysql/get-replicas.md create mode 100644 docs/examples/mysql/get-restoration.md create mode 100644 docs/examples/mysql/get-status.md create mode 100644 docs/examples/mysql/get.md create mode 100644 docs/examples/mysql/list-backup-policies.md create mode 100644 docs/examples/mysql/list-backups.md create mode 100644 docs/examples/mysql/list-branches.md create mode 100644 docs/examples/mysql/list-operations.md create mode 100644 docs/examples/mysql/list-restorations.md create mode 100644 docs/examples/mysql/list-specifications.md create mode 100644 docs/examples/mysql/list.md create mode 100644 docs/examples/mysql/update-backup-policy.md create mode 100644 docs/examples/mysql/update-backup-storage.md create mode 100644 docs/examples/mysql/update-credentials.md create mode 100644 docs/examples/mysql/update-maintenance.md create mode 100644 docs/examples/mysql/update-pooler.md create mode 100644 docs/examples/mysql/update.md create mode 100644 docs/examples/postgresql/create-backup-policy.md create mode 100644 docs/examples/postgresql/create-backup.md create mode 100644 docs/examples/postgresql/create-branch.md create mode 100644 docs/examples/postgresql/create-execution.md create mode 100644 docs/examples/postgresql/create-extension.md create mode 100644 docs/examples/postgresql/create-failover.md create mode 100644 docs/examples/postgresql/create-migration.md create mode 100644 docs/examples/postgresql/create-restoration.md create mode 100644 docs/examples/postgresql/create-upgrade.md create mode 100644 docs/examples/postgresql/create.md create mode 100644 docs/examples/postgresql/delete-backup-policy.md create mode 100644 docs/examples/postgresql/delete-backup.md create mode 100644 docs/examples/postgresql/delete-branch.md create mode 100644 docs/examples/postgresql/delete-extension.md create mode 100644 docs/examples/postgresql/delete.md create mode 100644 docs/examples/postgresql/get-backup-policy.md create mode 100644 docs/examples/postgresql/get-backup.md create mode 100644 docs/examples/postgresql/get-pitr.md create mode 100644 docs/examples/postgresql/get-pooler.md create mode 100644 docs/examples/postgresql/get-replicas.md create mode 100644 docs/examples/postgresql/get-restoration.md create mode 100644 docs/examples/postgresql/get-status.md create mode 100644 docs/examples/postgresql/get.md create mode 100644 docs/examples/postgresql/list-backup-policies.md create mode 100644 docs/examples/postgresql/list-backups.md create mode 100644 docs/examples/postgresql/list-branches.md create mode 100644 docs/examples/postgresql/list-extensions.md create mode 100644 docs/examples/postgresql/list-operations.md create mode 100644 docs/examples/postgresql/list-restorations.md create mode 100644 docs/examples/postgresql/list-specifications.md create mode 100644 docs/examples/postgresql/list.md create mode 100644 docs/examples/postgresql/update-backup-policy.md create mode 100644 docs/examples/postgresql/update-backup-storage.md create mode 100644 docs/examples/postgresql/update-credentials.md create mode 100644 docs/examples/postgresql/update-maintenance.md create mode 100644 docs/examples/postgresql/update-pooler.md create mode 100644 docs/examples/postgresql/update.md create mode 100644 docs/examples/project/update-o-auth-2-hugging-face.md create mode 100644 docs/examples/vectorsdb/create-collection.md create mode 100644 docs/examples/vectorsdb/create-document.md create mode 100644 docs/examples/vectorsdb/create-documents.md create mode 100644 docs/examples/vectorsdb/create-failover.md create mode 100644 docs/examples/vectorsdb/create-index.md create mode 100644 docs/examples/vectorsdb/create-operations.md create mode 100644 docs/examples/vectorsdb/create-query.md create mode 100644 docs/examples/vectorsdb/create-transaction.md create mode 100644 docs/examples/vectorsdb/create.md create mode 100644 docs/examples/vectorsdb/delete-collection.md create mode 100644 docs/examples/vectorsdb/delete-document.md create mode 100644 docs/examples/vectorsdb/delete-documents.md create mode 100644 docs/examples/vectorsdb/delete-index.md create mode 100644 docs/examples/vectorsdb/delete-transaction.md create mode 100644 docs/examples/vectorsdb/delete.md create mode 100644 docs/examples/vectorsdb/get-collection.md create mode 100644 docs/examples/vectorsdb/get-document.md create mode 100644 docs/examples/vectorsdb/get-index.md create mode 100644 docs/examples/vectorsdb/get-replicas.md create mode 100644 docs/examples/vectorsdb/get-status.md create mode 100644 docs/examples/vectorsdb/get-transaction.md create mode 100644 docs/examples/vectorsdb/get.md create mode 100644 docs/examples/vectorsdb/list-collections.md create mode 100644 docs/examples/vectorsdb/list-documents.md create mode 100644 docs/examples/vectorsdb/list-indexes.md create mode 100644 docs/examples/vectorsdb/list-operations.md create mode 100644 docs/examples/vectorsdb/list-specifications.md create mode 100644 docs/examples/vectorsdb/list-transactions.md create mode 100644 docs/examples/vectorsdb/list.md create mode 100644 docs/examples/vectorsdb/update-collection.md create mode 100644 docs/examples/vectorsdb/update-document.md create mode 100644 docs/examples/vectorsdb/update-documents.md create mode 100644 docs/examples/vectorsdb/update-transaction.md create mode 100644 docs/examples/vectorsdb/update.md create mode 100644 docs/examples/vectorsdb/upsert-document.md create mode 100644 docs/examples/vectorsdb/upsert-documents.md create mode 100644 lib/appwrite/enums/documents_db_index_type.rb create mode 100644 lib/appwrite/enums/execution_resource_type.rb create mode 100644 lib/appwrite/enums/vectors_db_index_type.rb create mode 100644 lib/appwrite/models/attribute_object.rb create mode 100644 lib/appwrite/models/attribute_vector.rb create mode 100644 lib/appwrite/models/dedicated_database_backup.rb create mode 100644 lib/appwrite/models/dedicated_database_backup_list.rb create mode 100644 lib/appwrite/models/dedicated_database_backup_storage.rb create mode 100644 lib/appwrite/models/dedicated_database_branch.rb create mode 100644 lib/appwrite/models/dedicated_database_branch_list.rb create mode 100644 lib/appwrite/models/dedicated_database_execution.rb create mode 100644 lib/appwrite/models/dedicated_database_execution_column.rb create mode 100644 lib/appwrite/models/dedicated_database_extensions.rb create mode 100644 lib/appwrite/models/dedicated_database_list.rb create mode 100644 lib/appwrite/models/dedicated_database_pitr_windows.rb create mode 100644 lib/appwrite/models/dedicated_database_pooler.rb create mode 100644 lib/appwrite/models/dedicated_database_restoration.rb create mode 100644 lib/appwrite/models/dedicated_database_restoration_list.rb create mode 100644 lib/appwrite/models/o_auth2_hugging_face.rb create mode 100644 lib/appwrite/models/postgres_extension.rb create mode 100644 lib/appwrite/models/vectorsdb_collection.rb create mode 100644 lib/appwrite/models/vectorsdb_collection_list.rb create mode 100644 lib/appwrite/services/documents_db.rb create mode 100644 lib/appwrite/services/mongo.rb create mode 100644 lib/appwrite/services/mysql.rb create mode 100644 lib/appwrite/services/postgresql.rb create mode 100644 lib/appwrite/services/vectors_db.rb diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..60ec9033 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,26 @@ +# RuboCop layout for the generated Ruby SDK. +# IndentationWidth 4 matches the published sdk-for-ruby house style. +# Only Layout cops are enabled: this is a formatter check, not a full linter. +AllCops: + NewCops: enable + TargetRubyVersion: 2.7 + SuggestExtensions: false + DisabledByDefault: true + Exclude: + - '.github/**/*' + - 'vendor/**/*' + - '.bundle/**/*' + +Layout: + Enabled: true + +Layout/IndentationWidth: + Width: 4 + +Layout/LineLength: + Max: 200 + AllowedPatterns: + - '^\s*#' + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: indented diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e27c2e..a15fd1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## 27.1.0.rc1 + +* Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs +* Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums +* Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions +* Added: `PostgresExtension`, `VectorsdbCollection`, `AttributeObject`, and `AttributeVector` models +* Added: `ExecutionResourceType` enum and `resourceType` on the `Execution` model +* Added: `OAuth2HuggingFace` model and the `huggingface` OAuth provider +* Added: `userId`, `emailHash`, and `name` parameters to `avatars.getPhoto` +* Added: `error`, `containerStatus`, and `lifecycleState` on the `Database` model +* Added: `changelogWatermark` on the `DatabaseMigration` model +* Added: `total` on the `DedicatedDatabaseBranchList` model +* Updated: `DedicatedDatabaseOperation.status` documents the new `queued` state + ## 27.0.0 * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either diff --git a/Gemfile b/Gemfile index cd8aa9e0..fa75df15 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gemspec \ No newline at end of file +gemspec diff --git a/appwrite.gemspec b/appwrite.gemspec index 477ba729..e0d88aab 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,13 +1,12 @@ Gem::Specification.new do |spec| + spec.name = 'appwrite' + spec.version = '27.1.0.rc1' + spec.license = 'BSD-3-Clause' + spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' + spec.author = 'Appwrite Team' + spec.homepage = 'https://appwrite.io/support' + spec.email = 'team@appwrite.io' + spec.files = Dir['lib/**/*.rb'] - spec.name = 'appwrite' - spec.version = '27.0.0' - spec.license = 'BSD-3-Clause' - spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' - spec.author = 'Appwrite Team' - spec.homepage = 'https://appwrite.io/support' - spec.email = 'team@appwrite.io' - spec.files = Dir['lib/**/*.rb'] - - spec.add_dependency 'mime-types', '~> 3.4.1' -end \ No newline at end of file + spec.add_dependency 'mime-types', '~> 3.4.1' +end diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 695ccf72..728777d7 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -14,6 +14,6 @@ result = avatars.get_initials( name: '', # optional width: 0, # optional height: 0, # optional - background: '' # optional + background: 'FFFFFF' # optional ) ``` diff --git a/docs/examples/avatars/get-photo.md b/docs/examples/avatars/get-photo.md new file mode 100644 index 00000000..37659bcb --- /dev/null +++ b/docs/examples/avatars/get-photo.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_photo( + width: 0, # optional + height: 0, # optional + quality: 0, # optional + output: 'png', # optional + rating: 'g', # optional + user_id: 'current()', # optional + email_hash: '', # optional + name: '' # optional +) +``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md index 38013d1e..b808068c 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_big_int_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 1000000, # optional + default: 0, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index a02b6079..95879a9c 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_boolean_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: false, # optional array: false # optional diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 603230eb..8cc00eab 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_datetime_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', # optional array: false # optional diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 70592746..29d02246 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_email_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'email@example.com', # optional array: false # optional diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index c7737fc4..e5975c02 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_enum_attribute( database_id: '', collection_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', # optional + default: 'active', # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 3c0a5f01..62eeecd8 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_float_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10.5, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 454ba828..e3e9238a 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -14,7 +14,7 @@ databases = Databases.new(client) result = databases.create_index( database_id: '', collection_id: '', - key: '', + key: '', type: DatabasesIndexType::KEY, attributes: [], orders: [OrderBy::ASC], # optional diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 7691bf01..6b6d3a86 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_integer_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 9e783e33..a64553ff 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_ip_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: '192.0.2.0', # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 1ade2aac..8c2845f0 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_line_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] # optional ) diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index b7a8f4d6..a7cc06f4 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_longtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 5806ff6f..84b609cd 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_mediumtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 12a0010f..cb61a864 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_point_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [1, 2] # optional ) diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index 181c5e7a..2a3e4332 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_polygon_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] # optional ) diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index bc6f32f1..fca5aadf 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -17,8 +17,8 @@ result = databases.create_relationship_attribute( related_collection_id: '', type: RelationshipType::ONETOONE, two_way: false, # optional - key: '', # optional - two_way_key: '', # optional + key: '', # optional + two_way_key: '', # optional on_delete: RelationMutate::CASCADE # optional ) ``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 2aefa55f..01457805 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_string_attribute( database_id: '', collection_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index bc3f4fb6..b231a0a1 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_text_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index f20c77cd..4078fb14 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_url_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'https://example.com', # optional array: false # optional diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index fe56f85e..5d965bd5 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_varchar_attribute( database_id: '', collection_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index fd97e5f3..a91aafc4 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -14,9 +14,9 @@ result = databases.decrement_document_attribute( database_id: '', collection_id: '', document_id: '', - attribute: '', - value: null, # optional - min: null, # optional + attribute: '', + value: 1, # optional + min: 0, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 089fdab3..56269a2d 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.delete_attribute( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 5b805251..404bc9b0 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.delete_index( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 5b1c53ef..7753ac46 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.get_attribute( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 0e1892a1..fb6557c5 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.get_index( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index ced8cc9d..d3992e67 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -14,9 +14,9 @@ result = databases.increment_document_attribute( database_id: '', collection_id: '', document_id: '', - attribute: '', - value: null, # optional - max: null, # optional + attribute: '', + value: 1, # optional + max: 100, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md index ed0194b4..33d5b1f7 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_big_int_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 0, + min: 0, # optional + max: 1000000, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 36d16afb..086ffb2d 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_boolean_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: false, - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 342314a7..b56c1805 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_datetime_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 9b8f027d..20794087 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_email_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'email@example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index a5d253f6..a3f66c44 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_enum_attribute( database_id: '', collection_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - new_key: '' # optional + default: 'active', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 8c03c9a7..5a652c7f 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_float_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10.5, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 3a44c26e..47d7eb45 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_integer_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index d65ebec4..3f788289 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_ip_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: '192.0.2.0', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 93831f3a..27754f2f 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_line_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index bcab8edc..ceca43a3 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_longtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index faab3a3f..d82768ed 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_mediumtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index df0ee602..95ffce6e 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_point_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [1, 2], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 9424c3cf..75582120 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_polygon_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 766f30fa..22541f0e 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -14,8 +14,8 @@ databases = Databases.new(client) result = databases.update_relationship_attribute( database_id: '', collection_id: '', - key: '', + key: '', on_delete: RelationMutate::CASCADE, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 8ab4e7f7..d6e3a76d 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_string_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index ec21c974..c4b46f5b 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_text_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index defe01c6..9a317642 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_url_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'https://example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 501d57db..07f21602 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_varchar_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 00000000..60b4570f --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,25 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_collection( + database_id: '', + collection_id: '', + name: '', + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false, # optional + attributes: [], # optional + indexes: [] # optional +) +``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 00000000..074b9b7f --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,28 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_document( + database_id: '', + collection_id: '', + document_id: '', + data: { + "username" => "walter.obrien", + "email" => "walter.obrien@example.com", + "fullName" => "Walter O'Brien", + "age" => 30, + "isAdmin" => false + }, + permissions: [Permission.read(Role.any())] # optional +) +``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 00000000..feb10f30 --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_documents( + database_id: '', + collection_id: '', + documents: [] +) +``` diff --git a/docs/examples/documentsdb/create-failover.md b/docs/examples/documentsdb/create-failover.md new file mode 100644 index 00000000..eade7860 --- /dev/null +++ b/docs/examples/documentsdb/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 00000000..d1891f9a --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_index( + database_id: '', + collection_id: '', + key: '', + type: DocumentsDBIndexType::KEY, + attributes: [], + orders: [OrderBy::ASC], # optional + lengths: [] # optional +) +``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md new file mode 100644 index 00000000..8f96a15c --- /dev/null +++ b/docs/examples/documentsdb/create-operations.md @@ -0,0 +1,27 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_operations( + transaction_id: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] # optional +) +``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 00000000..5f56cb23 --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_transaction( + ttl: 60 # optional +) +``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 00000000..8eb47043 --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 00000000..926c406b --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.decrement_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: 1, # optional + min: 0, # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 00000000..886b2d68 --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 00000000..d4482765 --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_document( + database_id: '', + collection_id: '', + document_id: '', + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 00000000..cd628c75 --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 00000000..cf25af04 --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 00000000..017d541b --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 00000000..668637d5 --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 00000000..d92c8109 --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 00000000..8f5b5c68 --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_document( + database_id: '', + collection_id: '', + document_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 00000000..e6ba531b --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/documentsdb/get-replicas.md b/docs/examples/documentsdb/get-replicas.md new file mode 100644 index 00000000..fd3541a2 --- /dev/null +++ b/docs/examples/documentsdb/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-status.md b/docs/examples/documentsdb/get-status.md new file mode 100644 index 00000000..73340718 --- /dev/null +++ b/docs/examples/documentsdb/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_status( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 00000000..3b586e38 --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 00000000..ad7d06ab --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 00000000..abf9a588 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.increment_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: 1, # optional + max: 100, # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 00000000..6a784fb0 --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_collections( + database_id: '', + queries: [], # optional + search: '', # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 00000000..a2562675 --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 00000000..b23b1491 --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_indexes( + database_id: '', + collection_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/list-operations.md b/docs/examples/documentsdb/list-operations.md new file mode 100644 index 00000000..267e3469 --- /dev/null +++ b/docs/examples/documentsdb/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/documentsdb/list-specifications.md b/docs/examples/documentsdb/list-specifications.md new file mode 100644 index 00000000..f9bea5b8 --- /dev/null +++ b/docs/examples/documentsdb/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_specifications() +``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 00000000..82d368e1 --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_transactions( + queries: [] # optional +) +``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 00000000..f4bb9f8c --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 00000000..2be8dca6 --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_collection( + database_id: '', + collection_id: '', + name: '', + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false, # optional + purge: false # optional +) +``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 00000000..90e51e06 --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 00000000..4f3bb64e --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_documents( + database_id: '', + collection_id: '', + data: {}, # optional + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 00000000..37a638e2 --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_transaction( + transaction_id: '', + commit: false, # optional + rollback: false # optional +) +``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 00000000..d5e5d577 --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 00000000..ca6bace1 --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.upsert_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 00000000..f7f05970 --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.upsert_documents( + database_id: '', + collection_id: '', + documents: [], + transaction_id: '' # optional +) +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index b51c2f2a..49c37265 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -17,7 +17,7 @@ result = functions.create( runtime: Runtime::NODE_14_5, execute: ["any"], # optional events: [], # optional - schedule: '', # optional + schedule: '0 0 * * *', # optional timeout: 1, # optional enabled: false, # optional logging: false, # optional @@ -31,8 +31,8 @@ result = functions.create( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional deployment_retention: 0 # optional ) ``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 458be60e..d0bb4c85 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -17,7 +17,7 @@ result = functions.update( runtime: Runtime::NODE_14_5, # optional execute: ["any"], # optional events: [], # optional - schedule: '', # optional + schedule: '0 0 * * *', # optional timeout: 1, # optional enabled: false, # optional logging: false, # optional @@ -31,8 +31,8 @@ result = functions.update( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional deployment_retention: 0 # optional ) ``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 3e6261dc..eaa15ecb 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -14,7 +14,7 @@ result = messaging.create_mailgun_provider( provider_id: '', name: '', api_key: '', # optional - domain: '', # optional + domain: 'example.com', # optional is_eu_region: false, # optional from_name: '', # optional from_email: 'email@example.com', # optional diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index beff7639..e94015e6 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -25,7 +25,7 @@ result = messaging.create_push( sound: '', # optional color: '', # optional tag: '', # optional - badge: null, # optional + badge: 1, # optional draft: false, # optional scheduled_at: '2020-10-15T06:38:00.000+00:00', # optional content_available: false, # optional diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 85c1abda..25e5dd7f 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -15,7 +15,7 @@ result = messaging.create_smtp_provider( provider_id: '', name: '', host: '', - port: 1, # optional + port: 587, # optional username: '', # optional password: 'password', # optional encryption: SmtpEncryption::NONE, # optional diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index d09607a1..4c3f9018 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -14,7 +14,7 @@ result = messaging.update_mailgun_provider( provider_id: '', name: '', # optional api_key: '', # optional - domain: '', # optional + domain: 'example.com', # optional is_eu_region: false, # optional enabled: false, # optional from_name: '', # optional diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index e00176b9..9aa0e8ba 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -25,7 +25,7 @@ result = messaging.update_push( sound: '', # optional color: '', # optional tag: '', # optional - badge: null, # optional + badge: 1, # optional draft: false, # optional scheduled_at: '2020-10-15T06:38:00.000+00:00', # optional content_available: false, # optional diff --git a/docs/examples/mongo/create-backup-policy.md b/docs/examples/mongo/create-backup-policy.md new file mode 100644 index 00000000..cee35bb8 --- /dev/null +++ b/docs/examples/mongo/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mongo/create-backup.md b/docs/examples/mongo/create-backup.md new file mode 100644 index 00000000..d17f7de7 --- /dev/null +++ b/docs/examples/mongo/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/mongo/create-branch.md b/docs/examples/mongo/create-branch.md new file mode 100644 index 00000000..1299c3a8 --- /dev/null +++ b/docs/examples/mongo/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/mongo/create-failover.md b/docs/examples/mongo/create-failover.md new file mode 100644 index 00000000..b07c504a --- /dev/null +++ b/docs/examples/mongo/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/mongo/create-migration.md b/docs/examples/mongo/create-migration.md new file mode 100644 index 00000000..7243c1c1 --- /dev/null +++ b/docs/examples/mongo/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/mongo/create-restoration.md b/docs/examples/mongo/create-restoration.md new file mode 100644 index 00000000..43f91beb --- /dev/null +++ b/docs/examples/mongo/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/mongo/create-upgrade.md b/docs/examples/mongo/create-upgrade.md new file mode 100644 index 00000000..050a2374 --- /dev/null +++ b/docs/examples/mongo/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/mongo/create.md b/docs/examples/mongo/create.md new file mode 100644 index 00000000..5854e4cf --- /dev/null +++ b/docs/examples/mongo/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/mongo/delete-backup-policy.md b/docs/examples/mongo/delete-backup-policy.md new file mode 100644 index 00000000..b5c27d74 --- /dev/null +++ b/docs/examples/mongo/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mongo/delete-backup.md b/docs/examples/mongo/delete-backup.md new file mode 100644 index 00000000..22f427ed --- /dev/null +++ b/docs/examples/mongo/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mongo/delete-branch.md b/docs/examples/mongo/delete-branch.md new file mode 100644 index 00000000..2cb5dda2 --- /dev/null +++ b/docs/examples/mongo/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/mongo/delete.md b/docs/examples/mongo/delete.md new file mode 100644 index 00000000..7d903e4c --- /dev/null +++ b/docs/examples/mongo/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-backup-policy.md b/docs/examples/mongo/get-backup-policy.md new file mode 100644 index 00000000..fe964f8f --- /dev/null +++ b/docs/examples/mongo/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mongo/get-backup.md b/docs/examples/mongo/get-backup.md new file mode 100644 index 00000000..93dfa00f --- /dev/null +++ b/docs/examples/mongo/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mongo/get-pitr.md b/docs/examples/mongo/get-pitr.md new file mode 100644 index 00000000..6dead665 --- /dev/null +++ b/docs/examples/mongo/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-replicas.md b/docs/examples/mongo/get-replicas.md new file mode 100644 index 00000000..62f5af8d --- /dev/null +++ b/docs/examples/mongo/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-restoration.md b/docs/examples/mongo/get-restoration.md new file mode 100644 index 00000000..0364a685 --- /dev/null +++ b/docs/examples/mongo/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/mongo/get-status.md b/docs/examples/mongo/get-status.md new file mode 100644 index 00000000..d8aa927b --- /dev/null +++ b/docs/examples/mongo/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_status( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get.md b/docs/examples/mongo/get.md new file mode 100644 index 00000000..ad7d1ad1 --- /dev/null +++ b/docs/examples/mongo/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get( + database_id: '' +) +``` diff --git a/docs/examples/mongo/list-backup-policies.md b/docs/examples/mongo/list-backup-policies.md new file mode 100644 index 00000000..a78fea89 --- /dev/null +++ b/docs/examples/mongo/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/list-backups.md b/docs/examples/mongo/list-backups.md new file mode 100644 index 00000000..dff1d39b --- /dev/null +++ b/docs/examples/mongo/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/list-branches.md b/docs/examples/mongo/list-branches.md new file mode 100644 index 00000000..9ab6cc52 --- /dev/null +++ b/docs/examples/mongo/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/mongo/list-operations.md b/docs/examples/mongo/list-operations.md new file mode 100644 index 00000000..93499975 --- /dev/null +++ b/docs/examples/mongo/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mongo/list-restorations.md b/docs/examples/mongo/list-restorations.md new file mode 100644 index 00000000..dc9be396 --- /dev/null +++ b/docs/examples/mongo/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mongo/list-specifications.md b/docs/examples/mongo/list-specifications.md new file mode 100644 index 00000000..dbd3d314 --- /dev/null +++ b/docs/examples/mongo/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_specifications() +``` diff --git a/docs/examples/mongo/list.md b/docs/examples/mongo/list.md new file mode 100644 index 00000000..72066bd8 --- /dev/null +++ b/docs/examples/mongo/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list( + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/update-backup-policy.md b/docs/examples/mongo/update-backup-policy.md new file mode 100644 index 00000000..6da9fe2b --- /dev/null +++ b/docs/examples/mongo/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mongo/update-backup-storage.md b/docs/examples/mongo/update-backup-storage.md new file mode 100644 index 00000000..2893e7e8 --- /dev/null +++ b/docs/examples/mongo/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/mongo/update-credentials.md b/docs/examples/mongo/update-credentials.md new file mode 100644 index 00000000..389f54ab --- /dev/null +++ b/docs/examples/mongo/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/mongo/update-maintenance.md b/docs/examples/mongo/update-maintenance.md new file mode 100644 index 00000000..075d5cc4 --- /dev/null +++ b/docs/examples/mongo/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/mongo/update.md b/docs/examples/mongo/update.md new file mode 100644 index 00000000..55f02acd --- /dev/null +++ b/docs/examples/mongo/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/mysql/create-backup-policy.md b/docs/examples/mysql/create-backup-policy.md new file mode 100644 index 00000000..c898944b --- /dev/null +++ b/docs/examples/mysql/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mysql/create-backup.md b/docs/examples/mysql/create-backup.md new file mode 100644 index 00000000..ec1168da --- /dev/null +++ b/docs/examples/mysql/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/mysql/create-branch.md b/docs/examples/mysql/create-branch.md new file mode 100644 index 00000000..b0d48db9 --- /dev/null +++ b/docs/examples/mysql/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/mysql/create-execution.md b/docs/examples/mysql/create-execution.md new file mode 100644 index 00000000..1384a502 --- /dev/null +++ b/docs/examples/mysql/create-execution.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_execution( + database_id: '', + sql: '', + bindings: {}, # optional + timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/mysql/create-failover.md b/docs/examples/mysql/create-failover.md new file mode 100644 index 00000000..d3b0bcfa --- /dev/null +++ b/docs/examples/mysql/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/mysql/create-migration.md b/docs/examples/mysql/create-migration.md new file mode 100644 index 00000000..3d5e5c35 --- /dev/null +++ b/docs/examples/mysql/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/mysql/create-restoration.md b/docs/examples/mysql/create-restoration.md new file mode 100644 index 00000000..ad5aa058 --- /dev/null +++ b/docs/examples/mysql/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/mysql/create-upgrade.md b/docs/examples/mysql/create-upgrade.md new file mode 100644 index 00000000..b2097232 --- /dev/null +++ b/docs/examples/mysql/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/mysql/create.md b/docs/examples/mysql/create.md new file mode 100644 index 00000000..a0dcdced --- /dev/null +++ b/docs/examples/mysql/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/mysql/delete-backup-policy.md b/docs/examples/mysql/delete-backup-policy.md new file mode 100644 index 00000000..b2f35a00 --- /dev/null +++ b/docs/examples/mysql/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mysql/delete-backup.md b/docs/examples/mysql/delete-backup.md new file mode 100644 index 00000000..b4e26762 --- /dev/null +++ b/docs/examples/mysql/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mysql/delete-branch.md b/docs/examples/mysql/delete-branch.md new file mode 100644 index 00000000..959b6290 --- /dev/null +++ b/docs/examples/mysql/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/mysql/delete.md b/docs/examples/mysql/delete.md new file mode 100644 index 00000000..aedde62e --- /dev/null +++ b/docs/examples/mysql/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-backup-policy.md b/docs/examples/mysql/get-backup-policy.md new file mode 100644 index 00000000..bec9f397 --- /dev/null +++ b/docs/examples/mysql/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mysql/get-backup.md b/docs/examples/mysql/get-backup.md new file mode 100644 index 00000000..286dfda6 --- /dev/null +++ b/docs/examples/mysql/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mysql/get-pitr.md b/docs/examples/mysql/get-pitr.md new file mode 100644 index 00000000..a5c48f67 --- /dev/null +++ b/docs/examples/mysql/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-pooler.md b/docs/examples/mysql/get-pooler.md new file mode 100644 index 00000000..5117f05b --- /dev/null +++ b/docs/examples/mysql/get-pooler.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_pooler( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-replicas.md b/docs/examples/mysql/get-replicas.md new file mode 100644 index 00000000..aa04c558 --- /dev/null +++ b/docs/examples/mysql/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-restoration.md b/docs/examples/mysql/get-restoration.md new file mode 100644 index 00000000..8794092d --- /dev/null +++ b/docs/examples/mysql/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/mysql/get-status.md b/docs/examples/mysql/get-status.md new file mode 100644 index 00000000..0031fa25 --- /dev/null +++ b/docs/examples/mysql/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_status( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get.md b/docs/examples/mysql/get.md new file mode 100644 index 00000000..2c41277d --- /dev/null +++ b/docs/examples/mysql/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get( + database_id: '' +) +``` diff --git a/docs/examples/mysql/list-backup-policies.md b/docs/examples/mysql/list-backup-policies.md new file mode 100644 index 00000000..1b2a50da --- /dev/null +++ b/docs/examples/mysql/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/list-backups.md b/docs/examples/mysql/list-backups.md new file mode 100644 index 00000000..bdc34556 --- /dev/null +++ b/docs/examples/mysql/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/list-branches.md b/docs/examples/mysql/list-branches.md new file mode 100644 index 00000000..92dcda4c --- /dev/null +++ b/docs/examples/mysql/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/mysql/list-operations.md b/docs/examples/mysql/list-operations.md new file mode 100644 index 00000000..afb542e5 --- /dev/null +++ b/docs/examples/mysql/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mysql/list-restorations.md b/docs/examples/mysql/list-restorations.md new file mode 100644 index 00000000..c242d763 --- /dev/null +++ b/docs/examples/mysql/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mysql/list-specifications.md b/docs/examples/mysql/list-specifications.md new file mode 100644 index 00000000..d0c56c6b --- /dev/null +++ b/docs/examples/mysql/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_specifications() +``` diff --git a/docs/examples/mysql/list.md b/docs/examples/mysql/list.md new file mode 100644 index 00000000..82de078a --- /dev/null +++ b/docs/examples/mysql/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list( + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/update-backup-policy.md b/docs/examples/mysql/update-backup-policy.md new file mode 100644 index 00000000..54bc9f64 --- /dev/null +++ b/docs/examples/mysql/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mysql/update-backup-storage.md b/docs/examples/mysql/update-backup-storage.md new file mode 100644 index 00000000..3545e390 --- /dev/null +++ b/docs/examples/mysql/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/mysql/update-credentials.md b/docs/examples/mysql/update-credentials.md new file mode 100644 index 00000000..6e4775ec --- /dev/null +++ b/docs/examples/mysql/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/mysql/update-maintenance.md b/docs/examples/mysql/update-maintenance.md new file mode 100644 index 00000000..026a0c63 --- /dev/null +++ b/docs/examples/mysql/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/mysql/update-pooler.md b/docs/examples/mysql/update-pooler.md new file mode 100644 index 00000000..7a4a1f03 --- /dev/null +++ b/docs/examples/mysql/update-pooler.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_pooler( + database_id: '', + mode: 'transaction', # optional + max_connections: 10, # optional + default_pool_size: 1, # optional + read_write_splitting: false, # optional + pooler_cpu_request: '', # optional + pooler_cpu_limit: '', # optional + pooler_memory_request: '', # optional + pooler_memory_limit: '' # optional +) +``` diff --git a/docs/examples/mysql/update.md b/docs/examples/mysql/update.md new file mode 100644 index 00000000..2ba792ea --- /dev/null +++ b/docs/examples/mysql/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/organization/create-project.md b/docs/examples/organization/create-project.md index ccc49ff0..95afd801 100644 --- a/docs/examples/organization/create-project.md +++ b/docs/examples/organization/create-project.md @@ -12,7 +12,7 @@ client = Client.new organization = Organization.new(client) result = organization.create_project( - project_id: '', + project_id: '', name: '', region: Region::FRA # optional ) diff --git a/docs/examples/postgresql/create-backup-policy.md b/docs/examples/postgresql/create-backup-policy.md new file mode 100644 index 00000000..871212ef --- /dev/null +++ b/docs/examples/postgresql/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/postgresql/create-backup.md b/docs/examples/postgresql/create-backup.md new file mode 100644 index 00000000..5439d2b3 --- /dev/null +++ b/docs/examples/postgresql/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/postgresql/create-branch.md b/docs/examples/postgresql/create-branch.md new file mode 100644 index 00000000..1ff35c7f --- /dev/null +++ b/docs/examples/postgresql/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/postgresql/create-execution.md b/docs/examples/postgresql/create-execution.md new file mode 100644 index 00000000..7359465d --- /dev/null +++ b/docs/examples/postgresql/create-execution.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_execution( + database_id: '', + sql: '', + bindings: {}, # optional + timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/postgresql/create-extension.md b/docs/examples/postgresql/create-extension.md new file mode 100644 index 00000000..c60554c2 --- /dev/null +++ b/docs/examples/postgresql/create-extension.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_extension( + database_id: '', + name: '' +) +``` diff --git a/docs/examples/postgresql/create-failover.md b/docs/examples/postgresql/create-failover.md new file mode 100644 index 00000000..17642ce9 --- /dev/null +++ b/docs/examples/postgresql/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/postgresql/create-migration.md b/docs/examples/postgresql/create-migration.md new file mode 100644 index 00000000..a8acf341 --- /dev/null +++ b/docs/examples/postgresql/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/postgresql/create-restoration.md b/docs/examples/postgresql/create-restoration.md new file mode 100644 index 00000000..b4a8e988 --- /dev/null +++ b/docs/examples/postgresql/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/postgresql/create-upgrade.md b/docs/examples/postgresql/create-upgrade.md new file mode 100644 index 00000000..0eeebbc6 --- /dev/null +++ b/docs/examples/postgresql/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/postgresql/create.md b/docs/examples/postgresql/create.md new file mode 100644 index 00000000..69a6033d --- /dev/null +++ b/docs/examples/postgresql/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/postgresql/delete-backup-policy.md b/docs/examples/postgresql/delete-backup-policy.md new file mode 100644 index 00000000..824f6a5b --- /dev/null +++ b/docs/examples/postgresql/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-backup.md b/docs/examples/postgresql/delete-backup.md new file mode 100644 index 00000000..d86c46ef --- /dev/null +++ b/docs/examples/postgresql/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-branch.md b/docs/examples/postgresql/delete-branch.md new file mode 100644 index 00000000..4ff43f2d --- /dev/null +++ b/docs/examples/postgresql/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-extension.md b/docs/examples/postgresql/delete-extension.md new file mode 100644 index 00000000..46873c52 --- /dev/null +++ b/docs/examples/postgresql/delete-extension.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_extension( + database_id: '', + extension_name: '' +) +``` diff --git a/docs/examples/postgresql/delete.md b/docs/examples/postgresql/delete.md new file mode 100644 index 00000000..b692ba5d --- /dev/null +++ b/docs/examples/postgresql/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-backup-policy.md b/docs/examples/postgresql/get-backup-policy.md new file mode 100644 index 00000000..674ed65a --- /dev/null +++ b/docs/examples/postgresql/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/postgresql/get-backup.md b/docs/examples/postgresql/get-backup.md new file mode 100644 index 00000000..19a4d6cc --- /dev/null +++ b/docs/examples/postgresql/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/postgresql/get-pitr.md b/docs/examples/postgresql/get-pitr.md new file mode 100644 index 00000000..9701c384 --- /dev/null +++ b/docs/examples/postgresql/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-pooler.md b/docs/examples/postgresql/get-pooler.md new file mode 100644 index 00000000..9bf12dd4 --- /dev/null +++ b/docs/examples/postgresql/get-pooler.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_pooler( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-replicas.md b/docs/examples/postgresql/get-replicas.md new file mode 100644 index 00000000..710a9630 --- /dev/null +++ b/docs/examples/postgresql/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-restoration.md b/docs/examples/postgresql/get-restoration.md new file mode 100644 index 00000000..075587a2 --- /dev/null +++ b/docs/examples/postgresql/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/postgresql/get-status.md b/docs/examples/postgresql/get-status.md new file mode 100644 index 00000000..0040a9ce --- /dev/null +++ b/docs/examples/postgresql/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_status( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get.md b/docs/examples/postgresql/get.md new file mode 100644 index 00000000..9c44154e --- /dev/null +++ b/docs/examples/postgresql/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-backup-policies.md b/docs/examples/postgresql/list-backup-policies.md new file mode 100644 index 00000000..2120ce92 --- /dev/null +++ b/docs/examples/postgresql/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/list-backups.md b/docs/examples/postgresql/list-backups.md new file mode 100644 index 00000000..28d47c90 --- /dev/null +++ b/docs/examples/postgresql/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/list-branches.md b/docs/examples/postgresql/list-branches.md new file mode 100644 index 00000000..65400567 --- /dev/null +++ b/docs/examples/postgresql/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-extensions.md b/docs/examples/postgresql/list-extensions.md new file mode 100644 index 00000000..e75a398e --- /dev/null +++ b/docs/examples/postgresql/list-extensions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_extensions( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-operations.md b/docs/examples/postgresql/list-operations.md new file mode 100644 index 00000000..b9629cfd --- /dev/null +++ b/docs/examples/postgresql/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/postgresql/list-restorations.md b/docs/examples/postgresql/list-restorations.md new file mode 100644 index 00000000..0ee5eced --- /dev/null +++ b/docs/examples/postgresql/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/postgresql/list-specifications.md b/docs/examples/postgresql/list-specifications.md new file mode 100644 index 00000000..90a473d6 --- /dev/null +++ b/docs/examples/postgresql/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_specifications() +``` diff --git a/docs/examples/postgresql/list.md b/docs/examples/postgresql/list.md new file mode 100644 index 00000000..729f2fe2 --- /dev/null +++ b/docs/examples/postgresql/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list( + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/update-backup-policy.md b/docs/examples/postgresql/update-backup-policy.md new file mode 100644 index 00000000..d1b40474 --- /dev/null +++ b/docs/examples/postgresql/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/postgresql/update-backup-storage.md b/docs/examples/postgresql/update-backup-storage.md new file mode 100644 index 00000000..546e1e7e --- /dev/null +++ b/docs/examples/postgresql/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/postgresql/update-credentials.md b/docs/examples/postgresql/update-credentials.md new file mode 100644 index 00000000..cab98e92 --- /dev/null +++ b/docs/examples/postgresql/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/update-maintenance.md b/docs/examples/postgresql/update-maintenance.md new file mode 100644 index 00000000..a8d5f797 --- /dev/null +++ b/docs/examples/postgresql/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/postgresql/update-pooler.md b/docs/examples/postgresql/update-pooler.md new file mode 100644 index 00000000..f6421f70 --- /dev/null +++ b/docs/examples/postgresql/update-pooler.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_pooler( + database_id: '', + mode: 'transaction', # optional + max_connections: 10, # optional + default_pool_size: 1, # optional + read_write_splitting: false, # optional + pooler_cpu_request: '', # optional + pooler_cpu_limit: '', # optional + pooler_memory_request: '', # optional + pooler_memory_limit: '' # optional +) +``` diff --git a/docs/examples/postgresql/update.md b/docs/examples/postgresql/update.md new file mode 100644 index 00000000..f43a9e88 --- /dev/null +++ b/docs/examples/postgresql/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-hugging-face.md b/docs/examples/project/update-o-auth-2-hugging-face.md new file mode 100644 index 00000000..a8d2adc8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-hugging-face.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_o_auth2_hugging_face( + client_id: '', # optional + client_secret: '', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index a020227c..44716551 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -13,7 +13,7 @@ project = Project.new(client) result = project.update_o_auth2_okta( client_id: '', # optional client_secret: '', # optional - domain: '', # optional + domain: 'example.com', # optional authorization_server_id: '', # optional enabled: false # optional ) diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index 7dda7710..0af3b32b 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -12,8 +12,8 @@ client = Client.new project = Project.new(client) result = project.update_smtp( - host: '', # optional - port: null, # optional + host: 'example.com', # optional + port: 587, # optional username: '', # optional password: 'password', # optional sender_email: 'email@example.com', # optional diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md index 8fe085ae..a69c1ec2 100644 --- a/docs/examples/proxy/create-api-rule.md +++ b/docs/examples/proxy/create-api-rule.md @@ -11,6 +11,6 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_api_rule( - domain: '' + domain: 'example.com' ) ``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md index b8202a03..2f65090b 100644 --- a/docs/examples/proxy/create-function-rule.md +++ b/docs/examples/proxy/create-function-rule.md @@ -11,7 +11,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_function_rule( - domain: '', + domain: 'example.com', function_id: '', branch: '' # optional ) diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md index 3b2858f4..e3e43f76 100644 --- a/docs/examples/proxy/create-invalidation.md +++ b/docs/examples/proxy/create-invalidation.md @@ -12,7 +12,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_invalidation( - domain: '', + domain: 'example.com', type: InvalidationType::TAG, reference: '' # optional ) diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index b07fb4a4..40a1ea4b 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -12,7 +12,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_redirect_rule( - domain: '', + domain: 'example.com', url: 'https://example.com', status_code: StatusCode::MOVEDPERMANENTLY, resource_id: '', diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md index 098ca4e5..c2570cb2 100644 --- a/docs/examples/proxy/create-site-rule.md +++ b/docs/examples/proxy/create-site-rule.md @@ -11,7 +11,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_site_rule( - domain: '', + domain: 'example.com', site_id: '', branch: '' # optional ) diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 8eccf032..9f8d7f7f 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -32,8 +32,9 @@ result = sites.create( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional - deployment_retention: 0 # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional + deployment_retention: 0, # optional + scopes: [ProjectKeyScopes::PROJECT_READ] # optional ) ``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 663dadca..56031c02 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -32,8 +32,9 @@ result = sites.update( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional - deployment_retention: 0 # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional + deployment_retention: 0, # optional + scopes: [ProjectKeyScopes::PROJECT_READ] # optional ) ``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index cef34640..8176563f 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -17,6 +17,6 @@ result = storage.create_file( file_id: '', file: InputFile.from_path('dir/file.png'), permissions: [Permission.read(Role.any())], # optional - folder: '' # optional + folder: 'photos/2026' # optional ) ``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 8db54e01..3b4ce03d 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -19,11 +19,11 @@ result = storage.get_file_preview( gravity: ImageGravity::CENTER, # optional quality: -1, # optional border_width: 0, # optional - border_color: '', # optional + border_color: 'FFFFFF', # optional border_radius: 0, # optional opacity: 0, # optional rotation: -360, # optional - background: '', # optional + background: 'FFFFFF', # optional output: ImageFormat::JPG, # optional token: '' # optional ) diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index 76c95298..8af04440 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_big_int_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 1000000, # optional + default: 0, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 4b7f65f3..f4bdf1b1 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_boolean_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: false, # optional array: false # optional diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 6599526e..e21b99b7 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_datetime_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index cd63c780..c7ed0fd7 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_email_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'email@example.com', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index e04eb0d8..6a2dafbe 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_enum_column( database_id: '', table_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', # optional + default: 'active', # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index cc3bf787..65fe0043 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_float_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10.5, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 7756a169..a0453818 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -14,7 +14,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_index( database_id: '', table_id: '', - key: '', + key: '', type: TablesDBIndexType::KEY, columns: [], orders: [OrderBy::ASC], # optional diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 347c1e00..8abb17a5 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_integer_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 5b0608c1..546f7818 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_ip_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: '192.0.2.0', # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 96e4d471..aaf75a36 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_line_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] # optional ) diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 0dac5eb8..f5a9318e 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_longtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index d7fdd047..e2bf27b7 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_mediumtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 8eeec983..1e52d6e5 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_point_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [1, 2] # optional ) diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index ab659f5c..c4719381 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_polygon_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] # optional ) diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index d2ca56fc..9b082036 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -17,8 +17,8 @@ result = tables_db.create_relationship_column( related_table_id: '', type: RelationshipType::ONETOONE, two_way: false, # optional - key: '', # optional - two_way_key: '', # optional + key: '', # optional + two_way_key: '', # optional on_delete: RelationMutate::CASCADE # optional ) ``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 11782e06..9f458688 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_string_column( database_id: '', table_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index e1133b19..aa7e59e2 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_text_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 385a830d..49671760 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_url_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'https://example.com', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index 04fc6c6a..a03b5b70 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_varchar_column( database_id: '', table_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index ff196104..7dfeb83b 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -14,9 +14,9 @@ result = tables_db.decrement_row_column( database_id: '', table_id: '', row_id: '', - column: '', - value: null, # optional - min: null, # optional + column: '', + value: 1, # optional + min: 0, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 0d056da1..697305ad 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.delete_column( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index cb46c804..78edab98 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.delete_index( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 65360e19..21865dd5 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.get_column( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 4404234d..78a49d38 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.get_index( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 20af30ab..c3295fda 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -14,9 +14,9 @@ result = tables_db.increment_row_column( database_id: '', table_id: '', row_id: '', - column: '', - value: null, # optional - max: null, # optional + column: '', + value: 1, # optional + max: 100, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md index ac41c176..e8a531fb 100644 --- a/docs/examples/tablesdb/list-operations.md +++ b/docs/examples/tablesdb/list-operations.md @@ -12,7 +12,7 @@ tables_db = TablesDB.new(client) result = tables_db.list_operations( database_id: '', - status: 'running', # optional + status: 'queued', # optional limit: 1, # optional offset: 0 # optional ) diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md index 2ce0077b..fea7bfdb 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_big_int_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 0, + min: 0, # optional + max: 1000000, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index ef935840..c55d1f21 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_boolean_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: false, - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 295139be..d50571db 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_datetime_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 1eda71c5..24b5ef62 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_email_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'email@example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 0a25c964..6204ac2b 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_enum_column( database_id: '', table_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - new_key: '' # optional + default: 'active', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 588ad1de..cd98ae90 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_float_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10.5, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 28d14397..1fd1e315 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_integer_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 097a3a27..9948c6f8 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_ip_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: '192.0.2.0', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index f6ca84c9..8b32b972 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_line_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index 1e7e027c..342ba998 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_longtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 507e4bc3..70c7bca5 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_mediumtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 1abaabcd..50ef5298 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_point_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [1, 2], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 47d452b6..e6bb0bce 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_polygon_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 289d675e..1bdbf618 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -14,8 +14,8 @@ tables_db = TablesDB.new(client) result = tables_db.update_relationship_column( database_id: '', table_id: '', - key: '', + key: '', on_delete: RelationMutate::CASCADE, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index ae5edad2..1a356d18 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_string_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index b3d21cb5..9e40c656 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_text_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index dfe2bd54..93197380 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_url_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'https://example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index 223a6819..99804b03 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_varchar_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 7df95fb7..bb940ab2 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -12,7 +12,7 @@ users = Users.new(client) result = users.create_jwt( user_id: '', - session_id: '', # optional + session_id: 'recent()', # optional duration: 0 # optional ) ``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 91a200c1..14d85cf4 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -15,10 +15,10 @@ result = users.create_scrypt_user( email: 'email@example.com', password: 'password', password_salt: '', - password_cpu: null, - password_memory: null, - password_parallel: null, - password_length: null, + password_cpu: 8, + password_memory: 65536, + password_parallel: 1, + password_length: 64, name: '' # optional ) ``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 00000000..b449f541 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_collection( + database_id: '', + collection_id: '', + name: '', + dimension: 1, + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 00000000..4ad9aa46 --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,32 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_document( + database_id: '', + collection_id: '', + document_id: '', + data: { + "embeddings" => { + "0" => 0.12, + "1" => -0.55, + "2" => 0.88, + "3" => 1.02 + }, + "metadata" => { + "key" => "value" + } + }, + permissions: [Permission.read(Role.any())] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 00000000..0fcac72b --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_documents( + database_id: '', + collection_id: '', + documents: [] +) +``` diff --git a/docs/examples/vectorsdb/create-failover.md b/docs/examples/vectorsdb/create-failover.md new file mode 100644 index 00000000..479cbfa4 --- /dev/null +++ b/docs/examples/vectorsdb/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 00000000..d7880ab2 --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_index( + database_id: '', + collection_id: '', + key: '', + type: VectorsDBIndexType::HNSW_EUCLIDEAN, + attributes: [], + orders: [OrderBy::ASC], # optional + lengths: [] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 00000000..6817930b --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,27 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_operations( + transaction_id: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-query.md b/docs/examples/vectorsdb/create-query.md new file mode 100644 index 00000000..917cdac2 --- /dev/null +++ b/docs/examples/vectorsdb/create-query.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_query( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 00000000..50925533 --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_transaction( + ttl: 60 # optional +) +``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 00000000..9166fc42 --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 00000000..fc3bd763 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 00000000..40718f32 --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_document( + database_id: '', + collection_id: '', + document_id: '', + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 00000000..bb1173a3 --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 00000000..b968f684 --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 00000000..4124aac3 --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 00000000..6be5631a --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 00000000..dae8e531 --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 00000000..49bfc862 --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_document( + database_id: '', + collection_id: '', + document_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 00000000..af722303 --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/vectorsdb/get-replicas.md b/docs/examples/vectorsdb/get-replicas.md new file mode 100644 index 00000000..d3d5d6f4 --- /dev/null +++ b/docs/examples/vectorsdb/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-status.md b/docs/examples/vectorsdb/get-status.md new file mode 100644 index 00000000..15f2ca33 --- /dev/null +++ b/docs/examples/vectorsdb/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_status( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 00000000..584134d6 --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 00000000..cea4329f --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 00000000..dc85e4ac --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_collections( + database_id: '', + queries: [], # optional + search: '', # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 00000000..c60da651 --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 00000000..2df5e682 --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_indexes( + database_id: '', + collection_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/list-operations.md b/docs/examples/vectorsdb/list-operations.md new file mode 100644 index 00000000..a6ec3a28 --- /dev/null +++ b/docs/examples/vectorsdb/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/list-specifications.md b/docs/examples/vectorsdb/list-specifications.md new file mode 100644 index 00000000..33380781 --- /dev/null +++ b/docs/examples/vectorsdb/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_specifications() +``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 00000000..9c2182da --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_transactions( + queries: [] # optional +) +``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 00000000..9f162854 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 00000000..0dfdac13 --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_collection( + database_id: '', + collection_id: '', + name: '', + dimension: 1, # optional + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 00000000..b4fdb373 --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 00000000..2f4d27a4 --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_documents( + database_id: '', + collection_id: '', + data: {}, # optional + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 00000000..96fbc93d --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_transaction( + transaction_id: '', + commit: false, # optional + rollback: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 00000000..dc8ccb0e --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 00000000..78889037 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.upsert_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 00000000..d737f107 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.upsert_documents( + database_id: '', + collection_id: '', + documents: [], + transaction_id: '' # optional +) +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 58177d5a..9f231f7b 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -12,7 +12,7 @@ webhooks = Webhooks.new(client) result = webhooks.create( webhook_id: '', - url: '', + url: 'https://example.com/webhook', name: '', events: [], enabled: false, # optional diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index d5d95428..ad3fa894 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -13,7 +13,7 @@ webhooks = Webhooks.new(client) result = webhooks.update( webhook_id: '', name: '', - url: '', + url: 'https://example.com/webhook', events: [], enabled: false, # optional tls: false, # optional diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 64a08f3b..80c58ed1 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -57,6 +57,7 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' +require_relative 'appwrite/models/vectorsdb_collection_list' require_relative 'appwrite/models/embedding_list' require_relative 'appwrite/models/insight_list' require_relative 'appwrite/models/report_list' @@ -82,6 +83,9 @@ require_relative 'appwrite/models/attribute_text' require_relative 'appwrite/models/attribute_mediumtext' require_relative 'appwrite/models/attribute_longtext' +require_relative 'appwrite/models/vectorsdb_collection' +require_relative 'appwrite/models/attribute_object' +require_relative 'appwrite/models/attribute_vector' require_relative 'appwrite/models/table' require_relative 'appwrite/models/column_list' require_relative 'appwrite/models/column_string' @@ -167,6 +171,7 @@ require_relative 'appwrite/models/o_auth2_notion' require_relative 'appwrite/models/o_auth2_salesforce' require_relative 'appwrite/models/o_auth2_yahoo' +require_relative 'appwrite/models/o_auth2_hugging_face' require_relative 'appwrite/models/o_auth2_linkedin' require_relative 'appwrite/models/o_auth2_disqus' require_relative 'appwrite/models/o_auth2_amazon' @@ -230,6 +235,9 @@ require_relative 'appwrite/models/activity_event' require_relative 'appwrite/models/additional_resource' require_relative 'appwrite/models/backup_archive' +require_relative 'appwrite/models/dedicated_database_backup' +require_relative 'appwrite/models/dedicated_database_backup_list' +require_relative 'appwrite/models/dedicated_database_backup_storage' require_relative 'appwrite/models/billing_limits' require_relative 'appwrite/models/billing_plan' require_relative 'appwrite/models/billing_plan_addon' @@ -238,22 +246,32 @@ require_relative 'appwrite/models/billing_plan_dedicated_database_limits' require_relative 'appwrite/models/billing_plan_supported_addons' require_relative 'appwrite/models/block' +require_relative 'appwrite/models/dedicated_database_branch' +require_relative 'appwrite/models/dedicated_database_branch_list' require_relative 'appwrite/models/database_migration' require_relative 'appwrite/models/dedicated_database' +require_relative 'appwrite/models/dedicated_database_execution' +require_relative 'appwrite/models/dedicated_database_execution_column' +require_relative 'appwrite/models/dedicated_database_restoration' require_relative 'appwrite/models/database_status' +require_relative 'appwrite/models/dedicated_database_extensions' require_relative 'appwrite/models/dedicated_database_member' require_relative 'appwrite/models/dedicated_database_operation' require_relative 'appwrite/models/dedicated_database_operation_list' require_relative 'appwrite/models/dedicated_database_replicas' require_relative 'appwrite/models/proxy_invalidation' require_relative 'appwrite/models/organization' +require_relative 'appwrite/models/dedicated_database_pitr_windows' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/policy_deny_aliased_email' require_relative 'appwrite/models/policy_deny_disposable_email' require_relative 'appwrite/models/policy_deny_free_email' require_relative 'appwrite/models/policy_deny_corporate_email' +require_relative 'appwrite/models/dedicated_database_pooler' +require_relative 'appwrite/models/postgres_extension' require_relative 'appwrite/models/program' require_relative 'appwrite/models/backup_restoration' +require_relative 'appwrite/models/dedicated_database_restoration_list' require_relative 'appwrite/models/dedicated_database_specification' require_relative 'appwrite/models/dedicated_database_specification_list' require_relative 'appwrite/models/dedicated_database_specification_pricing' @@ -287,6 +305,7 @@ require_relative 'appwrite/models/backup_policy_list' require_relative 'appwrite/models/backup_restoration_list' require_relative 'appwrite/models/database_migration_list' +require_relative 'appwrite/models/dedicated_database_list' require_relative 'appwrite/models/apps_list' require_relative 'appwrite/models/app_secret_list' require_relative 'appwrite/models/app_scope_list' @@ -308,6 +327,7 @@ require_relative 'appwrite/enums/relation_mutate' require_relative 'appwrite/enums/databases_index_type' require_relative 'appwrite/enums/order_by' +require_relative 'appwrite/enums/documents_db_index_type' require_relative 'appwrite/enums/embedding_model' require_relative 'appwrite/enums/runtime' require_relative 'appwrite/enums/project_key_scopes' @@ -340,12 +360,14 @@ require_relative 'appwrite/enums/tables_db_index_type' require_relative 'appwrite/enums/password_hash' require_relative 'appwrite/enums/messaging_provider_type' +require_relative 'appwrite/enums/vectors_db_index_type' require_relative 'appwrite/enums/database_type' require_relative 'appwrite/enums/database_status' require_relative 'appwrite/enums/attribute_status' require_relative 'appwrite/enums/column_status' require_relative 'appwrite/enums/index_status' require_relative 'appwrite/enums/deployment_status' +require_relative 'appwrite/enums/execution_resource_type' require_relative 'appwrite/enums/execution_trigger' require_relative 'appwrite/enums/execution_status' require_relative 'appwrite/enums/o_auth2_google_prompt' @@ -362,13 +384,17 @@ require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' +require_relative 'appwrite/services/documents_db' require_relative 'appwrite/services/embeddings' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/messaging' +require_relative 'appwrite/services/mongo' +require_relative 'appwrite/services/mysql' require_relative 'appwrite/services/oauth2' require_relative 'appwrite/services/organization' +require_relative 'appwrite/services/postgresql' require_relative 'appwrite/services/presences' require_relative 'appwrite/services/project' require_relative 'appwrite/services/proxy' @@ -379,4 +405,5 @@ require_relative 'appwrite/services/teams' require_relative 'appwrite/services/tokens' require_relative 'appwrite/services/users' +require_relative 'appwrite/services/vectors_db' require_relative 'appwrite/services/webhooks' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index dfaae3a3..0f7eb1bd 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true require 'net/http' require 'uri' @@ -7,15 +7,14 @@ module Appwrite class Client - def initialize - @chunk_size = 5*1024*1024 + @chunk_size = 5 * 1024 * 1024 @headers = { 'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION, - 'x-sdk-name'=> 'Ruby', - 'x-sdk-platform'=> 'server', - 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '27.0.0', + 'x-sdk-name' => 'Ruby', + 'x-sdk-platform' => 'server', + 'x-sdk-language' => 'ruby', + 'x-sdk-version' => '27.1.0.rc1', 'X-Appwrite-Response-Format' => '1.9.6' } @endpoint = 'https://cloud.appwrite.io/v1' @@ -310,6 +309,8 @@ def chunked_upload( chunks_uploaded = 0 if id_param_name&.empty? == false upload_id = params[id_param_name] + end + if upload_id && !upload_id.empty? # Make a request to check if a file already exists begin current = call( @@ -378,13 +379,14 @@ def chunked_upload( chunks_uploaded.to_i >= chunks_total.to_i end - on_progress.call({ + progress = { id: result['$id'], - progress: uploaded_size.to_f/size.to_f * 100.0, + progress: uploaded_size.to_f / size.to_f * 100.0, size_uploaded: uploaded_size, chunks_total: result['chunksTotal'] || total_chunks, chunks_uploaded: result['chunksUploaded'] || completed_count - }) unless on_progress.nil? + } + on_progress.call(progress) unless on_progress.nil? mutex = Mutex.new queue = Queue.new @@ -416,13 +418,14 @@ def chunked_upload( uploaded_size += chunk[:ending] - chunk[:start] last_result = chunk_result completed_result = chunk_result if upload_complete.call(chunk_result) - on_progress.call({ + progress = { id: upload_id, - progress: uploaded_size.to_f/size.to_f * 100.0, + progress: uploaded_size.to_f / size.to_f * 100.0, size_uploaded: uploaded_size, chunks_total: chunk_result['chunksTotal'] || total_chunks, chunks_uploaded: chunk_result['chunksUploaded'] || completed_count - }) unless on_progress.nil? + } + on_progress.call(progress) unless on_progress.nil? end end end @@ -461,13 +464,13 @@ def fetch( @boundary = "----A30#3ad1" if method != "GET" case headers[:'content-type'] - when 'application/json' - payload = params.to_json - when 'multipart/form-data' - payload = encode_form_data(params) + "--#{@boundary}--\r\n" - headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}" - else - payload = encode(params) + when 'application/json' + payload = params.to_json + when 'multipart/form-data' + payload = encode_form_data(params) + "--#{@boundary}--\r\n" + headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}" + else + payload = encode(params) end end @@ -524,10 +527,10 @@ def fetch( return response end - def encode_form_data(value, key=nil) + def encode_form_data(value, key = nil) case value when Hash - value.map { |k,v| encode_form_data(v,k) }.join + value.map { |k, v| encode_form_data(v, k) }.join when Array value.map { |v| encode_form_data(v, "#{key}[]") }.join when nil @@ -552,11 +555,11 @@ def encode_form_data(value, key=nil) def encode(value, key = nil) case value - when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&') + when Hash then value.map { |k, v| encode(v, append_key(key, k)) }.join('&') when Array then value.map { |v| encode(v, "#{key}[]") }.join('&') when nil then '' else - "#{key}=#{CGI.escape(value.to_s)}" + "#{key}=#{CGI.escape(value.to_s)}" end end diff --git a/lib/appwrite/enums/adapter.rb b/lib/appwrite/enums/adapter.rb index 3d660178..5dbb572b 100644 --- a/lib/appwrite/enums/adapter.rb +++ b/lib/appwrite/enums/adapter.rb @@ -5,4 +5,4 @@ module Adapter SSR = 'ssr' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/attribute_status.rb b/lib/appwrite/enums/attribute_status.rb index 62f35123..698150cb 100644 --- a/lib/appwrite/enums/attribute_status.rb +++ b/lib/appwrite/enums/attribute_status.rb @@ -8,4 +8,4 @@ module AttributeStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/authentication_factor.rb b/lib/appwrite/enums/authentication_factor.rb index 48669786..d596928c 100644 --- a/lib/appwrite/enums/authentication_factor.rb +++ b/lib/appwrite/enums/authentication_factor.rb @@ -8,4 +8,4 @@ module AuthenticationFactor CUSTOM = 'custom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/authenticator_type.rb b/lib/appwrite/enums/authenticator_type.rb index 3126e48f..fc5bd1a1 100644 --- a/lib/appwrite/enums/authenticator_type.rb +++ b/lib/appwrite/enums/authenticator_type.rb @@ -4,4 +4,4 @@ module AuthenticatorType TOTP = 'totp' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/backup_services.rb b/lib/appwrite/enums/backup_services.rb index 443e1e31..4d7969b9 100644 --- a/lib/appwrite/enums/backup_services.rb +++ b/lib/appwrite/enums/backup_services.rb @@ -10,4 +10,4 @@ module BackupServices STORAGE = 'storage' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/billing_plan_group.rb b/lib/appwrite/enums/billing_plan_group.rb index 053feaf3..343b49a8 100644 --- a/lib/appwrite/enums/billing_plan_group.rb +++ b/lib/appwrite/enums/billing_plan_group.rb @@ -6,4 +6,4 @@ module BillingPlanGroup SCALE = 'scale' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser.rb b/lib/appwrite/enums/browser.rb index 37b52ca1..24ba4177 100644 --- a/lib/appwrite/enums/browser.rb +++ b/lib/appwrite/enums/browser.rb @@ -17,4 +17,4 @@ module Browser OPERA_NEXT = 'on' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser_permission.rb b/lib/appwrite/enums/browser_permission.rb index e8dabece..751fbbc3 100644 --- a/lib/appwrite/enums/browser_permission.rb +++ b/lib/appwrite/enums/browser_permission.rb @@ -23,4 +23,4 @@ module BrowserPermission XR_SPATIAL_TRACKING = 'xr-spatial-tracking' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser_theme.rb b/lib/appwrite/enums/browser_theme.rb index 323fdac9..09d0e412 100644 --- a/lib/appwrite/enums/browser_theme.rb +++ b/lib/appwrite/enums/browser_theme.rb @@ -5,4 +5,4 @@ module BrowserTheme DARK = 'dark' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/build_runtime.rb b/lib/appwrite/enums/build_runtime.rb index ae67f362..0f1a8803 100644 --- a/lib/appwrite/enums/build_runtime.rb +++ b/lib/appwrite/enums/build_runtime.rb @@ -79,6 +79,7 @@ module BuildRuntime BUN_1_1 = 'bun-1.1' BUN_1_2 = 'bun-1.2' BUN_1_3 = 'bun-1.3' + BUN_1_4 = 'bun-1.4' GO_1_23 = 'go-1.23' GO_1_24 = 'go-1.24' GO_1_25 = 'go-1.25' @@ -95,4 +96,4 @@ module BuildRuntime FLUTTER_3_44 = 'flutter-3.44' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/column_status.rb b/lib/appwrite/enums/column_status.rb index 12f870ef..2588a2af 100644 --- a/lib/appwrite/enums/column_status.rb +++ b/lib/appwrite/enums/column_status.rb @@ -8,4 +8,4 @@ module ColumnStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/compression.rb b/lib/appwrite/enums/compression.rb index c15493f5..d3000cfa 100644 --- a/lib/appwrite/enums/compression.rb +++ b/lib/appwrite/enums/compression.rb @@ -6,4 +6,4 @@ module Compression ZSTD = 'zstd' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/credit_card.rb b/lib/appwrite/enums/credit_card.rb index 137bbfca..e86637f0 100644 --- a/lib/appwrite/enums/credit_card.rb +++ b/lib/appwrite/enums/credit_card.rb @@ -20,4 +20,4 @@ module CreditCard RUPAY = 'rupay' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/database_status.rb b/lib/appwrite/enums/database_status.rb index a35fbbc6..f0e5a013 100644 --- a/lib/appwrite/enums/database_status.rb +++ b/lib/appwrite/enums/database_status.rb @@ -17,4 +17,4 @@ module DatabaseStatus FAILING_OVER = 'failing-over' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/database_type.rb b/lib/appwrite/enums/database_type.rb index 1803082a..645ce2ca 100644 --- a/lib/appwrite/enums/database_type.rb +++ b/lib/appwrite/enums/database_type.rb @@ -10,4 +10,4 @@ module DatabaseType MONGODB = 'mongodb' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/databases_index_type.rb b/lib/appwrite/enums/databases_index_type.rb index ff4b7ff5..0dd80acc 100644 --- a/lib/appwrite/enums/databases_index_type.rb +++ b/lib/appwrite/enums/databases_index_type.rb @@ -7,4 +7,4 @@ module DatabasesIndexType SPATIAL = 'spatial' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/deployment_download_type.rb b/lib/appwrite/enums/deployment_download_type.rb index 4c8a60bc..359e6fd2 100644 --- a/lib/appwrite/enums/deployment_download_type.rb +++ b/lib/appwrite/enums/deployment_download_type.rb @@ -5,4 +5,4 @@ module DeploymentDownloadType OUTPUT = 'output' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/deployment_status.rb b/lib/appwrite/enums/deployment_status.rb index 92442c0c..8511130a 100644 --- a/lib/appwrite/enums/deployment_status.rb +++ b/lib/appwrite/enums/deployment_status.rb @@ -9,4 +9,4 @@ module DeploymentStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/documents_db_index_type.rb b/lib/appwrite/enums/documents_db_index_type.rb new file mode 100644 index 00000000..2436d807 --- /dev/null +++ b/lib/appwrite/enums/documents_db_index_type.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module DocumentsDBIndexType + KEY = 'key' + FULLTEXT = 'fulltext' + UNIQUE = 'unique' + end + end +end diff --git a/lib/appwrite/enums/embedding_model.rb b/lib/appwrite/enums/embedding_model.rb index 7fce0ea6..9a3ffc02 100644 --- a/lib/appwrite/enums/embedding_model.rb +++ b/lib/appwrite/enums/embedding_model.rb @@ -2,9 +2,7 @@ module Appwrite module Enums module EmbeddingModel NOMIC_EMBED_TEXT = 'nomic-embed-text' - EMBEDDING_GEMMA = 'embedding-gemma' ALL_MINILM = 'all-minilm' - BGE_SMALL = 'bge-small' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_method.rb b/lib/appwrite/enums/execution_method.rb index 2e810296..5b22dfcf 100644 --- a/lib/appwrite/enums/execution_method.rb +++ b/lib/appwrite/enums/execution_method.rb @@ -10,4 +10,4 @@ module ExecutionMethod HEAD = 'HEAD' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_resource_type.rb b/lib/appwrite/enums/execution_resource_type.rb new file mode 100644 index 00000000..9cd68f02 --- /dev/null +++ b/lib/appwrite/enums/execution_resource_type.rb @@ -0,0 +1,8 @@ +module Appwrite + module Enums + module ExecutionResourceType + FUNCTIONS = 'functions' + SITES = 'sites' + end + end +end diff --git a/lib/appwrite/enums/execution_status.rb b/lib/appwrite/enums/execution_status.rb index 301a6aed..793f8482 100644 --- a/lib/appwrite/enums/execution_status.rb +++ b/lib/appwrite/enums/execution_status.rb @@ -8,4 +8,4 @@ module ExecutionStatus SCHEDULED = 'scheduled' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_trigger.rb b/lib/appwrite/enums/execution_trigger.rb index e7cec9c3..59428c6d 100644 --- a/lib/appwrite/enums/execution_trigger.rb +++ b/lib/appwrite/enums/execution_trigger.rb @@ -6,4 +6,4 @@ module ExecutionTrigger EVENT = 'event' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/flag.rb b/lib/appwrite/enums/flag.rb index 8a92a401..89a53e49 100644 --- a/lib/appwrite/enums/flag.rb +++ b/lib/appwrite/enums/flag.rb @@ -198,4 +198,4 @@ module Flag ZIMBABWE = 'zw' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/framework.rb b/lib/appwrite/enums/framework.rb index b58f8cfb..6beab64f 100644 --- a/lib/appwrite/enums/framework.rb +++ b/lib/appwrite/enums/framework.rb @@ -18,4 +18,4 @@ module Framework OTHER = 'other' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/image_format.rb b/lib/appwrite/enums/image_format.rb index 3cd22ede..e0bc9c64 100644 --- a/lib/appwrite/enums/image_format.rb +++ b/lib/appwrite/enums/image_format.rb @@ -10,4 +10,4 @@ module ImageFormat GIF = 'gif' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/image_gravity.rb b/lib/appwrite/enums/image_gravity.rb index e30c8822..6eb0b5b1 100644 --- a/lib/appwrite/enums/image_gravity.rb +++ b/lib/appwrite/enums/image_gravity.rb @@ -12,4 +12,4 @@ module ImageGravity BOTTOM_RIGHT = 'bottom-right' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/index_status.rb b/lib/appwrite/enums/index_status.rb index 42819bdd..c276414a 100644 --- a/lib/appwrite/enums/index_status.rb +++ b/lib/appwrite/enums/index_status.rb @@ -8,4 +8,4 @@ module IndexStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/invalidation_type.rb b/lib/appwrite/enums/invalidation_type.rb index d8fca7c9..4b3d316a 100644 --- a/lib/appwrite/enums/invalidation_type.rb +++ b/lib/appwrite/enums/invalidation_type.rb @@ -6,4 +6,4 @@ module InvalidationType ALL = 'all' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/message_priority.rb b/lib/appwrite/enums/message_priority.rb index f0745ca1..42893cc2 100644 --- a/lib/appwrite/enums/message_priority.rb +++ b/lib/appwrite/enums/message_priority.rb @@ -5,4 +5,4 @@ module MessagePriority HIGH = 'high' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/message_status.rb b/lib/appwrite/enums/message_status.rb index 0821f5a8..341dbde6 100644 --- a/lib/appwrite/enums/message_status.rb +++ b/lib/appwrite/enums/message_status.rb @@ -8,4 +8,4 @@ module MessageStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/messaging_provider_type.rb b/lib/appwrite/enums/messaging_provider_type.rb index 4fc6d1f2..f4bc8992 100644 --- a/lib/appwrite/enums/messaging_provider_type.rb +++ b/lib/appwrite/enums/messaging_provider_type.rb @@ -6,4 +6,4 @@ module MessagingProviderType PUSH = 'push' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth2_google_prompt.rb b/lib/appwrite/enums/o_auth2_google_prompt.rb index 700ce954..5dcefdd6 100644 --- a/lib/appwrite/enums/o_auth2_google_prompt.rb +++ b/lib/appwrite/enums/o_auth2_google_prompt.rb @@ -6,4 +6,4 @@ module OAuth2GooglePrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth2_oidc_prompt.rb b/lib/appwrite/enums/o_auth2_oidc_prompt.rb index f07d5271..404bf395 100644 --- a/lib/appwrite/enums/o_auth2_oidc_prompt.rb +++ b/lib/appwrite/enums/o_auth2_oidc_prompt.rb @@ -7,4 +7,4 @@ module OAuth2OidcPrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth_provider.rb b/lib/appwrite/enums/o_auth_provider.rb index e2e27fa0..8cb20b5a 100644 --- a/lib/appwrite/enums/o_auth_provider.rb +++ b/lib/appwrite/enums/o_auth_provider.rb @@ -21,6 +21,7 @@ module OAuthProvider GITHUB = 'github' GITLAB = 'gitlab' GOOGLE = 'google' + HUGGINGFACE = 'huggingface' KEYCLOAK = 'keycloak' KICK = 'kick' LINKEDIN = 'linkedin' @@ -47,4 +48,4 @@ module OAuthProvider ZOOM = 'zoom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/order_by.rb b/lib/appwrite/enums/order_by.rb index 053de368..767684ca 100644 --- a/lib/appwrite/enums/order_by.rb +++ b/lib/appwrite/enums/order_by.rb @@ -5,4 +5,4 @@ module OrderBy DESC = 'desc' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/organization_key_scopes.rb b/lib/appwrite/enums/organization_key_scopes.rb index 92b7da23..9a8c7aa3 100644 --- a/lib/appwrite/enums/organization_key_scopes.rb +++ b/lib/appwrite/enums/organization_key_scopes.rb @@ -19,4 +19,4 @@ module OrganizationKeyScopes KEYS_WRITE = 'keys.write' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/password_hash.rb b/lib/appwrite/enums/password_hash.rb index 89e5d8b3..732fac06 100644 --- a/lib/appwrite/enums/password_hash.rb +++ b/lib/appwrite/enums/password_hash.rb @@ -14,4 +14,4 @@ module PasswordHash SHA3_512 = 'sha3-512' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/platform_type.rb b/lib/appwrite/enums/platform_type.rb index 49d8b127..df856cee 100644 --- a/lib/appwrite/enums/platform_type.rb +++ b/lib/appwrite/enums/platform_type.rb @@ -8,4 +8,4 @@ module PlatformType WEB = 'web' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_auth_method_id.rb b/lib/appwrite/enums/project_auth_method_id.rb index a442f73a..da27cbb7 100644 --- a/lib/appwrite/enums/project_auth_method_id.rb +++ b/lib/appwrite/enums/project_auth_method_id.rb @@ -10,4 +10,4 @@ module ProjectAuthMethodId PHONE = 'phone' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_email_template_id.rb b/lib/appwrite/enums/project_email_template_id.rb index 39773c0b..bfe21974 100644 --- a/lib/appwrite/enums/project_email_template_id.rb +++ b/lib/appwrite/enums/project_email_template_id.rb @@ -10,4 +10,4 @@ module ProjectEmailTemplateId OTPSESSION = 'otpSession' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_email_template_locale.rb b/lib/appwrite/enums/project_email_template_locale.rb index 6427f6c5..2355a3ef 100644 --- a/lib/appwrite/enums/project_email_template_locale.rb +++ b/lib/appwrite/enums/project_email_template_locale.rb @@ -134,4 +134,4 @@ module ProjectEmailTemplateLocale ZU = 'zu' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index 7a7670c9..4052d94d 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -3,6 +3,7 @@ module Enums module ProjectKeyScopes PROJECT_READ = 'project.read' PROJECT_WRITE = 'project.write' + USAGE_READ = 'usage.read' KEYS_READ = 'keys.read' KEYS_WRITE = 'keys.write' PLATFORMS_READ = 'platforms.read' @@ -42,6 +43,18 @@ module ProjectKeyScopes ATTRIBUTES_WRITE = 'attributes.write' DOCUMENTS_READ = 'documents.read' DOCUMENTS_WRITE = 'documents.write' + DOCUMENTSDB_READ = 'documentsdb.read' + DOCUMENTSDB_WRITE = 'documentsdb.write' + DOCUMENTSDB_COLLECTIONS_READ = 'documentsdb.collections.read' + DOCUMENTSDB_COLLECTIONS_WRITE = 'documentsdb.collections.write' + DOCUMENTSDB_DOCUMENTS_READ = 'documentsdb.documents.read' + DOCUMENTSDB_DOCUMENTS_WRITE = 'documentsdb.documents.write' + VECTORSDB_READ = 'vectorsdb.read' + VECTORSDB_WRITE = 'vectorsdb.write' + VECTORSDB_COLLECTIONS_READ = 'vectorsdb.collections.read' + VECTORSDB_COLLECTIONS_WRITE = 'vectorsdb.collections.write' + VECTORSDB_DOCUMENTS_READ = 'vectorsdb.documents.read' + VECTORSDB_DOCUMENTS_WRITE = 'vectorsdb.documents.write' BUCKETS_READ = 'buckets.read' BUCKETS_WRITE = 'buckets.write' FILES_READ = 'files.read' @@ -94,7 +107,6 @@ module ProjectKeyScopes ARCHIVES_WRITE = 'archives.write' RESTORATIONS_READ = 'restorations.read' RESTORATIONS_WRITE = 'restorations.write' - DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute' DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' WAFRULES_READ = 'wafRules.read' @@ -106,7 +118,6 @@ module ProjectKeyScopes OAUTH2_READ = 'oauth2.read' OAUTH2_WRITE = 'oauth2.write' OAUTH2_INTROSPECT = 'oauth2.introspect' - USAGE_READ = 'usage.read' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth2_google_prompt.rb b/lib/appwrite/enums/project_o_auth2_google_prompt.rb index 4effa049..0c4ac3b0 100644 --- a/lib/appwrite/enums/project_o_auth2_google_prompt.rb +++ b/lib/appwrite/enums/project_o_auth2_google_prompt.rb @@ -6,4 +6,4 @@ module ProjectOAuth2GooglePrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb index 268b2b9f..6689d1b0 100644 --- a/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb +++ b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb @@ -7,4 +7,4 @@ module ProjectOAuth2OidcPrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth_provider_id.rb b/lib/appwrite/enums/project_o_auth_provider_id.rb index 44adb565..ae433e08 100644 --- a/lib/appwrite/enums/project_o_auth_provider_id.rb +++ b/lib/appwrite/enums/project_o_auth_provider_id.rb @@ -21,6 +21,7 @@ module ProjectOAuthProviderId GITHUB = 'github' GITLAB = 'gitlab' GOOGLE = 'google' + HUGGINGFACE = 'huggingface' KEYCLOAK = 'keycloak' KICK = 'kick' LINKEDIN = 'linkedin' @@ -47,4 +48,4 @@ module ProjectOAuthProviderId ZOOM = 'zoom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_policy_id.rb b/lib/appwrite/enums/project_policy_id.rb index d3052189..a844aaf0 100644 --- a/lib/appwrite/enums/project_policy_id.rb +++ b/lib/appwrite/enums/project_policy_id.rb @@ -18,4 +18,4 @@ module ProjectPolicyId DENY_CORPORATE_EMAIL = 'deny-corporate-email' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_protocol_id.rb b/lib/appwrite/enums/project_protocol_id.rb index f3948b68..fbfaba82 100644 --- a/lib/appwrite/enums/project_protocol_id.rb +++ b/lib/appwrite/enums/project_protocol_id.rb @@ -6,4 +6,4 @@ module ProjectProtocolId WEBSOCKET = 'websocket' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_service_id.rb b/lib/appwrite/enums/project_service_id.rb index 871e9241..c7c40292 100644 --- a/lib/appwrite/enums/project_service_id.rb +++ b/lib/appwrite/enums/project_service_id.rb @@ -22,4 +22,4 @@ module ProjectServiceId OAUTH2 = 'oauth2' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_smtp_secure.rb b/lib/appwrite/enums/project_smtp_secure.rb index 0166b215..5a083d06 100644 --- a/lib/appwrite/enums/project_smtp_secure.rb +++ b/lib/appwrite/enums/project_smtp_secure.rb @@ -5,4 +5,4 @@ module ProjectSMTPSecure SSL = 'ssl' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_resource_type.rb b/lib/appwrite/enums/proxy_resource_type.rb index 9518515b..a1ed4611 100644 --- a/lib/appwrite/enums/proxy_resource_type.rb +++ b/lib/appwrite/enums/proxy_resource_type.rb @@ -5,4 +5,4 @@ module ProxyResourceType FUNCTION = 'function' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb b/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb index a532af84..89a76ba5 100644 --- a/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +++ b/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb @@ -5,4 +5,4 @@ module ProxyRuleDeploymentResourceType SITE = 'site' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_rule_status.rb b/lib/appwrite/enums/proxy_rule_status.rb index 50ee0fa3..83cc4209 100644 --- a/lib/appwrite/enums/proxy_rule_status.rb +++ b/lib/appwrite/enums/proxy_rule_status.rb @@ -6,4 +6,4 @@ module ProxyRuleStatus VERIFIED = 'verified' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/region.rb b/lib/appwrite/enums/region.rb index a17d0ade..9ae0aadb 100644 --- a/lib/appwrite/enums/region.rb +++ b/lib/appwrite/enums/region.rb @@ -9,4 +9,4 @@ module Region TOR = 'tor' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/relation_mutate.rb b/lib/appwrite/enums/relation_mutate.rb index 3f9ab226..68bebf4b 100644 --- a/lib/appwrite/enums/relation_mutate.rb +++ b/lib/appwrite/enums/relation_mutate.rb @@ -6,4 +6,4 @@ module RelationMutate SETNULL = 'setNull' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/relationship_type.rb b/lib/appwrite/enums/relationship_type.rb index 642ff384..330eba33 100644 --- a/lib/appwrite/enums/relationship_type.rb +++ b/lib/appwrite/enums/relationship_type.rb @@ -7,4 +7,4 @@ module RelationshipType ONETOMANY = 'oneToMany' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/runtime.rb b/lib/appwrite/enums/runtime.rb index bf2c4e20..ed615ec7 100644 --- a/lib/appwrite/enums/runtime.rb +++ b/lib/appwrite/enums/runtime.rb @@ -79,6 +79,7 @@ module Runtime BUN_1_1 = 'bun-1.1' BUN_1_2 = 'bun-1.2' BUN_1_3 = 'bun-1.3' + BUN_1_4 = 'bun-1.4' GO_1_23 = 'go-1.23' GO_1_24 = 'go-1.24' GO_1_25 = 'go-1.25' @@ -95,4 +96,4 @@ module Runtime FLUTTER_3_44 = 'flutter-3.44' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/smtp_encryption.rb b/lib/appwrite/enums/smtp_encryption.rb index bc162b41..f1d98559 100644 --- a/lib/appwrite/enums/smtp_encryption.rb +++ b/lib/appwrite/enums/smtp_encryption.rb @@ -6,4 +6,4 @@ module SmtpEncryption TLS = 'tls' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/status_code.rb b/lib/appwrite/enums/status_code.rb index 14f5902c..c7e50675 100644 --- a/lib/appwrite/enums/status_code.rb +++ b/lib/appwrite/enums/status_code.rb @@ -7,4 +7,4 @@ module StatusCode PERMANENTREDIRECT = '308' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/tables_db_index_type.rb b/lib/appwrite/enums/tables_db_index_type.rb index b8ccea6b..6be77a52 100644 --- a/lib/appwrite/enums/tables_db_index_type.rb +++ b/lib/appwrite/enums/tables_db_index_type.rb @@ -7,4 +7,4 @@ module TablesDBIndexType SPATIAL = 'spatial' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/template_reference_type.rb b/lib/appwrite/enums/template_reference_type.rb index 4fe8a4cf..76d6aec5 100644 --- a/lib/appwrite/enums/template_reference_type.rb +++ b/lib/appwrite/enums/template_reference_type.rb @@ -6,4 +6,4 @@ module TemplateReferenceType TAG = 'tag' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/timezone.rb b/lib/appwrite/enums/timezone.rb index be558b65..03bcb8a7 100644 --- a/lib/appwrite/enums/timezone.rb +++ b/lib/appwrite/enums/timezone.rb @@ -422,4 +422,4 @@ module Timezone UTC = 'utc' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/vcs_reference_type.rb b/lib/appwrite/enums/vcs_reference_type.rb index d34529a8..0e2a81fa 100644 --- a/lib/appwrite/enums/vcs_reference_type.rb +++ b/lib/appwrite/enums/vcs_reference_type.rb @@ -6,4 +6,4 @@ module VCSReferenceType TAG = 'tag' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/vectors_db_index_type.rb b/lib/appwrite/enums/vectors_db_index_type.rb new file mode 100644 index 00000000..ae63eaf0 --- /dev/null +++ b/lib/appwrite/enums/vectors_db_index_type.rb @@ -0,0 +1,12 @@ +module Appwrite + module Enums + module VectorsDBIndexType + HNSW_EUCLIDEAN = 'hnsw_euclidean' + HNSW_DOT = 'hnsw_dot' + HNSW_COSINE = 'hnsw_cosine' + OBJECT = 'object' + KEY = 'key' + UNIQUE = 'unique' + end + end +end diff --git a/lib/appwrite/exception.rb b/lib/appwrite/exception.rb index d6d86831..ed8bb1ee 100644 --- a/lib/appwrite/exception.rb +++ b/lib/appwrite/exception.rb @@ -3,7 +3,7 @@ class Exception < StandardError attr_reader :code attr_reader :response attr_reader :type - + def initialize(message, code = 0, type = nil, response = nil) super(message) @code = code diff --git a/lib/appwrite/id.rb b/lib/appwrite/id.rb index f98ea1d6..eb95084c 100644 --- a/lib/appwrite/id.rb +++ b/lib/appwrite/id.rb @@ -7,15 +7,15 @@ def self.custom(id) end # Generate a unique ID with padding to have a longer ID - def self.unique(padding=7) + def self.unique(padding = 7) base_id = self.hex_timestamp random_padding = SecureRandom.hex(padding) random_padding = random_padding[0...padding] base_id + random_padding end - #Generate an hex ID based on timestamp - #Recreated from https://www.php.net/manual/en/function.uniqid.php + # Generate an hex ID based on timestamp + # Recreated from https://www.php.net/manual/en/function.uniqid.php private_class_method def self.hex_timestamp now = Time.now sec = now.to_i diff --git a/lib/appwrite/input_file.rb b/lib/appwrite/input_file.rb index a704353a..d70df5d6 100644 --- a/lib/appwrite/input_file.rb +++ b/lib/appwrite/input_file.rb @@ -30,4 +30,4 @@ def self.from_bytes(bytes, filename: nil, mime_type: nil) self.from_string(bytes.pack('C*'), filename: filename, mime_type: mime_type) end end -end \ No newline at end of file +end diff --git a/lib/appwrite/models/activity_event.rb b/lib/appwrite/models/activity_event.rb index 3a000a25..34699a2b 100644 --- a/lib/appwrite/models/activity_event.rb +++ b/lib/appwrite/models/activity_event.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/activity_event_list.rb b/lib/appwrite/models/activity_event_list.rb index 2465bacc..6c8ebfe3 100644 --- a/lib/appwrite/models/activity_event_list.rb +++ b/lib/appwrite/models/activity_event_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/additional_resource.rb b/lib/appwrite/models/additional_resource.rb index 23e5402e..54d3ad41 100644 --- a/lib/appwrite/models/additional_resource.rb +++ b/lib/appwrite/models/additional_resource.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_argon2.rb b/lib/appwrite/models/algo_argon2.rb index c4f6b805..d2413e72 100644 --- a/lib/appwrite/models/algo_argon2.rb +++ b/lib/appwrite/models/algo_argon2.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_bcrypt.rb b/lib/appwrite/models/algo_bcrypt.rb index 78f17326..0407c819 100644 --- a/lib/appwrite/models/algo_bcrypt.rb +++ b/lib/appwrite/models/algo_bcrypt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_md5.rb b/lib/appwrite/models/algo_md5.rb index 64f3505b..d7f315c9 100644 --- a/lib/appwrite/models/algo_md5.rb +++ b/lib/appwrite/models/algo_md5.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_phpass.rb b/lib/appwrite/models/algo_phpass.rb index 45ccc1e7..496d2065 100644 --- a/lib/appwrite/models/algo_phpass.rb +++ b/lib/appwrite/models/algo_phpass.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_scrypt.rb b/lib/appwrite/models/algo_scrypt.rb index 48419d2d..7128bb2f 100644 --- a/lib/appwrite/models/algo_scrypt.rb +++ b/lib/appwrite/models/algo_scrypt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_scrypt_modified.rb b/lib/appwrite/models/algo_scrypt_modified.rb index 33b31daf..8862154c 100644 --- a/lib/appwrite/models/algo_scrypt_modified.rb +++ b/lib/appwrite/models/algo_scrypt_modified.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_sha.rb b/lib/appwrite/models/algo_sha.rb index e63ac763..bd227d57 100644 --- a/lib/appwrite/models/algo_sha.rb +++ b/lib/appwrite/models/algo_sha.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app.rb b/lib/appwrite/models/app.rb index e0337643..5123fbd9 100644 --- a/lib/appwrite/models/app.rb +++ b/lib/appwrite/models/app.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_installation.rb b/lib/appwrite/models/app_installation.rb index e369d232..32a12a3e 100644 --- a/lib/appwrite/models/app_installation.rb +++ b/lib/appwrite/models/app_installation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( authorization_details:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_installation_list.rb b/lib/appwrite/models/app_installation_list.rb index 1c0f16fa..d59981cc 100644 --- a/lib/appwrite/models/app_installation_list.rb +++ b/lib/appwrite/models/app_installation_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_key.rb b/lib/appwrite/models/app_key.rb index a9f1c28a..f1a457f8 100644 --- a/lib/appwrite/models/app_key.rb +++ b/lib/appwrite/models/app_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_key_list.rb b/lib/appwrite/models/app_key_list.rb index 6d3198f5..3ec9ecd7 100644 --- a/lib/appwrite/models/app_key_list.rb +++ b/lib/appwrite/models/app_key_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_scope.rb b/lib/appwrite/models/app_scope.rb index 5044bb68..c12c0ccc 100644 --- a/lib/appwrite/models/app_scope.rb +++ b/lib/appwrite/models/app_scope.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_scope_list.rb b/lib/appwrite/models/app_scope_list.rb index 21d13fb8..8a7b772b 100644 --- a/lib/appwrite/models/app_scope_list.rb +++ b/lib/appwrite/models/app_scope_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_secret.rb b/lib/appwrite/models/app_secret.rb index 7f5aa95a..4170d66c 100644 --- a/lib/appwrite/models/app_secret.rb +++ b/lib/appwrite/models/app_secret.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_secret_list.rb b/lib/appwrite/models/app_secret_list.rb index 09a33029..d4da1d58 100644 --- a/lib/appwrite/models/app_secret_list.rb +++ b/lib/appwrite/models/app_secret_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_secret_plaintext.rb b/lib/appwrite/models/app_secret_plaintext.rb index 9060824f..d36c260a 100644 --- a/lib/appwrite/models/app_secret_plaintext.rb +++ b/lib/appwrite/models/app_secret_plaintext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/apps_list.rb b/lib/appwrite/models/apps_list.rb index cf911684..354957bc 100644 --- a/lib/appwrite/models/apps_list.rb +++ b/lib/appwrite/models/apps_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/attribute_bigint.rb b/lib/appwrite/models/attribute_bigint.rb index b564ca60..b2286d7a 100644 --- a/lib/appwrite/models/attribute_bigint.rb +++ b/lib/appwrite/models/attribute_bigint.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_boolean.rb b/lib/appwrite/models/attribute_boolean.rb index a2ddaa1a..145da450 100644 --- a/lib/appwrite/models/attribute_boolean.rb +++ b/lib/appwrite/models/attribute_boolean.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_datetime.rb b/lib/appwrite/models/attribute_datetime.rb index af298fe7..2cd2387e 100644 --- a/lib/appwrite/models/attribute_datetime.rb +++ b/lib/appwrite/models/attribute_datetime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_email.rb b/lib/appwrite/models/attribute_email.rb index 701a48c4..d3dc9589 100644 --- a/lib/appwrite/models/attribute_email.rb +++ b/lib/appwrite/models/attribute_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_enum.rb b/lib/appwrite/models/attribute_enum.rb index 4659cb86..758db16d 100644 --- a/lib/appwrite/models/attribute_enum.rb +++ b/lib/appwrite/models/attribute_enum.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, elements:, format:, - default: + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_float.rb b/lib/appwrite/models/attribute_float.rb index da0155fb..fd4c2581 100644 --- a/lib/appwrite/models/attribute_float.rb +++ b/lib/appwrite/models/attribute_float.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_integer.rb b/lib/appwrite/models/attribute_integer.rb index 984c3373..0707b347 100644 --- a/lib/appwrite/models/attribute_integer.rb +++ b/lib/appwrite/models/attribute_integer.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_ip.rb b/lib/appwrite/models/attribute_ip.rb index e5a56fb2..4ac5e3b2 100644 --- a/lib/appwrite/models/attribute_ip.rb +++ b/lib/appwrite/models/attribute_ip.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_line.rb b/lib/appwrite/models/attribute_line.rb index aa410b6d..23cda309 100644 --- a/lib/appwrite/models/attribute_line.rb +++ b/lib/appwrite/models/attribute_line.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_list.rb b/lib/appwrite/models/attribute_list.rb index a93c5589..4aafafbc 100644 --- a/lib/appwrite/models/attribute_list.rb +++ b/lib/appwrite/models/attribute_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/attribute_longtext.rb b/lib/appwrite/models/attribute_longtext.rb index 51607c89..55922b0a 100644 --- a/lib/appwrite/models/attribute_longtext.rb +++ b/lib/appwrite/models/attribute_longtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_mediumtext.rb b/lib/appwrite/models/attribute_mediumtext.rb index eafa3cf8..0dea9331 100644 --- a/lib/appwrite/models/attribute_mediumtext.rb +++ b/lib/appwrite/models/attribute_mediumtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_object.rb b/lib/appwrite/models/attribute_object.rb new file mode 100644 index 00000000..ab85153d --- /dev/null +++ b/lib/appwrite/models/attribute_object.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class AttributeObject + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :required + attr_reader :array + attr_reader :created_at + attr_reader :updated_at + + def initialize( + key:, + type:, + status:, + error:, + required:, + array:, + created_at:, + updated_at: + ) + @key = key + @type = type + @status = validate_status(status) + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + end + + def self.from(map:) + AttributeObject.new( + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + required: map["required"], + array: map["array"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at + } + end + + private + + def validate_status(status) + valid_status = [ + Appwrite::Enums::AttributeStatus::AVAILABLE, + Appwrite::Enums::AttributeStatus::PROCESSING, + Appwrite::Enums::AttributeStatus::DELETING, + Appwrite::Enums::AttributeStatus::STUCK, + Appwrite::Enums::AttributeStatus::FAILED, + ] + + unless valid_status.include?(status) + raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') + end + + status + end + end + end +end diff --git a/lib/appwrite/models/attribute_point.rb b/lib/appwrite/models/attribute_point.rb index 27f4257c..b236cb17 100644 --- a/lib/appwrite/models/attribute_point.rb +++ b/lib/appwrite/models/attribute_point.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_polygon.rb b/lib/appwrite/models/attribute_polygon.rb index a0b62c42..44ce447a 100644 --- a/lib/appwrite/models/attribute_polygon.rb +++ b/lib/appwrite/models/attribute_polygon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_relationship.rb b/lib/appwrite/models/attribute_relationship.rb index 47e783fa..9b8da81c 100644 --- a/lib/appwrite/models/attribute_relationship.rb +++ b/lib/appwrite/models/attribute_relationship.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, related_collection:, @@ -105,7 +105,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_string.rb b/lib/appwrite/models/attribute_string.rb index 82f1df53..e5e27203 100644 --- a/lib/appwrite/models/attribute_string.rb +++ b/lib/appwrite/models/attribute_string.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_text.rb b/lib/appwrite/models/attribute_text.rb index 7a45111c..3997ad15 100644 --- a/lib/appwrite/models/attribute_text.rb +++ b/lib/appwrite/models/attribute_text.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_url.rb b/lib/appwrite/models/attribute_url.rb index 0e9dcc03..2353dc79 100644 --- a/lib/appwrite/models/attribute_url.rb +++ b/lib/appwrite/models/attribute_url.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_varchar.rb b/lib/appwrite/models/attribute_varchar.rb index c318b9af..3720b0e0 100644 --- a/lib/appwrite/models/attribute_varchar.rb +++ b/lib/appwrite/models/attribute_varchar.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_vector.rb b/lib/appwrite/models/attribute_vector.rb new file mode 100644 index 00000000..3954eefd --- /dev/null +++ b/lib/appwrite/models/attribute_vector.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class AttributeVector + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :required + attr_reader :array + attr_reader :created_at + attr_reader :updated_at + attr_reader :size + + def initialize( + key:, + type:, + status:, + error:, + required:, + array:, + created_at:, + updated_at:, + size: + ) + @key = key + @type = type + @status = validate_status(status) + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @size = size + end + + def self.from(map:) + AttributeVector.new( + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + required: map["required"], + array: map["array"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + size: map["size"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "size": @size + } + end + + private + + def validate_status(status) + valid_status = [ + Appwrite::Enums::AttributeStatus::AVAILABLE, + Appwrite::Enums::AttributeStatus::PROCESSING, + Appwrite::Enums::AttributeStatus::DELETING, + Appwrite::Enums::AttributeStatus::STUCK, + Appwrite::Enums::AttributeStatus::FAILED, + ] + + unless valid_status.include?(status) + raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') + end + + status + end + end + end +end diff --git a/lib/appwrite/models/backup_archive.rb b/lib/appwrite/models/backup_archive.rb index f8cb5984..71ea159d 100644 --- a/lib/appwrite/models/backup_archive.rb +++ b/lib/appwrite/models/backup_archive.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -27,8 +27,8 @@ def initialize( migration_id:, services:, resources:, - resource_id: , - resource_type: + resource_id:, + resource_type: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/backup_archive_list.rb b/lib/appwrite/models/backup_archive_list.rb index 40d4a3cd..9c0cc7cc 100644 --- a/lib/appwrite/models/backup_archive_list.rb +++ b/lib/appwrite/models/backup_archive_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_policy.rb b/lib/appwrite/models/backup_policy.rb index abbe49c6..6e8e0376 100644 --- a/lib/appwrite/models/backup_policy.rb +++ b/lib/appwrite/models/backup_policy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -23,8 +23,8 @@ def initialize( updated_at:, services:, resources:, - resource_id: , - resource_type: , + resource_id:, + resource_type:, retention:, schedule:, type:, diff --git a/lib/appwrite/models/backup_policy_list.rb b/lib/appwrite/models/backup_policy_list.rb index b7790d22..d5de4a5d 100644 --- a/lib/appwrite/models/backup_policy_list.rb +++ b/lib/appwrite/models/backup_policy_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_restoration.rb b/lib/appwrite/models/backup_restoration.rb index 669e6cb0..61eb62f4 100644 --- a/lib/appwrite/models/backup_restoration.rb +++ b/lib/appwrite/models/backup_restoration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_restoration_list.rb b/lib/appwrite/models/backup_restoration_list.rb index 102e8401..671e135b 100644 --- a/lib/appwrite/models/backup_restoration_list.rb +++ b/lib/appwrite/models/backup_restoration_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/billing_limits.rb b/lib/appwrite/models/billing_limits.rb index fa7f3ea6..ef61643b 100644 --- a/lib/appwrite/models/billing_limits.rb +++ b/lib/appwrite/models/billing_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,14 +13,14 @@ class BillingLimits attr_reader :budget_limit def initialize( - bandwidth: , - storage: , - users: , - executions: , - gb_hours: , - image_transformations: , - auth_phone: , - budget_limit: + bandwidth:, + storage:, + users:, + executions:, + gb_hours:, + image_transformations:, + auth_phone:, + budget_limit: ) @bandwidth = bandwidth @storage = storage diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index 5e7bd7d8..b56d1473 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -56,6 +56,7 @@ class BillingPlan attr_reader :supports_mock_numbers attr_reader :supports_organization_roles attr_reader :supports_credits + attr_reader :supports_dedicated_databases attr_reader :supports_disposable_email_validation attr_reader :supports_canonical_email_validation attr_reader :supports_free_email_validation @@ -71,6 +72,7 @@ class BillingPlan attr_reader :limits attr_reader :group attr_reader :program + attr_reader :database_compute_credit attr_reader :dedicated_databases def initialize( @@ -84,7 +86,7 @@ def initialize( storage:, image_transformations:, screenshots_generated:, - members: , + members:, webhooks:, waf_rules:, projects:, @@ -108,9 +110,9 @@ def initialize( topics:, auth_phone:, domains:, - activity_logs: , + activity_logs:, usage_logs:, - usage_logs_intervals: , + usage_logs_intervals:, project_inactivity_days:, alert_limit:, usage:, @@ -127,22 +129,24 @@ def initialize( supports_mock_numbers:, supports_organization_roles:, supports_credits:, + supports_dedicated_databases:, supports_disposable_email_validation:, supports_canonical_email_validation:, supports_free_email_validation:, supports_corporate_email_validation:, supports_project_specific_roles:, - backups_enabled: , + backups_enabled:, usage_per_project:, supported_addons:, - backup_policies: , + backup_policies:, deployment_size:, build_size:, databases_allow_encrypt:, - limits: , + limits:, group:, - program: , - dedicated_databases: + program:, + database_compute_credit:, + dedicated_databases: ) @id = id @name = name @@ -197,6 +201,7 @@ def initialize( @supports_mock_numbers = supports_mock_numbers @supports_organization_roles = supports_organization_roles @supports_credits = supports_credits + @supports_dedicated_databases = supports_dedicated_databases @supports_disposable_email_validation = supports_disposable_email_validation @supports_canonical_email_validation = supports_canonical_email_validation @supports_free_email_validation = supports_free_email_validation @@ -212,6 +217,7 @@ def initialize( @limits = limits @group = validate_group(group) @program = program + @database_compute_credit = database_compute_credit @dedicated_databases = dedicated_databases end @@ -270,6 +276,7 @@ def self.from(map:) supports_mock_numbers: map["supportsMockNumbers"], supports_organization_roles: map["supportsOrganizationRoles"], supports_credits: map["supportsCredits"], + supports_dedicated_databases: map["supportsDedicatedDatabases"], supports_disposable_email_validation: map["supportsDisposableEmailValidation"], supports_canonical_email_validation: map["supportsCanonicalEmailValidation"], supports_free_email_validation: map["supportsFreeEmailValidation"], @@ -285,6 +292,7 @@ def self.from(map:) limits: map["limits"].nil? ? nil : BillingPlanLimits.from(map: map["limits"]), group: map["group"], program: map["program"].nil? ? nil : Program.from(map: map["program"]), + database_compute_credit: map["databaseComputeCredit"], dedicated_databases: map["dedicatedDatabases"].nil? ? nil : BillingPlanDedicatedDatabaseLimits.from(map: map["dedicatedDatabases"]) ) end @@ -344,6 +352,7 @@ def to_map "supportsMockNumbers": @supports_mock_numbers, "supportsOrganizationRoles": @supports_organization_roles, "supportsCredits": @supports_credits, + "supportsDedicatedDatabases": @supports_dedicated_databases, "supportsDisposableEmailValidation": @supports_disposable_email_validation, "supportsCanonicalEmailValidation": @supports_canonical_email_validation, "supportsFreeEmailValidation": @supports_free_email_validation, @@ -359,6 +368,7 @@ def to_map "limits": @limits&.to_map, "group": @group, "program": @program&.to_map, + "databaseComputeCredit": @database_compute_credit, "dedicatedDatabases": @dedicated_databases&.to_map } end @@ -378,7 +388,6 @@ def validate_group(group) group end - end end end diff --git a/lib/appwrite/models/billing_plan_addon.rb b/lib/appwrite/models/billing_plan_addon.rb index b128cf19..3a24097e 100644 --- a/lib/appwrite/models/billing_plan_addon.rb +++ b/lib/appwrite/models/billing_plan_addon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,8 +7,8 @@ class BillingPlanAddon attr_reader :projects def initialize( - seats: , - projects: + seats:, + projects: ) @seats = seats @projects = projects diff --git a/lib/appwrite/models/billing_plan_addon_details.rb b/lib/appwrite/models/billing_plan_addon_details.rb index 72335b4c..3dc5e285 100644 --- a/lib/appwrite/models/billing_plan_addon_details.rb +++ b/lib/appwrite/models/billing_plan_addon_details.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -17,7 +17,7 @@ def initialize( plan_included:, limit:, type:, - currency: , + currency:, price:, value:, invoice_desc: diff --git a/lib/appwrite/models/billing_plan_dedicated_database_limits.rb b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb index 41458e73..3e179ad2 100644 --- a/lib/appwrite/models/billing_plan_dedicated_database_limits.rb +++ b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,25 +24,25 @@ class BillingPlanDedicatedDatabaseLimits attr_reader :allowed_sync_modes def initialize( - min_cpu: , - max_cpu: , - min_memory_mb: , - max_memory_mb: , - min_storage_gb: , - max_storage_gb: , - max_replicas: , - max_connections: , - max_ip_allowlist_size: , - max_extensions: , - max_backup_retention_days: , - max_pitr_retention_days: , - max_sql_api_max_rows: , - max_sql_api_max_bytes: , - max_sql_api_timeout_seconds: , - max_sql_api_allowed_statements: , - allowed_sql_statements: , - allowed_storage_classes: , - allowed_sync_modes: + min_cpu:, + max_cpu:, + min_memory_mb:, + max_memory_mb:, + min_storage_gb:, + max_storage_gb:, + max_replicas:, + max_connections:, + max_ip_allowlist_size:, + max_extensions:, + max_backup_retention_days:, + max_pitr_retention_days:, + max_sql_api_max_rows:, + max_sql_api_max_bytes:, + max_sql_api_timeout_seconds:, + max_sql_api_allowed_statements:, + allowed_sql_statements:, + allowed_storage_classes:, + allowed_sync_modes: ) @min_cpu = min_cpu @max_cpu = max_cpu diff --git a/lib/appwrite/models/billing_plan_limits.rb b/lib/appwrite/models/billing_plan_limits.rb index 547fd307..999a55bf 100644 --- a/lib/appwrite/models/billing_plan_limits.rb +++ b/lib/appwrite/models/billing_plan_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,8 +7,8 @@ class BillingPlanLimits attr_reader :daily_credits def initialize( - credits: , - daily_credits: + credits:, + daily_credits: ) @credits = credits @daily_credits = daily_credits diff --git a/lib/appwrite/models/billing_plan_supported_addons.rb b/lib/appwrite/models/billing_plan_supported_addons.rb index 504a98d6..ea2d8078 100644 --- a/lib/appwrite/models/billing_plan_supported_addons.rb +++ b/lib/appwrite/models/billing_plan_supported_addons.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/block.rb b/lib/appwrite/models/block.rb index b7c55101..4a1c81a6 100644 --- a/lib/appwrite/models/block.rb +++ b/lib/appwrite/models/block.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,8 +20,8 @@ def initialize( resource_type:, resource_id:, mode:, - reason: , - expired_at: , + reason:, + expired_at:, project_name:, region:, organization_name:, diff --git a/lib/appwrite/models/bucket.rb b/lib/appwrite/models/bucket.rb index ab45b57b..c7e8af99 100644 --- a/lib/appwrite/models/bucket.rb +++ b/lib/appwrite/models/bucket.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/bucket_list.rb b/lib/appwrite/models/bucket_list.rb index 91e2c72f..7d3c15a2 100644 --- a/lib/appwrite/models/bucket_list.rb +++ b/lib/appwrite/models/bucket_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/collection.rb b/lib/appwrite/models/collection.rb index 33840862..9e270f29 100644 --- a/lib/appwrite/models/collection.rb +++ b/lib/appwrite/models/collection.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/collection_list.rb b/lib/appwrite/models/collection_list.rb index 3dc18b63..e1e42d26 100644 --- a/lib/appwrite/models/collection_list.rb +++ b/lib/appwrite/models/collection_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_bigint.rb b/lib/appwrite/models/column_bigint.rb index ee45efd5..3dfa471a 100644 --- a/lib/appwrite/models/column_bigint.rb +++ b/lib/appwrite/models/column_bigint.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_boolean.rb b/lib/appwrite/models/column_boolean.rb index 288cc68a..83baf4a5 100644 --- a/lib/appwrite/models/column_boolean.rb +++ b/lib/appwrite/models/column_boolean.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_datetime.rb b/lib/appwrite/models/column_datetime.rb index 6aaee903..60122665 100644 --- a/lib/appwrite/models/column_datetime.rb +++ b/lib/appwrite/models/column_datetime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_email.rb b/lib/appwrite/models/column_email.rb index ea67469b..574e47e5 100644 --- a/lib/appwrite/models/column_email.rb +++ b/lib/appwrite/models/column_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_enum.rb b/lib/appwrite/models/column_enum.rb index a705af9f..0f2bd545 100644 --- a/lib/appwrite/models/column_enum.rb +++ b/lib/appwrite/models/column_enum.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, elements:, format:, - default: + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_float.rb b/lib/appwrite/models/column_float.rb index 7655e3b1..3c06c690 100644 --- a/lib/appwrite/models/column_float.rb +++ b/lib/appwrite/models/column_float.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_index.rb b/lib/appwrite/models/column_index.rb index c9927def..478d4c23 100644 --- a/lib/appwrite/models/column_index.rb +++ b/lib/appwrite/models/column_index.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( error:, columns:, lengths:, - orders: + orders: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/column_index_list.rb b/lib/appwrite/models/column_index_list.rb index 85438872..9278fd40 100644 --- a/lib/appwrite/models/column_index_list.rb +++ b/lib/appwrite/models/column_index_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_integer.rb b/lib/appwrite/models/column_integer.rb index 3c5c86da..0a71c44f 100644 --- a/lib/appwrite/models/column_integer.rb +++ b/lib/appwrite/models/column_integer.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_ip.rb b/lib/appwrite/models/column_ip.rb index 2c17d3c4..3d4f6551 100644 --- a/lib/appwrite/models/column_ip.rb +++ b/lib/appwrite/models/column_ip.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_line.rb b/lib/appwrite/models/column_line.rb index ee7cb060..f8a14bf0 100644 --- a/lib/appwrite/models/column_line.rb +++ b/lib/appwrite/models/column_line.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_list.rb b/lib/appwrite/models/column_list.rb index b01f858c..8d239ddf 100644 --- a/lib/appwrite/models/column_list.rb +++ b/lib/appwrite/models/column_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_longtext.rb b/lib/appwrite/models/column_longtext.rb index 9efbcec5..5a112087 100644 --- a/lib/appwrite/models/column_longtext.rb +++ b/lib/appwrite/models/column_longtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_mediumtext.rb b/lib/appwrite/models/column_mediumtext.rb index 5260dcaa..c5b465c9 100644 --- a/lib/appwrite/models/column_mediumtext.rb +++ b/lib/appwrite/models/column_mediumtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_point.rb b/lib/appwrite/models/column_point.rb index 4ce367ea..34e5cf0e 100644 --- a/lib/appwrite/models/column_point.rb +++ b/lib/appwrite/models/column_point.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_polygon.rb b/lib/appwrite/models/column_polygon.rb index db6d4dbc..82f39732 100644 --- a/lib/appwrite/models/column_polygon.rb +++ b/lib/appwrite/models/column_polygon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_relationship.rb b/lib/appwrite/models/column_relationship.rb index bf9645bb..c34643ea 100644 --- a/lib/appwrite/models/column_relationship.rb +++ b/lib/appwrite/models/column_relationship.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, related_table:, @@ -105,7 +105,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_string.rb b/lib/appwrite/models/column_string.rb index 3de0e089..6e08f2f5 100644 --- a/lib/appwrite/models/column_string.rb +++ b/lib/appwrite/models/column_string.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_text.rb b/lib/appwrite/models/column_text.rb index d6f9ea12..c3c7afb0 100644 --- a/lib/appwrite/models/column_text.rb +++ b/lib/appwrite/models/column_text.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_url.rb b/lib/appwrite/models/column_url.rb index 624e5c4a..11829a7d 100644 --- a/lib/appwrite/models/column_url.rb +++ b/lib/appwrite/models/column_url.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_varchar.rb b/lib/appwrite/models/column_varchar.rb index 532686d7..1a1083d7 100644 --- a/lib/appwrite/models/column_varchar.rb +++ b/lib/appwrite/models/column_varchar.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/continent.rb b/lib/appwrite/models/continent.rb index 3bfd8556..861ec29f 100644 --- a/lib/appwrite/models/continent.rb +++ b/lib/appwrite/models/continent.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/continent_list.rb b/lib/appwrite/models/continent_list.rb index d4c1495b..a5312493 100644 --- a/lib/appwrite/models/continent_list.rb +++ b/lib/appwrite/models/continent_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/country.rb b/lib/appwrite/models/country.rb index a5f66f97..07659799 100644 --- a/lib/appwrite/models/country.rb +++ b/lib/appwrite/models/country.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/country_list.rb b/lib/appwrite/models/country_list.rb index b885b7ba..1611dda7 100644 --- a/lib/appwrite/models/country_list.rb +++ b/lib/appwrite/models/country_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/currency.rb b/lib/appwrite/models/currency.rb index cfaa2fc8..b89e48ab 100644 --- a/lib/appwrite/models/currency.rb +++ b/lib/appwrite/models/currency.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/currency_list.rb b/lib/appwrite/models/currency_list.rb index 7c54d611..53d23594 100644 --- a/lib/appwrite/models/currency_list.rb +++ b/lib/appwrite/models/currency_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 90e95d6e..d0408fc8 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,6 +13,9 @@ class Database attr_reader :engine attr_reader :specification attr_reader :replicas + attr_reader :error + attr_reader :container_status + attr_reader :lifecycle_state attr_reader :policies attr_reader :archives @@ -23,12 +26,15 @@ def initialize( updated_at:, enabled:, type:, - status: , - engine: , - specification: , - replicas: , - policies: , - archives: + status:, + engine:, + specification:, + replicas:, + error:, + container_status:, + lifecycle_state:, + policies:, + archives: ) @id = id @name = name @@ -40,6 +46,9 @@ def initialize( @engine = engine @specification = specification @replicas = replicas + @error = error + @container_status = container_status + @lifecycle_state = lifecycle_state @policies = policies @archives = archives end @@ -56,6 +65,9 @@ def self.from(map:) engine: map["engine"], specification: map["specification"], replicas: map["replicas"], + error: map["error"], + container_status: map["containerStatus"], + lifecycle_state: map["lifecycleState"], policies: map["policies"]&.map { |it| BackupPolicy.from(map: it) }, archives: map["archives"]&.map { |it| BackupArchive.from(map: it) } ) @@ -73,6 +85,9 @@ def to_map "engine": @engine, "specification": @specification, "replicas": @replicas, + "error": @error, + "containerStatus": @container_status, + "lifecycleState": @lifecycle_state, "policies": @policies&.map { |it| it.to_map }, "archives": @archives&.map { |it| it.to_map } } @@ -122,7 +137,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/database_list.rb b/lib/appwrite/models/database_list.rb index 80f0791b..37c83aab 100644 --- a/lib/appwrite/models/database_list.rb +++ b/lib/appwrite/models/database_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_migration.rb b/lib/appwrite/models/database_migration.rb index afd0ce65..75becc38 100644 --- a/lib/appwrite/models/database_migration.rb +++ b/lib/appwrite/models/database_migration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,6 +13,7 @@ class DatabaseMigration attr_reader :attempt attr_reader :last_error attr_reader :lag_documents + attr_reader :changelog_watermark attr_reader :verified_at attr_reader :cutover_at attr_reader :soak_until @@ -31,6 +32,7 @@ def initialize( attempt:, last_error:, lag_documents:, + changelog_watermark:, verified_at:, cutover_at:, soak_until:, @@ -48,6 +50,7 @@ def initialize( @attempt = attempt @last_error = last_error @lag_documents = lag_documents + @changelog_watermark = changelog_watermark @verified_at = verified_at @cutover_at = cutover_at @soak_until = soak_until @@ -68,6 +71,7 @@ def self.from(map:) attempt: map["attempt"], last_error: map["lastError"], lag_documents: map["lagDocuments"], + changelog_watermark: map["changelogWatermark"], verified_at: map["verifiedAt"], cutover_at: map["cutoverAt"], soak_until: map["soakUntil"], @@ -89,6 +93,7 @@ def to_map "attempt": @attempt, "lastError": @last_error, "lagDocuments": @lag_documents, + "changelogWatermark": @changelog_watermark, "verifiedAt": @verified_at, "cutoverAt": @cutover_at, "soakUntil": @soak_until, diff --git a/lib/appwrite/models/database_migration_list.rb b/lib/appwrite/models/database_migration_list.rb index aa238ba0..21730266 100644 --- a/lib/appwrite/models/database_migration_list.rb +++ b/lib/appwrite/models/database_migration_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_status.rb b/lib/appwrite/models/database_status.rb index 4ed60bf7..f4a609c1 100644 --- a/lib/appwrite/models/database_status.rb +++ b/lib/appwrite/models/database_status.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -26,11 +26,11 @@ def initialize( uptime:, connections:, sync_mode:, - effective_sync_mode: , + effective_sync_mode:, sync_degraded:, sync_acknowledgements:, sync_standby_count:, - sync_state_confirmed: , + sync_state_confirmed:, replicas:, volumes: ) diff --git a/lib/appwrite/models/database_status_connections.rb b/lib/appwrite/models/database_status_connections.rb index bbf23950..623156df 100644 --- a/lib/appwrite/models/database_status_connections.rb +++ b/lib/appwrite/models/database_status_connections.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_status_replica.rb b/lib/appwrite/models/database_status_replica.rb index d88c2cb3..7ed53873 100644 --- a/lib/appwrite/models/database_status_replica.rb +++ b/lib/appwrite/models/database_status_replica.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -6,17 +6,20 @@ class DatabaseStatusReplica attr_reader :index attr_reader :role attr_reader :healthy + attr_reader :replicating attr_reader :lag_seconds def initialize( index:, role:, healthy:, - lag_seconds: + replicating:, + lag_seconds: ) @index = index @role = role @healthy = healthy + @replicating = replicating @lag_seconds = lag_seconds end @@ -25,6 +28,7 @@ def self.from(map:) index: map["index"], role: map["role"], healthy: map["healthy"], + replicating: map["replicating"], lag_seconds: map["lagSeconds"] ) end @@ -34,6 +38,7 @@ def to_map "index": @index, "role": @role, "healthy": @healthy, + "replicating": @replicating, "lagSeconds": @lag_seconds } end diff --git a/lib/appwrite/models/database_status_volume.rb b/lib/appwrite/models/database_status_volume.rb index 7ace12c9..cd15505b 100644 --- a/lib/appwrite/models/database_status_volume.rb +++ b/lib/appwrite/models/database_status_volume.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database.rb b/lib/appwrite/models/dedicated_database.rb index d53b19fa..9b21a355 100644 --- a/lib/appwrite/models/dedicated_database.rb +++ b/lib/appwrite/models/dedicated_database.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -71,8 +71,8 @@ def initialize( ssl:, status:, container_status:, - last_accessed_at: , - idle_until: , + last_accessed_at:, + idle_until:, lifecycle_state:, idle_timeout_minutes:, cpu:, diff --git a/lib/appwrite/models/dedicated_database_backup.rb b/lib/appwrite/models/dedicated_database_backup.rb new file mode 100644 index 00000000..f48b5d58 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackup + attr_reader :id + attr_reader :created_at + attr_reader :database_id + attr_reader :project_id + attr_reader :policy_id + attr_reader :trigger + attr_reader :type + attr_reader :requested_type + attr_reader :fallback_reason + attr_reader :status + attr_reader :size_bytes + attr_reader :started_at + attr_reader :completed_at + attr_reader :verified_at + attr_reader :expires_at + attr_reader :log_position + attr_reader :error + + def initialize( + id:, + created_at:, + database_id:, + project_id:, + policy_id:, + trigger:, + type:, + requested_type:, + fallback_reason:, + status:, + size_bytes:, + started_at:, + completed_at:, + verified_at:, + expires_at:, + log_position:, + error: + ) + @id = id + @created_at = created_at + @database_id = database_id + @project_id = project_id + @policy_id = policy_id + @trigger = trigger + @type = type + @requested_type = requested_type + @fallback_reason = fallback_reason + @status = status + @size_bytes = size_bytes + @started_at = started_at + @completed_at = completed_at + @verified_at = verified_at + @expires_at = expires_at + @log_position = log_position + @error = error + end + + def self.from(map:) + DedicatedDatabaseBackup.new( + id: map["$id"], + created_at: map["$createdAt"], + database_id: map["databaseId"], + project_id: map["projectId"], + policy_id: map["policyId"], + trigger: map["trigger"], + type: map["type"], + requested_type: map["requestedType"], + fallback_reason: map["fallbackReason"], + status: map["status"], + size_bytes: map["sizeBytes"], + started_at: map["startedAt"], + completed_at: map["completedAt"], + verified_at: map["verifiedAt"], + expires_at: map["expiresAt"], + log_position: map["logPosition"], + error: map["error"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "databaseId": @database_id, + "projectId": @project_id, + "policyId": @policy_id, + "trigger": @trigger, + "type": @type, + "requestedType": @requested_type, + "fallbackReason": @fallback_reason, + "status": @status, + "sizeBytes": @size_bytes, + "startedAt": @started_at, + "completedAt": @completed_at, + "verifiedAt": @verified_at, + "expiresAt": @expires_at, + "logPosition": @log_position, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_backup_list.rb b/lib/appwrite/models/dedicated_database_backup_list.rb new file mode 100644 index 00000000..37d85ec0 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackupList + attr_reader :total + attr_reader :backups + + def initialize( + total:, + backups: + ) + @total = total + @backups = backups + end + + def self.from(map:) + DedicatedDatabaseBackupList.new( + total: map["total"], + backups: map["backups"].map { |it| DedicatedDatabaseBackup.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "backups": @backups.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_backup_storage.rb b/lib/appwrite/models/dedicated_database_backup_storage.rb new file mode 100644 index 00000000..3e1cb28b --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup_storage.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackupStorage + attr_reader :provider + attr_reader :bucket + attr_reader :region + attr_reader :prefix + attr_reader :endpoint + + def initialize( + provider:, + bucket:, + region:, + prefix:, + endpoint: + ) + @provider = provider + @bucket = bucket + @region = region + @prefix = prefix + @endpoint = endpoint + end + + def self.from(map:) + DedicatedDatabaseBackupStorage.new( + provider: map["provider"], + bucket: map["bucket"], + region: map["region"], + prefix: map["prefix"], + endpoint: map["endpoint"] + ) + end + + def to_map + { + "provider": @provider, + "bucket": @bucket, + "region": @region, + "prefix": @prefix, + "endpoint": @endpoint + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_branch.rb b/lib/appwrite/models/dedicated_database_branch.rb new file mode 100644 index 00000000..991728ca --- /dev/null +++ b/lib/appwrite/models/dedicated_database_branch.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBranch + attr_reader :branch_id + attr_reader :branch_name + attr_reader :namespace + attr_reader :expires_at + attr_reader :host + attr_reader :port + attr_reader :database + attr_reader :username + attr_reader :password + attr_reader :ssl + attr_reader :engine + attr_reader :connection_string + + def initialize( + branch_id:, + branch_name:, + namespace:, + expires_at:, + host:, + port:, + database:, + username:, + password:, + ssl:, + engine:, + connection_string: + ) + @branch_id = branch_id + @branch_name = branch_name + @namespace = namespace + @expires_at = expires_at + @host = host + @port = port + @database = database + @username = username + @password = password + @ssl = ssl + @engine = engine + @connection_string = connection_string + end + + def self.from(map:) + DedicatedDatabaseBranch.new( + branch_id: map["branchId"], + branch_name: map["branchName"], + namespace: map["namespace"], + expires_at: map["expiresAt"], + host: map["host"], + port: map["port"], + database: map["database"], + username: map["username"], + password: map["password"], + ssl: map["ssl"], + engine: map["engine"], + connection_string: map["connectionString"] + ) + end + + def to_map + { + "branchId": @branch_id, + "branchName": @branch_name, + "namespace": @namespace, + "expiresAt": @expires_at, + "host": @host, + "port": @port, + "database": @database, + "username": @username, + "password": @password, + "ssl": @ssl, + "engine": @engine, + "connectionString": @connection_string + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_branch_list.rb b/lib/appwrite/models/dedicated_database_branch_list.rb new file mode 100644 index 00000000..106a3eb7 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_branch_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBranchList + attr_reader :total + attr_reader :branches + + def initialize( + total:, + branches: + ) + @total = total + @branches = branches + end + + def self.from(map:) + DedicatedDatabaseBranchList.new( + total: map["total"], + branches: map["branches"].map { |it| DedicatedDatabaseBranch.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "branches": @branches.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_execution.rb b/lib/appwrite/models/dedicated_database_execution.rb new file mode 100644 index 00000000..49e247f3 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_execution.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExecution + attr_reader :rows + attr_reader :row_count + attr_reader :columns + attr_reader :duration_ms + attr_reader :truncated + attr_reader :bytes + + def initialize( + rows:, + row_count:, + columns:, + duration_ms:, + truncated:, + bytes: + ) + @rows = rows + @row_count = row_count + @columns = columns + @duration_ms = duration_ms + @truncated = truncated + @bytes = bytes + end + + def self.from(map:) + DedicatedDatabaseExecution.new( + rows: map["rows"], + row_count: map["rowCount"], + columns: map["columns"].map { |it| DedicatedDatabaseExecutionColumn.from(map: it) }, + duration_ms: map["durationMs"], + truncated: map["truncated"], + bytes: map["bytes"] + ) + end + + def to_map + { + "rows": @rows, + "rowCount": @row_count, + "columns": @columns.map { |it| it.to_map }, + "durationMs": @duration_ms, + "truncated": @truncated, + "bytes": @bytes + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_execution_column.rb b/lib/appwrite/models/dedicated_database_execution_column.rb new file mode 100644 index 00000000..4605650d --- /dev/null +++ b/lib/appwrite/models/dedicated_database_execution_column.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExecutionColumn + attr_reader :name + attr_reader :type + + def initialize( + name:, + type: + ) + @name = name + @type = type + end + + def self.from(map:) + DedicatedDatabaseExecutionColumn.new( + name: map["name"], + type: map["type"] + ) + end + + def to_map + { + "name": @name, + "type": @type + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_extensions.rb b/lib/appwrite/models/dedicated_database_extensions.rb new file mode 100644 index 00000000..26c35a8e --- /dev/null +++ b/lib/appwrite/models/dedicated_database_extensions.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExtensions + attr_reader :installed + attr_reader :available + attr_reader :metadata + + def initialize( + installed:, + available:, + metadata: + ) + @installed = installed + @available = available + @metadata = metadata + end + + def self.from(map:) + DedicatedDatabaseExtensions.new( + installed: map["installed"], + available: map["available"], + metadata: map["metadata"].map { |it| PostgresExtension.from(map: it) } + ) + end + + def to_map + { + "installed": @installed, + "available": @available, + "metadata": @metadata.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_list.rb b/lib/appwrite/models/dedicated_database_list.rb new file mode 100644 index 00000000..3a66c939 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseList + attr_reader :total + attr_reader :databases + + def initialize( + total:, + databases: + ) + @total = total + @databases = databases + end + + def self.from(map:) + DedicatedDatabaseList.new( + total: map["total"], + databases: map["databases"].map { |it| DedicatedDatabase.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "databases": @databases.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_member.rb b/lib/appwrite/models/dedicated_database_member.rb index dcb0a6d8..8aaddc77 100644 --- a/lib/appwrite/models/dedicated_database_member.rb +++ b/lib/appwrite/models/dedicated_database_member.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -6,17 +6,20 @@ class DedicatedDatabaseMember attr_reader :id attr_reader :role attr_reader :status + attr_reader :replicating attr_reader :lag_seconds def initialize( id:, role:, status:, - lag_seconds: + replicating:, + lag_seconds: ) @id = id @role = role @status = status + @replicating = replicating @lag_seconds = lag_seconds end @@ -25,6 +28,7 @@ def self.from(map:) id: map["$id"], role: map["role"], status: map["status"], + replicating: map["replicating"], lag_seconds: map["lagSeconds"] ) end @@ -34,6 +38,7 @@ def to_map "$id": @id, "role": @role, "status": @status, + "replicating": @replicating, "lagSeconds": @lag_seconds } end diff --git a/lib/appwrite/models/dedicated_database_operation.rb b/lib/appwrite/models/dedicated_database_operation.rb index b5f9d8b0..bd6b53cf 100644 --- a/lib/appwrite/models/dedicated_database_operation.rb +++ b/lib/appwrite/models/dedicated_database_operation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,9 +22,9 @@ def initialize( type:, status:, attempts:, - requested_at: , - started_at: , - completed_at: , + requested_at:, + started_at:, + completed_at:, error_code:, error_message: ) diff --git a/lib/appwrite/models/dedicated_database_operation_list.rb b/lib/appwrite/models/dedicated_database_operation_list.rb index 8ed7a8c1..d4985739 100644 --- a/lib/appwrite/models/dedicated_database_operation_list.rb +++ b/lib/appwrite/models/dedicated_database_operation_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_pitr_windows.rb b/lib/appwrite/models/dedicated_database_pitr_windows.rb new file mode 100644 index 00000000..b80d115d --- /dev/null +++ b/lib/appwrite/models/dedicated_database_pitr_windows.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabasePITRWindows + attr_reader :earliest + attr_reader :latest + + def initialize( + earliest:, + latest: + ) + @earliest = earliest + @latest = latest + end + + def self.from(map:) + DedicatedDatabasePITRWindows.new( + earliest: map["earliest"], + latest: map["latest"] + ) + end + + def to_map + { + "earliest": @earliest, + "latest": @latest + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_pooler.rb b/lib/appwrite/models/dedicated_database_pooler.rb new file mode 100644 index 00000000..a87c1776 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_pooler.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabasePooler + attr_reader :enabled + attr_reader :mode + attr_reader :max_connections + attr_reader :default_pool_size + attr_reader :port + attr_reader :read_write_splitting + attr_reader :pooler_cpu_request + attr_reader :pooler_cpu_limit + attr_reader :pooler_memory_request + attr_reader :pooler_memory_limit + + def initialize( + enabled:, + mode:, + max_connections:, + default_pool_size:, + port:, + read_write_splitting:, + pooler_cpu_request:, + pooler_cpu_limit:, + pooler_memory_request:, + pooler_memory_limit: + ) + @enabled = enabled + @mode = mode + @max_connections = max_connections + @default_pool_size = default_pool_size + @port = port + @read_write_splitting = read_write_splitting + @pooler_cpu_request = pooler_cpu_request + @pooler_cpu_limit = pooler_cpu_limit + @pooler_memory_request = pooler_memory_request + @pooler_memory_limit = pooler_memory_limit + end + + def self.from(map:) + DedicatedDatabasePooler.new( + enabled: map["enabled"], + mode: map["mode"], + max_connections: map["maxConnections"], + default_pool_size: map["defaultPoolSize"], + port: map["port"], + read_write_splitting: map["readWriteSplitting"], + pooler_cpu_request: map["poolerCpuRequest"], + pooler_cpu_limit: map["poolerCpuLimit"], + pooler_memory_request: map["poolerMemoryRequest"], + pooler_memory_limit: map["poolerMemoryLimit"] + ) + end + + def to_map + { + "enabled": @enabled, + "mode": @mode, + "maxConnections": @max_connections, + "defaultPoolSize": @default_pool_size, + "port": @port, + "readWriteSplitting": @read_write_splitting, + "poolerCpuRequest": @pooler_cpu_request, + "poolerCpuLimit": @pooler_cpu_limit, + "poolerMemoryRequest": @pooler_memory_request, + "poolerMemoryLimit": @pooler_memory_limit + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_replicas.rb b/lib/appwrite/models/dedicated_database_replicas.rb index 7773340a..72106776 100644 --- a/lib/appwrite/models/dedicated_database_replicas.rb +++ b/lib/appwrite/models/dedicated_database_replicas.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -15,11 +15,11 @@ class DedicatedDatabaseReplicas def initialize( replicas:, sync_mode:, - effective_sync_mode: , + effective_sync_mode:, sync_degraded:, sync_acknowledgements:, sync_standby_count:, - sync_state_confirmed: , + sync_state_confirmed:, members: ) @replicas = replicas diff --git a/lib/appwrite/models/dedicated_database_restoration.rb b/lib/appwrite/models/dedicated_database_restoration.rb new file mode 100644 index 00000000..be6e9f26 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_restoration.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseRestoration + attr_reader :id + attr_reader :created_at + attr_reader :database_id + attr_reader :source_database_id + attr_reader :project_id + attr_reader :backup_id + attr_reader :type + attr_reader :status + attr_reader :target_time + attr_reader :started_at + attr_reader :completed_at + attr_reader :error + + def initialize( + id:, + created_at:, + database_id:, + source_database_id:, + project_id:, + backup_id:, + type:, + status:, + target_time:, + started_at:, + completed_at:, + error: + ) + @id = id + @created_at = created_at + @database_id = database_id + @source_database_id = source_database_id + @project_id = project_id + @backup_id = backup_id + @type = type + @status = status + @target_time = target_time + @started_at = started_at + @completed_at = completed_at + @error = error + end + + def self.from(map:) + DedicatedDatabaseRestoration.new( + id: map["$id"], + created_at: map["$createdAt"], + database_id: map["databaseId"], + source_database_id: map["sourceDatabaseId"], + project_id: map["projectId"], + backup_id: map["backupId"], + type: map["type"], + status: map["status"], + target_time: map["targetTime"], + started_at: map["startedAt"], + completed_at: map["completedAt"], + error: map["error"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "databaseId": @database_id, + "sourceDatabaseId": @source_database_id, + "projectId": @project_id, + "backupId": @backup_id, + "type": @type, + "status": @status, + "targetTime": @target_time, + "startedAt": @started_at, + "completedAt": @completed_at, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_restoration_list.rb b/lib/appwrite/models/dedicated_database_restoration_list.rb new file mode 100644 index 00000000..dcb3f9ee --- /dev/null +++ b/lib/appwrite/models/dedicated_database_restoration_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseRestorationList + attr_reader :total + attr_reader :restorations + + def initialize( + total:, + restorations: + ) + @total = total + @restorations = restorations + end + + def self.from(map:) + DedicatedDatabaseRestorationList.new( + total: map["total"], + restorations: map["restorations"].map { |it| DedicatedDatabaseRestoration.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "restorations": @restorations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_specification.rb b/lib/appwrite/models/dedicated_database_specification.rb index ceb55948..2448c2e1 100644 --- a/lib/appwrite/models/dedicated_database_specification.rb +++ b/lib/appwrite/models/dedicated_database_specification.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_specification_list.rb b/lib/appwrite/models/dedicated_database_specification_list.rb index 7201593c..206eec28 100644 --- a/lib/appwrite/models/dedicated_database_specification_list.rb +++ b/lib/appwrite/models/dedicated_database_specification_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_specification_pricing.rb b/lib/appwrite/models/dedicated_database_specification_pricing.rb index e9a679b7..d6ef0ef8 100644 --- a/lib/appwrite/models/dedicated_database_specification_pricing.rb +++ b/lib/appwrite/models/dedicated_database_specification_pricing.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/deployment.rb b/lib/appwrite/models/deployment.rb index 2dc1835b..6fc3465b 100644 --- a/lib/appwrite/models/deployment.rb +++ b/lib/appwrite/models/deployment.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -171,7 +171,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/deployment_list.rb b/lib/appwrite/models/deployment_list.rb index 971e4856..f9a2d696 100644 --- a/lib/appwrite/models/deployment_list.rb +++ b/lib/appwrite/models/deployment_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dev_key.rb b/lib/appwrite/models/dev_key.rb index cb3f60da..4389e82a 100644 --- a/lib/appwrite/models/dev_key.rb +++ b/lib/appwrite/models/dev_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/document.rb b/lib/appwrite/models/document.rb index 5b7987af..0cc8a466 100644 --- a/lib/appwrite/models/document.rb +++ b/lib/appwrite/models/document.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/document_list.rb b/lib/appwrite/models/document_list.rb index b2ae4682..254e19e2 100644 --- a/lib/appwrite/models/document_list.rb +++ b/lib/appwrite/models/document_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/email_template.rb b/lib/appwrite/models/email_template.rb index 0e3d0a7f..5cacd768 100644 --- a/lib/appwrite/models/email_template.rb +++ b/lib/appwrite/models/email_template.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/email_template_list.rb b/lib/appwrite/models/email_template_list.rb index a881b3e6..fbc649f1 100644 --- a/lib/appwrite/models/email_template_list.rb +++ b/lib/appwrite/models/email_template_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/embedding.rb b/lib/appwrite/models/embedding.rb index 991b6e57..177a94f4 100644 --- a/lib/appwrite/models/embedding.rb +++ b/lib/appwrite/models/embedding.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/embedding_list.rb b/lib/appwrite/models/embedding_list.rb index 770ca0e5..848b50d4 100644 --- a/lib/appwrite/models/embedding_list.rb +++ b/lib/appwrite/models/embedding_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/ephemeral_key.rb b/lib/appwrite/models/ephemeral_key.rb index e974df0f..14761c4f 100644 --- a/lib/appwrite/models/ephemeral_key.rb +++ b/lib/appwrite/models/ephemeral_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/execution.rb b/lib/appwrite/models/execution.rb index ef56563e..55a701d5 100644 --- a/lib/appwrite/models/execution.rb +++ b/lib/appwrite/models/execution.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,7 +7,8 @@ class Execution attr_reader :created_at attr_reader :updated_at attr_reader :permissions - attr_reader :function_id + attr_reader :resource_id + attr_reader :resource_type attr_reader :deployment_id attr_reader :trigger attr_reader :status @@ -27,7 +28,8 @@ def initialize( created_at:, updated_at:, permissions:, - function_id:, + resource_id:, + resource_type:, deployment_id:, trigger:, status:, @@ -40,13 +42,14 @@ def initialize( logs:, errors:, duration:, - scheduled_at: + scheduled_at: ) @id = id @created_at = created_at @updated_at = updated_at @permissions = permissions - @function_id = function_id + @resource_id = resource_id + @resource_type = validate_resource_type(resource_type) @deployment_id = deployment_id @trigger = validate_trigger(trigger) @status = validate_status(status) @@ -68,7 +71,8 @@ def self.from(map:) created_at: map["$createdAt"], updated_at: map["$updatedAt"], permissions: map["$permissions"], - function_id: map["functionId"], + resource_id: map["resourceId"], + resource_type: map["resourceType"], deployment_id: map["deploymentId"], trigger: map["trigger"], status: map["status"], @@ -91,7 +95,8 @@ def to_map "$createdAt": @created_at, "$updatedAt": @updated_at, "$permissions": @permissions, - "functionId": @function_id, + "resourceId": @resource_id, + "resourceType": @resource_type, "deploymentId": @deployment_id, "trigger": @trigger, "status": @status, @@ -110,6 +115,19 @@ def to_map private + def validate_resource_type(resource_type) + valid_resource_type = [ + Appwrite::Enums::ExecutionResourceType::FUNCTIONS, + Appwrite::Enums::ExecutionResourceType::SITES, + ] + + unless valid_resource_type.include?(resource_type) + raise ArgumentError, "Invalid " + resource_type + ". Must be one of: " + valid_resource_type.join(', ') + end + + resource_type + end + def validate_trigger(trigger) valid_trigger = [ Appwrite::Enums::ExecutionTrigger::HTTP, @@ -139,7 +157,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/execution_list.rb b/lib/appwrite/models/execution_list.rb index b14ff4e5..531551db 100644 --- a/lib/appwrite/models/execution_list.rb +++ b/lib/appwrite/models/execution_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/file.rb b/lib/appwrite/models/file.rb index 525a88b3..66ee936b 100644 --- a/lib/appwrite/models/file.rb +++ b/lib/appwrite/models/file.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/file_list.rb b/lib/appwrite/models/file_list.rb index f859b0b0..7a033d5a 100644 --- a/lib/appwrite/models/file_list.rb +++ b/lib/appwrite/models/file_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework.rb b/lib/appwrite/models/framework.rb index a465400a..98108bfe 100644 --- a/lib/appwrite/models/framework.rb +++ b/lib/appwrite/models/framework.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework_adapter.rb b/lib/appwrite/models/framework_adapter.rb index e96509a2..81d06e20 100644 --- a/lib/appwrite/models/framework_adapter.rb +++ b/lib/appwrite/models/framework_adapter.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework_list.rb b/lib/appwrite/models/framework_list.rb index 6fe936ec..da86b56d 100644 --- a/lib/appwrite/models/framework_list.rb +++ b/lib/appwrite/models/framework_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/function.rb b/lib/appwrite/models/function.rb index 09cb6d79..0e765552 100644 --- a/lib/appwrite/models/function.rb +++ b/lib/appwrite/models/function.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/function_list.rb b/lib/appwrite/models/function_list.rb index 0fbb1b94..8ac71cf1 100644 --- a/lib/appwrite/models/function_list.rb +++ b/lib/appwrite/models/function_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/headers.rb b/lib/appwrite/models/headers.rb index 3604ab70..5c43bea8 100644 --- a/lib/appwrite/models/headers.rb +++ b/lib/appwrite/models/headers.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/identity.rb b/lib/appwrite/models/identity.rb index 0f7fb5ec..bd6e58cf 100644 --- a/lib/appwrite/models/identity.rb +++ b/lib/appwrite/models/identity.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/identity_list.rb b/lib/appwrite/models/identity_list.rb index c8a38512..bef444be 100644 --- a/lib/appwrite/models/identity_list.rb +++ b/lib/appwrite/models/identity_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/index.rb b/lib/appwrite/models/index.rb index 6fccd4b0..20b6e62b 100644 --- a/lib/appwrite/models/index.rb +++ b/lib/appwrite/models/index.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( error:, attributes:, lengths:, - orders: + orders: ) @id = id @created_at = created_at @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/index_list.rb b/lib/appwrite/models/index_list.rb index 140bf167..a0795d16 100644 --- a/lib/appwrite/models/index_list.rb +++ b/lib/appwrite/models/index_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/insight.rb b/lib/appwrite/models/insight.rb index b5131c82..a10df160 100644 --- a/lib/appwrite/models/insight.rb +++ b/lib/appwrite/models/insight.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -36,9 +36,9 @@ def initialize( title:, summary:, ctas:, - analyzed_at: , - dismissed_at: , - dismissed_by: + analyzed_at:, + dismissed_at:, + dismissed_by: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/insight_cta.rb b/lib/appwrite/models/insight_cta.rb index 82d61bfc..36670cbe 100644 --- a/lib/appwrite/models/insight_cta.rb +++ b/lib/appwrite/models/insight_cta.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/insight_list.rb b/lib/appwrite/models/insight_list.rb index 541023a5..af19aa84 100644 --- a/lib/appwrite/models/insight_list.rb +++ b/lib/appwrite/models/insight_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/jwt.rb b/lib/appwrite/models/jwt.rb index efd5daf3..73d8c92c 100644 --- a/lib/appwrite/models/jwt.rb +++ b/lib/appwrite/models/jwt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/key.rb b/lib/appwrite/models/key.rb index aaeac7ac..4df47cf3 100644 --- a/lib/appwrite/models/key.rb +++ b/lib/appwrite/models/key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/key_list.rb b/lib/appwrite/models/key_list.rb index d49db9bf..d7a9649f 100644 --- a/lib/appwrite/models/key_list.rb +++ b/lib/appwrite/models/key_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/language.rb b/lib/appwrite/models/language.rb index d31449b8..8850a69b 100644 --- a/lib/appwrite/models/language.rb +++ b/lib/appwrite/models/language.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/language_list.rb b/lib/appwrite/models/language_list.rb index 231d7274..118fc410 100644 --- a/lib/appwrite/models/language_list.rb +++ b/lib/appwrite/models/language_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/locale.rb b/lib/appwrite/models/locale.rb index 7480e2bf..a31aea64 100644 --- a/lib/appwrite/models/locale.rb +++ b/lib/appwrite/models/locale.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -30,17 +30,17 @@ def initialize( continent:, eu:, currency:, - city: , - time_zone: , - postal_code: , - latitude: , - longitude: , - autonomous_system_number: , - autonomous_system_organization: , - isp: , - connection_type: , - connection_usage_type: , - connection_organization: + city:, + time_zone:, + postal_code:, + latitude:, + longitude:, + autonomous_system_number:, + autonomous_system_organization:, + isp:, + connection_type:, + connection_usage_type:, + connection_organization: ) @ip = ip @country_code = country_code diff --git a/lib/appwrite/models/locale_code.rb b/lib/appwrite/models/locale_code.rb index 247c7588..6089272b 100644 --- a/lib/appwrite/models/locale_code.rb +++ b/lib/appwrite/models/locale_code.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/locale_code_list.rb b/lib/appwrite/models/locale_code_list.rb index 56fb762b..b93213cb 100644 --- a/lib/appwrite/models/locale_code_list.rb +++ b/lib/appwrite/models/locale_code_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/log.rb b/lib/appwrite/models/log.rb index c4653acc..89e1a676 100644 --- a/lib/appwrite/models/log.rb +++ b/lib/appwrite/models/log.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/log_list.rb b/lib/appwrite/models/log_list.rb index f1b32c65..cdad965e 100644 --- a/lib/appwrite/models/log_list.rb +++ b/lib/appwrite/models/log_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/membership.rb b/lib/appwrite/models/membership.rb index 4880a9ce..84b3ce1f 100644 --- a/lib/appwrite/models/membership.rb +++ b/lib/appwrite/models/membership.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/membership_list.rb b/lib/appwrite/models/membership_list.rb index 87a0cb53..0cc220c0 100644 --- a/lib/appwrite/models/membership_list.rb +++ b/lib/appwrite/models/membership_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/message.rb b/lib/appwrite/models/message.rb index 25e366b5..456afe3a 100644 --- a/lib/appwrite/models/message.rb +++ b/lib/appwrite/models/message.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -25,9 +25,9 @@ def initialize( topics:, users:, targets:, - scheduled_at: , - delivered_at: , - delivery_errors: , + scheduled_at:, + delivered_at:, + delivery_errors:, delivered_total:, data:, status: @@ -100,7 +100,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/message_list.rb b/lib/appwrite/models/message_list.rb index d96ae8cd..50175444 100644 --- a/lib/appwrite/models/message_list.rb +++ b/lib/appwrite/models/message_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_challenge.rb b/lib/appwrite/models/mfa_challenge.rb index 8ae49c83..6ba21fef 100644 --- a/lib/appwrite/models/mfa_challenge.rb +++ b/lib/appwrite/models/mfa_challenge.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_challenge_secret.rb b/lib/appwrite/models/mfa_challenge_secret.rb index e17abe4c..ad8abbcd 100644 --- a/lib/appwrite/models/mfa_challenge_secret.rb +++ b/lib/appwrite/models/mfa_challenge_secret.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_factors.rb b/lib/appwrite/models/mfa_factors.rb index ed0d6e1e..55b58ca2 100644 --- a/lib/appwrite/models/mfa_factors.rb +++ b/lib/appwrite/models/mfa_factors.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_recovery_codes.rb b/lib/appwrite/models/mfa_recovery_codes.rb index 9d9b897d..1fd53c11 100644 --- a/lib/appwrite/models/mfa_recovery_codes.rb +++ b/lib/appwrite/models/mfa_recovery_codes.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_type.rb b/lib/appwrite/models/mfa_type.rb index 76b7ec87..0612dc2d 100644 --- a/lib/appwrite/models/mfa_type.rb +++ b/lib/appwrite/models/mfa_type.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mock_number.rb b/lib/appwrite/models/mock_number.rb index 8ef41d45..59d96f27 100644 --- a/lib/appwrite/models/mock_number.rb +++ b/lib/appwrite/models/mock_number.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mock_number_list.rb b/lib/appwrite/models/mock_number_list.rb index 6971dcf2..56a7fdd2 100644 --- a/lib/appwrite/models/mock_number_list.rb +++ b/lib/appwrite/models/mock_number_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_amazon.rb b/lib/appwrite/models/o_auth2_amazon.rb index 23a99cd2..177ce121 100644 --- a/lib/appwrite/models/o_auth2_amazon.rb +++ b/lib/appwrite/models/o_auth2_amazon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_apple.rb b/lib/appwrite/models/o_auth2_apple.rb index 94d0715f..bc7d9cba 100644 --- a/lib/appwrite/models/o_auth2_apple.rb +++ b/lib/appwrite/models/o_auth2_apple.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_appwrite.rb b/lib/appwrite/models/o_auth2_appwrite.rb index f9ca4772..c12a6b55 100644 --- a/lib/appwrite/models/o_auth2_appwrite.rb +++ b/lib/appwrite/models/o_auth2_appwrite.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_auth0.rb b/lib/appwrite/models/o_auth2_auth0.rb index 9771a9bb..aa261435 100644 --- a/lib/appwrite/models/o_auth2_auth0.rb +++ b/lib/appwrite/models/o_auth2_auth0.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_authentik.rb b/lib/appwrite/models/o_auth2_authentik.rb index 67d497e2..81fc7ff8 100644 --- a/lib/appwrite/models/o_auth2_authentik.rb +++ b/lib/appwrite/models/o_auth2_authentik.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_autodesk.rb b/lib/appwrite/models/o_auth2_autodesk.rb index a91f74f3..f260b12e 100644 --- a/lib/appwrite/models/o_auth2_autodesk.rb +++ b/lib/appwrite/models/o_auth2_autodesk.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_bitbucket.rb b/lib/appwrite/models/o_auth2_bitbucket.rb index d5dd4a24..44509504 100644 --- a/lib/appwrite/models/o_auth2_bitbucket.rb +++ b/lib/appwrite/models/o_auth2_bitbucket.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_bitly.rb b/lib/appwrite/models/o_auth2_bitly.rb index 9a49b919..ad116ed0 100644 --- a/lib/appwrite/models/o_auth2_bitly.rb +++ b/lib/appwrite/models/o_auth2_bitly.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_box.rb b/lib/appwrite/models/o_auth2_box.rb index 7334f39f..7cdfedd0 100644 --- a/lib/appwrite/models/o_auth2_box.rb +++ b/lib/appwrite/models/o_auth2_box.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_dailymotion.rb b/lib/appwrite/models/o_auth2_dailymotion.rb index 97c2d13c..31e10ed1 100644 --- a/lib/appwrite/models/o_auth2_dailymotion.rb +++ b/lib/appwrite/models/o_auth2_dailymotion.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_discord.rb b/lib/appwrite/models/o_auth2_discord.rb index 9e87ca14..b24b44c8 100644 --- a/lib/appwrite/models/o_auth2_discord.rb +++ b/lib/appwrite/models/o_auth2_discord.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_disqus.rb b/lib/appwrite/models/o_auth2_disqus.rb index eab489bf..2b8e4261 100644 --- a/lib/appwrite/models/o_auth2_disqus.rb +++ b/lib/appwrite/models/o_auth2_disqus.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_dropbox.rb b/lib/appwrite/models/o_auth2_dropbox.rb index 1a4df150..d5581312 100644 --- a/lib/appwrite/models/o_auth2_dropbox.rb +++ b/lib/appwrite/models/o_auth2_dropbox.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_etsy.rb b/lib/appwrite/models/o_auth2_etsy.rb index 340209cc..87acab75 100644 --- a/lib/appwrite/models/o_auth2_etsy.rb +++ b/lib/appwrite/models/o_auth2_etsy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_facebook.rb b/lib/appwrite/models/o_auth2_facebook.rb index e7341102..f42ab1e7 100644 --- a/lib/appwrite/models/o_auth2_facebook.rb +++ b/lib/appwrite/models/o_auth2_facebook.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_figma.rb b/lib/appwrite/models/o_auth2_figma.rb index 15b6ea4a..7da8c796 100644 --- a/lib/appwrite/models/o_auth2_figma.rb +++ b/lib/appwrite/models/o_auth2_figma.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_fusion_auth.rb b/lib/appwrite/models/o_auth2_fusion_auth.rb index 6cd69513..74e205e3 100644 --- a/lib/appwrite/models/o_auth2_fusion_auth.rb +++ b/lib/appwrite/models/o_auth2_fusion_auth.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_github.rb b/lib/appwrite/models/o_auth2_github.rb index afc11907..9f72146a 100644 --- a/lib/appwrite/models/o_auth2_github.rb +++ b/lib/appwrite/models/o_auth2_github.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_gitlab.rb b/lib/appwrite/models/o_auth2_gitlab.rb index 9786ddd1..2f1d2237 100644 --- a/lib/appwrite/models/o_auth2_gitlab.rb +++ b/lib/appwrite/models/o_auth2_gitlab.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_google.rb b/lib/appwrite/models/o_auth2_google.rb index 5f6df20e..e220ee69 100644 --- a/lib/appwrite/models/o_auth2_google.rb +++ b/lib/appwrite/models/o_auth2_google.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,7 +20,7 @@ def initialize( @enabled = enabled @client_id = client_id @client_secret = client_secret - @prompt = prompt + @prompt = validate_prompt(prompt) end def self.from(map:) @@ -42,6 +42,22 @@ def to_map "prompt": @prompt } end + + private + + def validate_prompt(prompt) + valid_prompt = [ + Appwrite::Enums::OAuth2GooglePrompt::NONE, + Appwrite::Enums::OAuth2GooglePrompt::CONSENT, + Appwrite::Enums::OAuth2GooglePrompt::SELECT_ACCOUNT, + ] + + unless valid_prompt.include?(prompt) + raise ArgumentError, "Invalid " + prompt + ". Must be one of: " + valid_prompt.join(', ') + end + + prompt + end end end end diff --git a/lib/appwrite/models/o_auth2_hugging_face.rb b/lib/appwrite/models/o_auth2_hugging_face.rb new file mode 100644 index 00000000..c75e13cc --- /dev/null +++ b/lib/appwrite/models/o_auth2_hugging_face.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class OAuth2HuggingFace + attr_reader :id + attr_reader :enabled + attr_reader :client_id + attr_reader :client_secret + + def initialize( + id:, + enabled:, + client_id:, + client_secret: + ) + @id = id + @enabled = enabled + @client_id = client_id + @client_secret = client_secret + end + + def self.from(map:) + OAuth2HuggingFace.new( + id: map["$id"], + enabled: map["enabled"], + client_id: map["clientId"], + client_secret: map["clientSecret"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled, + "clientId": @client_id, + "clientSecret": @client_secret + } + end + end + end +end diff --git a/lib/appwrite/models/o_auth2_keycloak.rb b/lib/appwrite/models/o_auth2_keycloak.rb index a6ab0bfd..6af51b90 100644 --- a/lib/appwrite/models/o_auth2_keycloak.rb +++ b/lib/appwrite/models/o_auth2_keycloak.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_kick.rb b/lib/appwrite/models/o_auth2_kick.rb index 59d3e2a7..eb5c8092 100644 --- a/lib/appwrite/models/o_auth2_kick.rb +++ b/lib/appwrite/models/o_auth2_kick.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_linkedin.rb b/lib/appwrite/models/o_auth2_linkedin.rb index b8074390..8b91b062 100644 --- a/lib/appwrite/models/o_auth2_linkedin.rb +++ b/lib/appwrite/models/o_auth2_linkedin.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_microsoft.rb b/lib/appwrite/models/o_auth2_microsoft.rb index 563e62dd..0173d394 100644 --- a/lib/appwrite/models/o_auth2_microsoft.rb +++ b/lib/appwrite/models/o_auth2_microsoft.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_notion.rb b/lib/appwrite/models/o_auth2_notion.rb index 4b0c0015..3382c410 100644 --- a/lib/appwrite/models/o_auth2_notion.rb +++ b/lib/appwrite/models/o_auth2_notion.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_oidc.rb b/lib/appwrite/models/o_auth2_oidc.rb index 105d148a..a4ea66fe 100644 --- a/lib/appwrite/models/o_auth2_oidc.rb +++ b/lib/appwrite/models/o_auth2_oidc.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( token_url:, user_info_url:, prompt:, - max_age: + max_age: ) @id = id @enabled = enabled @@ -34,7 +34,7 @@ def initialize( @authorization_url = authorization_url @token_url = token_url @user_info_url = user_info_url - @prompt = prompt + @prompt = validate_prompt(prompt) @max_age = max_age end @@ -67,6 +67,23 @@ def to_map "maxAge": @max_age } end + + private + + def validate_prompt(prompt) + valid_prompt = [ + Appwrite::Enums::OAuth2OidcPrompt::NONE, + Appwrite::Enums::OAuth2OidcPrompt::LOGIN, + Appwrite::Enums::OAuth2OidcPrompt::CONSENT, + Appwrite::Enums::OAuth2OidcPrompt::SELECT_ACCOUNT, + ] + + unless valid_prompt.include?(prompt) + raise ArgumentError, "Invalid " + prompt + ". Must be one of: " + valid_prompt.join(', ') + end + + prompt + end end end end diff --git a/lib/appwrite/models/o_auth2_okta.rb b/lib/appwrite/models/o_auth2_okta.rb index df3c6b65..61ef16ec 100644 --- a/lib/appwrite/models/o_auth2_okta.rb +++ b/lib/appwrite/models/o_auth2_okta.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_paypal.rb b/lib/appwrite/models/o_auth2_paypal.rb index fd1bbcda..32263b46 100644 --- a/lib/appwrite/models/o_auth2_paypal.rb +++ b/lib/appwrite/models/o_auth2_paypal.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_podio.rb b/lib/appwrite/models/o_auth2_podio.rb index 9e021189..d1efea82 100644 --- a/lib/appwrite/models/o_auth2_podio.rb +++ b/lib/appwrite/models/o_auth2_podio.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_provider_list.rb b/lib/appwrite/models/o_auth2_provider_list.rb index 9dce4cce..16bdbbaf 100644 --- a/lib/appwrite/models/o_auth2_provider_list.rb +++ b/lib/appwrite/models/o_auth2_provider_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_salesforce.rb b/lib/appwrite/models/o_auth2_salesforce.rb index db8956f7..22cdf2b6 100644 --- a/lib/appwrite/models/o_auth2_salesforce.rb +++ b/lib/appwrite/models/o_auth2_salesforce.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_slack.rb b/lib/appwrite/models/o_auth2_slack.rb index a65252dc..209cc3b5 100644 --- a/lib/appwrite/models/o_auth2_slack.rb +++ b/lib/appwrite/models/o_auth2_slack.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_spotify.rb b/lib/appwrite/models/o_auth2_spotify.rb index 63f402cf..014d82dc 100644 --- a/lib/appwrite/models/o_auth2_spotify.rb +++ b/lib/appwrite/models/o_auth2_spotify.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_stripe.rb b/lib/appwrite/models/o_auth2_stripe.rb index 0caceb2d..66604406 100644 --- a/lib/appwrite/models/o_auth2_stripe.rb +++ b/lib/appwrite/models/o_auth2_stripe.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_tradeshift.rb b/lib/appwrite/models/o_auth2_tradeshift.rb index 7ae52021..749c666d 100644 --- a/lib/appwrite/models/o_auth2_tradeshift.rb +++ b/lib/appwrite/models/o_auth2_tradeshift.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_twitch.rb b/lib/appwrite/models/o_auth2_twitch.rb index 9801c8e3..ac7fa8a1 100644 --- a/lib/appwrite/models/o_auth2_twitch.rb +++ b/lib/appwrite/models/o_auth2_twitch.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_word_press.rb b/lib/appwrite/models/o_auth2_word_press.rb index 689f4ccc..3fab755c 100644 --- a/lib/appwrite/models/o_auth2_word_press.rb +++ b/lib/appwrite/models/o_auth2_word_press.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_x.rb b/lib/appwrite/models/o_auth2_x.rb index 0819e3ad..d2f771a4 100644 --- a/lib/appwrite/models/o_auth2_x.rb +++ b/lib/appwrite/models/o_auth2_x.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_yahoo.rb b/lib/appwrite/models/o_auth2_yahoo.rb index afe6f7f0..13aea493 100644 --- a/lib/appwrite/models/o_auth2_yahoo.rb +++ b/lib/appwrite/models/o_auth2_yahoo.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_yandex.rb b/lib/appwrite/models/o_auth2_yandex.rb index 2f8438ea..8373037e 100644 --- a/lib/appwrite/models/o_auth2_yandex.rb +++ b/lib/appwrite/models/o_auth2_yandex.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_zoho.rb b/lib/appwrite/models/o_auth2_zoho.rb index 629879ad..6b40cab0 100644 --- a/lib/appwrite/models/o_auth2_zoho.rb +++ b/lib/appwrite/models/o_auth2_zoho.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_zoom.rb b/lib/appwrite/models/o_auth2_zoom.rb index 74f8f269..d7b261ce 100644 --- a/lib/appwrite/models/o_auth2_zoom.rb +++ b/lib/appwrite/models/o_auth2_zoom.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_approve.rb b/lib/appwrite/models/oauth2_approve.rb index a1539195..748c7880 100644 --- a/lib/appwrite/models/oauth2_approve.rb +++ b/lib/appwrite/models/oauth2_approve.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_authorize.rb b/lib/appwrite/models/oauth2_authorize.rb index 82a0c3c8..99f35e8c 100644 --- a/lib/appwrite/models/oauth2_authorize.rb +++ b/lib/appwrite/models/oauth2_authorize.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent.rb b/lib/appwrite/models/oauth2_consent.rb index 7387dddf..af8f3ec0 100644 --- a/lib/appwrite/models/oauth2_consent.rb +++ b/lib/appwrite/models/oauth2_consent.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_list.rb b/lib/appwrite/models/oauth2_consent_list.rb index 6d48dd80..a6ca3cea 100644 --- a/lib/appwrite/models/oauth2_consent_list.rb +++ b/lib/appwrite/models/oauth2_consent_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_token.rb b/lib/appwrite/models/oauth2_consent_token.rb index b98a9429..6b1bc02a 100644 --- a/lib/appwrite/models/oauth2_consent_token.rb +++ b/lib/appwrite/models/oauth2_consent_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_token_list.rb b/lib/appwrite/models/oauth2_consent_token_list.rb index a06536e2..edf5aef9 100644 --- a/lib/appwrite/models/oauth2_consent_token_list.rb +++ b/lib/appwrite/models/oauth2_consent_token_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_device_authorization.rb b/lib/appwrite/models/oauth2_device_authorization.rb index c50e3713..428970ac 100644 --- a/lib/appwrite/models/oauth2_device_authorization.rb +++ b/lib/appwrite/models/oauth2_device_authorization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_grant.rb b/lib/appwrite/models/oauth2_grant.rb index 8e87f96c..df5192bf 100644 --- a/lib/appwrite/models/oauth2_grant.rb +++ b/lib/appwrite/models/oauth2_grant.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_organization.rb b/lib/appwrite/models/oauth2_organization.rb index c54bc380..b69fd0cb 100644 --- a/lib/appwrite/models/oauth2_organization.rb +++ b/lib/appwrite/models/oauth2_organization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_organization_list.rb b/lib/appwrite/models/oauth2_organization_list.rb index dd9691b5..7921605a 100644 --- a/lib/appwrite/models/oauth2_organization_list.rb +++ b/lib/appwrite/models/oauth2_organization_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_par.rb b/lib/appwrite/models/oauth2_par.rb index c42f8724..18198dc6 100644 --- a/lib/appwrite/models/oauth2_par.rb +++ b/lib/appwrite/models/oauth2_par.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_project.rb b/lib/appwrite/models/oauth2_project.rb index a3fdf58d..01b2531c 100644 --- a/lib/appwrite/models/oauth2_project.rb +++ b/lib/appwrite/models/oauth2_project.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_project_list.rb b/lib/appwrite/models/oauth2_project_list.rb index 5063b9b0..a98a6769 100644 --- a/lib/appwrite/models/oauth2_project_list.rb +++ b/lib/appwrite/models/oauth2_project_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_reject.rb b/lib/appwrite/models/oauth2_reject.rb index 62f80c40..614546e0 100644 --- a/lib/appwrite/models/oauth2_reject.rb +++ b/lib/appwrite/models/oauth2_reject.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_token.rb b/lib/appwrite/models/oauth2_token.rb index db7630c4..59ffd23f 100644 --- a/lib/appwrite/models/oauth2_token.rb +++ b/lib/appwrite/models/oauth2_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -17,8 +17,8 @@ def initialize( expires_in:, refresh_token:, scope:, - authorization_details: , - id_token: + authorization_details:, + id_token: ) @access_token = access_token @token_type = token_type diff --git a/lib/appwrite/models/organization.rb b/lib/appwrite/models/organization.rb index d3aa9fe9..aa53b68a 100644 --- a/lib/appwrite/models/organization.rb +++ b/lib/appwrite/models/organization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -46,7 +46,7 @@ def initialize( name:, total:, prefs:, - billing_budget: , + billing_budget:, budget_alerts:, billing_plan:, billing_plan_id:, @@ -55,23 +55,23 @@ def initialize( billing_start_date:, billing_current_invoice_date:, billing_next_invoice_date:, - billing_trial_start_date: , + billing_trial_start_date:, billing_trial_days:, billing_aggregation_id:, billing_invoice_id:, payment_method_id:, - billing_address_id: , - backup_payment_method_id: , + billing_address_id:, + backup_payment_method_id:, status:, - remarks: , - agreement_baa: , - program_manager_name: , - program_manager_calendar: , - program_discord_channel_name: , - program_discord_channel_url: , - billing_limits: , - billing_plan_downgrade: , - billing_tax_id: , + remarks:, + agreement_baa:, + program_manager_name:, + program_manager_calendar:, + program_discord_channel_name:, + program_discord_channel_url:, + billing_limits:, + billing_plan_downgrade:, + billing_tax_id:, marked_for_deletion:, platform:, projects: diff --git a/lib/appwrite/models/phone.rb b/lib/appwrite/models/phone.rb index 176532e3..769ea1be 100644 --- a/lib/appwrite/models/phone.rb +++ b/lib/appwrite/models/phone.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/phone_list.rb b/lib/appwrite/models/phone_list.rb index 6bc20897..d6ad3e14 100644 --- a/lib/appwrite/models/phone_list.rb +++ b/lib/appwrite/models/phone_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/platform_android.rb b/lib/appwrite/models/platform_android.rb index 042bf0b5..64b05d7d 100644 --- a/lib/appwrite/models/platform_android.rb +++ b/lib/appwrite/models/platform_android.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_apple.rb b/lib/appwrite/models/platform_apple.rb index 61174dbd..06f7aeea 100644 --- a/lib/appwrite/models/platform_apple.rb +++ b/lib/appwrite/models/platform_apple.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_linux.rb b/lib/appwrite/models/platform_linux.rb index 53e2e902..1442fd5e 100644 --- a/lib/appwrite/models/platform_linux.rb +++ b/lib/appwrite/models/platform_linux.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_list.rb b/lib/appwrite/models/platform_list.rb index d374d18d..a51bb20e 100644 --- a/lib/appwrite/models/platform_list.rb +++ b/lib/appwrite/models/platform_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/platform_web.rb b/lib/appwrite/models/platform_web.rb index 2431d067..8e84519d 100644 --- a/lib/appwrite/models/platform_web.rb +++ b/lib/appwrite/models/platform_web.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_windows.rb b/lib/appwrite/models/platform_windows.rb index 08dcec19..560f44d4 100644 --- a/lib/appwrite/models/platform_windows.rb +++ b/lib/appwrite/models/platform_windows.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/policy_deny_aliased_email.rb b/lib/appwrite/models/policy_deny_aliased_email.rb index 9d3ef5af..f7b755ae 100644 --- a/lib/appwrite/models/policy_deny_aliased_email.rb +++ b/lib/appwrite/models/policy_deny_aliased_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_corporate_email.rb b/lib/appwrite/models/policy_deny_corporate_email.rb index d57f0c2c..4bdf38ae 100644 --- a/lib/appwrite/models/policy_deny_corporate_email.rb +++ b/lib/appwrite/models/policy_deny_corporate_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_disposable_email.rb b/lib/appwrite/models/policy_deny_disposable_email.rb index 14d5d5e1..23393bea 100644 --- a/lib/appwrite/models/policy_deny_disposable_email.rb +++ b/lib/appwrite/models/policy_deny_disposable_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_free_email.rb b/lib/appwrite/models/policy_deny_free_email.rb index 54d56812..766573bb 100644 --- a/lib/appwrite/models/policy_deny_free_email.rb +++ b/lib/appwrite/models/policy_deny_free_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_list.rb b/lib/appwrite/models/policy_list.rb index afcebe58..077c62f5 100644 --- a/lib/appwrite/models/policy_list.rb +++ b/lib/appwrite/models/policy_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_membership_privacy.rb b/lib/appwrite/models/policy_membership_privacy.rb index 9635ac3e..9fa040f1 100644 --- a/lib/appwrite/models/policy_membership_privacy.rb +++ b/lib/appwrite/models/policy_membership_privacy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_mfa_factors.rb b/lib/appwrite/models/policy_mfa_factors.rb index 158c12ff..e49890a8 100644 --- a/lib/appwrite/models/policy_mfa_factors.rb +++ b/lib/appwrite/models/policy_mfa_factors.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_dictionary.rb b/lib/appwrite/models/policy_password_dictionary.rb index a668c5ab..38423bc4 100644 --- a/lib/appwrite/models/policy_password_dictionary.rb +++ b/lib/appwrite/models/policy_password_dictionary.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_history.rb b/lib/appwrite/models/policy_password_history.rb index 1eca50ad..e2d4b842 100644 --- a/lib/appwrite/models/policy_password_history.rb +++ b/lib/appwrite/models/policy_password_history.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_personal_data.rb b/lib/appwrite/models/policy_password_personal_data.rb index cd05e9df..7e2c290e 100644 --- a/lib/appwrite/models/policy_password_personal_data.rb +++ b/lib/appwrite/models/policy_password_personal_data.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_strength.rb b/lib/appwrite/models/policy_password_strength.rb index 0f712e4f..c2bf28fb 100644 --- a/lib/appwrite/models/policy_password_strength.rb +++ b/lib/appwrite/models/policy_password_strength.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_alert.rb b/lib/appwrite/models/policy_session_alert.rb index b97135f0..74ee3fa2 100644 --- a/lib/appwrite/models/policy_session_alert.rb +++ b/lib/appwrite/models/policy_session_alert.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_duration.rb b/lib/appwrite/models/policy_session_duration.rb index a20b886a..f23f26e9 100644 --- a/lib/appwrite/models/policy_session_duration.rb +++ b/lib/appwrite/models/policy_session_duration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_invalidation.rb b/lib/appwrite/models/policy_session_invalidation.rb index a2c18315..4c7b0a2e 100644 --- a/lib/appwrite/models/policy_session_invalidation.rb +++ b/lib/appwrite/models/policy_session_invalidation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_limit.rb b/lib/appwrite/models/policy_session_limit.rb index 8c06cde9..2c3783d8 100644 --- a/lib/appwrite/models/policy_session_limit.rb +++ b/lib/appwrite/models/policy_session_limit.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_user_limit.rb b/lib/appwrite/models/policy_user_limit.rb index 976fc687..b5554c19 100644 --- a/lib/appwrite/models/policy_user_limit.rb +++ b/lib/appwrite/models/policy_user_limit.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/postgres_extension.rb b/lib/appwrite/models/postgres_extension.rb new file mode 100644 index 00000000..6ae09339 --- /dev/null +++ b/lib/appwrite/models/postgres_extension.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class PostgresExtension + attr_reader :key + attr_reader :name + attr_reader :description + attr_reader :category + + def initialize( + key:, + name:, + description:, + category: + ) + @key = key + @name = name + @description = description + @category = category + end + + def self.from(map:) + PostgresExtension.new( + key: map["key"], + name: map["name"], + description: map["description"], + category: map["category"] + ) + end + + def to_map + { + "key": @key, + "name": @name, + "description": @description, + "category": @category + } + end + end + end +end diff --git a/lib/appwrite/models/preferences.rb b/lib/appwrite/models/preferences.rb index a4551272..838aee6e 100644 --- a/lib/appwrite/models/preferences.rb +++ b/lib/appwrite/models/preferences.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/presence.rb b/lib/appwrite/models/presence.rb index 237cd16d..dabfb838 100644 --- a/lib/appwrite/models/presence.rb +++ b/lib/appwrite/models/presence.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( updated_at:, permissions:, user_id:, - status: , + status:, source:, - expires_at: , - metadata: + expires_at:, + metadata: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/presence_list.rb b/lib/appwrite/models/presence_list.rb index c504271e..01fa5bcb 100644 --- a/lib/appwrite/models/presence_list.rb +++ b/lib/appwrite/models/presence_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/program.rb b/lib/appwrite/models/program.rb index 4a2f1032..db9215e1 100644 --- a/lib/appwrite/models/program.rb +++ b/lib/appwrite/models/program.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index bf6fc02e..3e508814 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -79,24 +79,24 @@ def initialize( blocks:, console_accessed_at:, waf_enabled:, - billing_limits: , - o_auth2_server_enabled: , - o_auth2_server_authorization_url: , - o_auth2_server_scopes: , - o_auth2_server_default_scopes: , - o_auth2_server_installation_scopes: , - o_auth2_server_authorization_details_types: , - o_auth2_server_access_token_duration: , - o_auth2_server_refresh_token_duration: , - o_auth2_server_public_access_token_duration: , - o_auth2_server_public_refresh_token_duration: , - o_auth2_server_installation_access_token_duration: , - o_auth2_server_confidential_pkce: , - o_auth2_server_verification_url: , - o_auth2_server_user_code_length: , - o_auth2_server_user_code_format: , - o_auth2_server_device_code_duration: , - o_auth2_server_discovery_url: + billing_limits:, + o_auth2_server_enabled:, + o_auth2_server_authorization_url:, + o_auth2_server_scopes:, + o_auth2_server_default_scopes:, + o_auth2_server_installation_scopes:, + o_auth2_server_authorization_details_types:, + o_auth2_server_access_token_duration:, + o_auth2_server_refresh_token_duration:, + o_auth2_server_public_access_token_duration:, + o_auth2_server_public_refresh_token_duration:, + o_auth2_server_installation_access_token_duration:, + o_auth2_server_confidential_pkce:, + o_auth2_server_verification_url:, + o_auth2_server_user_code_length:, + o_auth2_server_user_code_format:, + o_auth2_server_device_code_duration:, + o_auth2_server_discovery_url: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/project_auth_method.rb b/lib/appwrite/models/project_auth_method.rb index 17cfbbc5..8aa64812 100644 --- a/lib/appwrite/models/project_auth_method.rb +++ b/lib/appwrite/models/project_auth_method.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -47,7 +47,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/project_list.rb b/lib/appwrite/models/project_list.rb index b8e06931..552309a5 100644 --- a/lib/appwrite/models/project_list.rb +++ b/lib/appwrite/models/project_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/project_protocol.rb b/lib/appwrite/models/project_protocol.rb index 2c8f0b8d..58448214 100644 --- a/lib/appwrite/models/project_protocol.rb +++ b/lib/appwrite/models/project_protocol.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -43,7 +43,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/project_service.rb b/lib/appwrite/models/project_service.rb index b5336758..6f426843 100644 --- a/lib/appwrite/models/project_service.rb +++ b/lib/appwrite/models/project_service.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -58,7 +58,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/provider.rb b/lib/appwrite/models/provider.rb index f76f1d68..80d6c956 100644 --- a/lib/appwrite/models/provider.rb +++ b/lib/appwrite/models/provider.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( enabled:, type:, credentials:, - options: + options: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/provider_list.rb b/lib/appwrite/models/provider_list.rb index 40e411bf..32f7da98 100644 --- a/lib/appwrite/models/provider_list.rb +++ b/lib/appwrite/models/provider_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/proxy_invalidation.rb b/lib/appwrite/models/proxy_invalidation.rb index d87b4b19..584669ac 100644 --- a/lib/appwrite/models/proxy_invalidation.rb +++ b/lib/appwrite/models/proxy_invalidation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/proxy_rule.rb b/lib/appwrite/models/proxy_rule.rb index 70990c4f..adb1cd58 100644 --- a/lib/appwrite/models/proxy_rule.rb +++ b/lib/appwrite/models/proxy_rule.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -29,7 +29,7 @@ def initialize( redirect_url:, redirect_status_code:, deployment_id:, - deployment_resource_type: , + deployment_resource_type:, deployment_resource_id:, deployment_vcs_provider_branch:, status:, @@ -121,7 +121,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/proxy_rule_list.rb b/lib/appwrite/models/proxy_rule_list.rb index a167e51c..24f99239 100644 --- a/lib/appwrite/models/proxy_rule_list.rb +++ b/lib/appwrite/models/proxy_rule_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/report.rb b/lib/appwrite/models/report.rb index 34597916..b3912319 100644 --- a/lib/appwrite/models/report.rb +++ b/lib/appwrite/models/report.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -28,7 +28,7 @@ def initialize( target:, categories:, insights:, - analyzed_at: + analyzed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/report_list.rb b/lib/appwrite/models/report_list.rb index a8eb1f5a..8cdd69a0 100644 --- a/lib/appwrite/models/report_list.rb +++ b/lib/appwrite/models/report_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/resource_token.rb b/lib/appwrite/models/resource_token.rb index 1d01e10c..61c2b49e 100644 --- a/lib/appwrite/models/resource_token.rb +++ b/lib/appwrite/models/resource_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/resource_token_list.rb b/lib/appwrite/models/resource_token_list.rb index c950a581..928b7825 100644 --- a/lib/appwrite/models/resource_token_list.rb +++ b/lib/appwrite/models/resource_token_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/row.rb b/lib/appwrite/models/row.rb index 48d852c9..c19c0445 100644 --- a/lib/appwrite/models/row.rb +++ b/lib/appwrite/models/row.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/row_list.rb b/lib/appwrite/models/row_list.rb index 26e676bf..debd9e50 100644 --- a/lib/appwrite/models/row_list.rb +++ b/lib/appwrite/models/row_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/runtime.rb b/lib/appwrite/models/runtime.rb index 4158038b..4a09aa27 100644 --- a/lib/appwrite/models/runtime.rb +++ b/lib/appwrite/models/runtime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/runtime_list.rb b/lib/appwrite/models/runtime_list.rb index a528fbed..5b69b4a6 100644 --- a/lib/appwrite/models/runtime_list.rb +++ b/lib/appwrite/models/runtime_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/session.rb b/lib/appwrite/models/session.rb index 6aa33b4a..762ee427 100644 --- a/lib/appwrite/models/session.rb +++ b/lib/appwrite/models/session.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/session_list.rb b/lib/appwrite/models/session_list.rb index c4e2efe2..320cefec 100644 --- a/lib/appwrite/models/session_list.rb +++ b/lib/appwrite/models/session_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/site.rb b/lib/appwrite/models/site.rb index 7e367f46..94e80f00 100644 --- a/lib/appwrite/models/site.rb +++ b/lib/appwrite/models/site.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,6 +19,7 @@ class Site attr_reader :latest_deployment_id attr_reader :latest_deployment_created_at attr_reader :latest_deployment_status + attr_reader :scopes attr_reader :vars attr_reader :timeout attr_reader :install_command @@ -55,6 +56,7 @@ def initialize( latest_deployment_id:, latest_deployment_created_at:, latest_deployment_status:, + scopes:, vars:, timeout:, install_command:, @@ -90,6 +92,7 @@ def initialize( @latest_deployment_id = latest_deployment_id @latest_deployment_created_at = latest_deployment_created_at @latest_deployment_status = latest_deployment_status + @scopes = scopes @vars = vars @timeout = timeout @install_command = install_command @@ -128,6 +131,7 @@ def self.from(map:) latest_deployment_id: map["latestDeploymentId"], latest_deployment_created_at: map["latestDeploymentCreatedAt"], latest_deployment_status: map["latestDeploymentStatus"], + scopes: map["scopes"], vars: map["vars"].map { |it| Variable.from(map: it) }, timeout: map["timeout"], install_command: map["installCommand"], @@ -167,6 +171,7 @@ def to_map "latestDeploymentId": @latest_deployment_id, "latestDeploymentCreatedAt": @latest_deployment_created_at, "latestDeploymentStatus": @latest_deployment_status, + "scopes": @scopes, "vars": @vars.map { |it| it.to_map }, "timeout": @timeout, "installCommand": @install_command, diff --git a/lib/appwrite/models/site_list.rb b/lib/appwrite/models/site_list.rb index 52efd19d..51fb319d 100644 --- a/lib/appwrite/models/site_list.rb +++ b/lib/appwrite/models/site_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/specification.rb b/lib/appwrite/models/specification.rb index 00c55547..e9ff5467 100644 --- a/lib/appwrite/models/specification.rb +++ b/lib/appwrite/models/specification.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/specification_list.rb b/lib/appwrite/models/specification_list.rb index 8a21f36b..8212053d 100644 --- a/lib/appwrite/models/specification_list.rb +++ b/lib/appwrite/models/specification_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/subscriber.rb b/lib/appwrite/models/subscriber.rb index 1f8fa67c..318baaab 100644 --- a/lib/appwrite/models/subscriber.rb +++ b/lib/appwrite/models/subscriber.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/subscriber_list.rb b/lib/appwrite/models/subscriber_list.rb index 1aafca67..01373385 100644 --- a/lib/appwrite/models/subscriber_list.rb +++ b/lib/appwrite/models/subscriber_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/table.rb b/lib/appwrite/models/table.rb index 6b1ebb33..2a7e4649 100644 --- a/lib/appwrite/models/table.rb +++ b/lib/appwrite/models/table.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/table_list.rb b/lib/appwrite/models/table_list.rb index 9c8d0ac0..034d7fb3 100644 --- a/lib/appwrite/models/table_list.rb +++ b/lib/appwrite/models/table_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/target.rb b/lib/appwrite/models/target.rb index 91101a5b..56e90755 100644 --- a/lib/appwrite/models/target.rb +++ b/lib/appwrite/models/target.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,7 +19,7 @@ def initialize( updated_at:, name:, user_id:, - provider_id: , + provider_id:, provider_type:, identifier:, expired: diff --git a/lib/appwrite/models/target_list.rb b/lib/appwrite/models/target_list.rb index 8ad6787f..9ccd7705 100644 --- a/lib/appwrite/models/target_list.rb +++ b/lib/appwrite/models/target_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/team.rb b/lib/appwrite/models/team.rb index 7b85b15a..d08f183f 100644 --- a/lib/appwrite/models/team.rb +++ b/lib/appwrite/models/team.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/team_list.rb b/lib/appwrite/models/team_list.rb index 169c1ee6..e02efc9c 100644 --- a/lib/appwrite/models/team_list.rb +++ b/lib/appwrite/models/team_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/token.rb b/lib/appwrite/models/token.rb index e5c76b43..b3f539af 100644 --- a/lib/appwrite/models/token.rb +++ b/lib/appwrite/models/token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/topic.rb b/lib/appwrite/models/topic.rb index ee19d417..4034f4b3 100644 --- a/lib/appwrite/models/topic.rb +++ b/lib/appwrite/models/topic.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/topic_list.rb b/lib/appwrite/models/topic_list.rb index a84a0292..e1b8c6d0 100644 --- a/lib/appwrite/models/topic_list.rb +++ b/lib/appwrite/models/topic_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/transaction.rb b/lib/appwrite/models/transaction.rb index a5e34565..481c25c9 100644 --- a/lib/appwrite/models/transaction.rb +++ b/lib/appwrite/models/transaction.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/transaction_list.rb b/lib/appwrite/models/transaction_list.rb index af4c464c..17234abd 100644 --- a/lib/appwrite/models/transaction_list.rb +++ b/lib/appwrite/models/transaction_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/usage_billing_plan.rb b/lib/appwrite/models/usage_billing_plan.rb index 23521586..be1d81f6 100644 --- a/lib/appwrite/models/usage_billing_plan.rb +++ b/lib/appwrite/models/usage_billing_plan.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -18,15 +18,15 @@ class UsageBillingPlan def initialize( bandwidth:, executions:, - member: , + member:, realtime:, realtime_messages:, - realtime_bandwidth: , + realtime_bandwidth:, storage:, users:, gb_hours:, image_transformations:, - credits: + credits: ) @bandwidth = bandwidth @executions = executions diff --git a/lib/appwrite/models/user.rb b/lib/appwrite/models/user.rb index e55781e3..aa133c24 100644 --- a/lib/appwrite/models/user.rb +++ b/lib/appwrite/models/user.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -35,9 +35,9 @@ def initialize( created_at:, updated_at:, name:, - password: , - hash: , - hash_options: , + password:, + hash:, + hash_options:, registration:, status:, labels:, @@ -45,18 +45,18 @@ def initialize( email:, phone:, email_verification:, - email_canonical: , - email_is_free: , - email_is_disposable: , - email_is_corporate: , - email_is_canonical: , + email_canonical:, + email_is_free:, + email_is_disposable:, + email_is_corporate:, + email_is_canonical:, phone_verification:, mfa:, prefs:, targets:, accessed_at:, - impersonator: , - impersonator_user_id: + impersonator:, + impersonator_user_id: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/user_list.rb b/lib/appwrite/models/user_list.rb index 6ed83550..79c4c6d3 100644 --- a/lib/appwrite/models/user_list.rb +++ b/lib/appwrite/models/user_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/variable.rb b/lib/appwrite/models/variable.rb index b6d33d72..1c14a73d 100644 --- a/lib/appwrite/models/variable.rb +++ b/lib/appwrite/models/variable.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/variable_list.rb b/lib/appwrite/models/variable_list.rb index a5261756..6c36b9d1 100644 --- a/lib/appwrite/models/variable_list.rb +++ b/lib/appwrite/models/variable_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/vectorsdb_collection.rb b/lib/appwrite/models/vectorsdb_collection.rb new file mode 100644 index 00000000..fc878665 --- /dev/null +++ b/lib/appwrite/models/vectorsdb_collection.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class VectorsdbCollection + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :permissions + attr_reader :database_id + attr_reader :name + attr_reader :enabled + attr_reader :document_security + attr_reader :attributes + attr_reader :indexes + attr_reader :bytes_max + attr_reader :bytes_used + attr_reader :dimension + + def initialize( + id:, + created_at:, + updated_at:, + permissions:, + database_id:, + name:, + enabled:, + document_security:, + attributes:, + indexes:, + bytes_max:, + bytes_used:, + dimension: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @permissions = permissions + @database_id = database_id + @name = name + @enabled = enabled + @document_security = document_security + @attributes = attributes + @indexes = indexes + @bytes_max = bytes_max + @bytes_used = bytes_used + @dimension = dimension + end + + def self.from(map:) + VectorsdbCollection.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + permissions: map["$permissions"], + database_id: map["databaseId"], + name: map["name"], + enabled: map["enabled"], + document_security: map["documentSecurity"], + attributes: map["attributes"], + indexes: map["indexes"].map { |it| Index.from(map: it) }, + bytes_max: map["bytesMax"], + bytes_used: map["bytesUsed"], + dimension: map["dimension"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "$permissions": @permissions, + "databaseId": @database_id, + "name": @name, + "enabled": @enabled, + "documentSecurity": @document_security, + "attributes": @attributes, + "indexes": @indexes.map { |it| it.to_map }, + "bytesMax": @bytes_max, + "bytesUsed": @bytes_used, + "dimension": @dimension + } + end + end + end +end diff --git a/lib/appwrite/models/vectorsdb_collection_list.rb b/lib/appwrite/models/vectorsdb_collection_list.rb new file mode 100644 index 00000000..e933696b --- /dev/null +++ b/lib/appwrite/models/vectorsdb_collection_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class VectorsdbCollectionList + attr_reader :total + attr_reader :collections + + def initialize( + total:, + collections: + ) + @total = total + @collections = collections + end + + def self.from(map:) + VectorsdbCollectionList.new( + total: map["total"], + collections: map["collections"].map { |it| VectorsdbCollection.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "collections": @collections.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/webhook.rb b/lib/appwrite/models/webhook.rb index 77ed5dec..5e418078 100644 --- a/lib/appwrite/models/webhook.rb +++ b/lib/appwrite/models/webhook.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/webhook_list.rb b/lib/appwrite/models/webhook_list.rb index 0225609c..1df070b9 100644 --- a/lib/appwrite/models/webhook_list.rb +++ b/lib/appwrite/models/webhook_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/operator.rb b/lib/appwrite/operator.rb index 92ea6fa5..87de54ca 100644 --- a/lib/appwrite/operator.rb +++ b/lib/appwrite/operator.rb @@ -40,6 +40,7 @@ class << Operator def increment(value = 1, max = nil) raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [value] values << max if max != nil return Operator.new("increment", values).to_s @@ -48,6 +49,7 @@ def increment(value = 1, max = nil) def decrement(value = 1, min = nil) raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?) raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?) + values = [value] values << min if min != nil return Operator.new("decrement", values).to_s @@ -56,6 +58,7 @@ def decrement(value = 1, min = nil) def multiply(factor, max = nil) raise ArgumentError, "Factor cannot be NaN or Infinity" if factor.respond_to?(:nan?) && (factor.nan? || factor.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [factor] values << max if max != nil return Operator.new("multiply", values).to_s @@ -65,6 +68,7 @@ def divide(divisor, min = nil) raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?) raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?) raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0 + values = [divisor] values << min if min != nil return Operator.new("divide", values).to_s @@ -73,12 +77,14 @@ def divide(divisor, min = nil) def modulo(divisor) raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?) raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0 + return Operator.new("modulo", [divisor]).to_s end def power(exponent, max = nil) raise ArgumentError, "Exponent cannot be NaN or Infinity" if exponent.respond_to?(:nan?) && (exponent.nan? || exponent.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [exponent] values << max if max != nil return Operator.new("power", values).to_s diff --git a/lib/appwrite/permission.rb b/lib/appwrite/permission.rb index f47a5c2e..190aa9d8 100644 --- a/lib/appwrite/permission.rb +++ b/lib/appwrite/permission.rb @@ -4,15 +4,19 @@ class << Permission def read(role) return "read(\"#{role}\")" end + def write(role) return "write(\"#{role}\")" end + def create(role) return "create(\"#{role}\")" end + def update(role) return "update(\"#{role}\")" end + def delete(role) return "delete(\"#{role}\")" end diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index aa7f01e2..3312d81f 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -48,15 +48,15 @@ def regex(attribute, pattern) def less_than(attribute, value) return Query.new("lessThan", attribute, value).to_s end - + def less_than_equal(attribute, value) return Query.new("lessThanEqual", attribute, value).to_s end - + def greater_than(attribute, value) return Query.new("greaterThan", attribute, value).to_s end - + def greater_than_equal(attribute, value) return Query.new("greaterThanEqual", attribute, value).to_s end @@ -100,7 +100,7 @@ def ends_with(attribute, value) def select(attributes) return Query.new("select", nil, attributes).to_s end - + def search(attribute, value) return Query.new("search", attribute, value).to_s end diff --git a/lib/appwrite/role.rb b/lib/appwrite/role.rb index ec171545..7c32245a 100644 --- a/lib/appwrite/role.rb +++ b/lib/appwrite/role.rb @@ -1,10 +1,8 @@ module Appwrite - # Helper class to generate role strings for `Permission`. class Role - # Grants access to anyone. - # + # # This includes authenticated and unauthenticated users. # # @return [String] @@ -13,24 +11,24 @@ def self.any end # Grants access to a specific user by user ID. - # + # # You can optionally pass verified or unverified for # `status` to target specific types of users. # # @param [String] id # @param [String] status - # + # # @return [String] def self.user(id, status = "") - if(status.empty?) + if (status.empty?) "user:#{id}" else "user:#{id}/#{status}" end end - + # Grants access to any authenticated or anonymous user. - # + # # You can optionally pass verified or unverified for # `status` to target specific types of users. # @@ -38,13 +36,13 @@ def self.user(id, status = "") # # @return [String] def self.users(status = "") - if(status.empty?) + if (status.empty?) 'users' else "users/#{status}" end end - + # Grants access to any guest user without a session. # # Authenticated users don't have access to this role. @@ -53,7 +51,7 @@ def self.users(status = "") def self.guests 'guests' end - + # Grants access to a team by team ID. # # You can optionally pass a role for `role` to target @@ -64,7 +62,7 @@ def self.guests # # @return [String] def self.team(id, role = "") - if(role.empty?) + if (role.empty?) "team:#{id}" else "team:#{id}/#{role}" @@ -72,7 +70,7 @@ def self.team(id, role = "") end # Grants access to a specific member of a team. - # + # # When the member is removed from the team, they will # no longer have access. # @@ -92,4 +90,4 @@ def self.label(name) "label:#{name}" end end -end \ No newline at end of file +end diff --git a/lib/appwrite/service.rb b/lib/appwrite/service.rb index c0ec9a54..2ff69d58 100644 --- a/lib/appwrite/service.rb +++ b/lib/appwrite/service.rb @@ -3,5 +3,5 @@ class Service def initialize(client) @client = client end - end + end end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 7b2bcb73..e32c1309 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Account < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/account' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -29,7 +27,6 @@ def get() params: api_params, response_type: Models::User ) - end # Use this endpoint to allow a new user to register a new account in your @@ -40,25 +37,30 @@ def get() # login to their new account, you need to create a new [account # session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password New user password. Must be between 8 and 256 chars. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create(user_id:, email:, password:, name: nil) + def create( + user_id:, + email:, + password:, + name: nil + ) api_path = '/account' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -67,7 +69,7 @@ def create(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -81,7 +83,6 @@ def create(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Get a list of the OAuth2 consents the current user has given to third-party @@ -91,14 +92,17 @@ def create(user_id:, email:, password:, name: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [Oauth2ConsentList] - def list_consents(queries: nil, total: nil) + def list_consents( + queries: nil, + total: nil + ) api_path = '/account/consents' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -111,7 +115,6 @@ def list_consents(queries: nil, total: nil) params: api_params, response_type: Models::Oauth2ConsentList ) - end # Get an OAuth2 consent the current user has given to a third-party app by @@ -120,17 +123,18 @@ def list_consents(queries: nil, total: nil) # @param [String] consent_id Consent unique ID. # # @return [Oauth2Consent] - def get_consent(consent_id:) + def get_consent( + consent_id: + ) api_path = '/account/consents/{consentId}' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -143,7 +147,6 @@ def get_consent(consent_id:) params: api_params, response_type: Models::Oauth2Consent ) - end # Delete an OAuth2 consent by its unique ID. All token families issued under @@ -153,17 +156,18 @@ def get_consent(consent_id:) # @param [String] consent_id Consent unique ID. # # @return [] - def delete_consent(consent_id:) + def delete_consent( + consent_id: + ) api_path = '/account/consents/{consentId}' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -176,7 +180,6 @@ def delete_consent(consent_id:) headers: api_headers, params: api_params, ) - end # Get a list of the token families issued under an OAuth2 consent. Each entry @@ -188,19 +191,23 @@ def delete_consent(consent_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [Oauth2ConsentTokenList] - def list_consent_tokens(consent_id:, queries: nil, total: nil) + def list_consent_tokens( + consent_id:, + queries: nil, + total: nil + ) api_path = '/account/consents/{consentId}/tokens' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -213,7 +220,6 @@ def list_consent_tokens(consent_id:, queries: nil, total: nil) params: api_params, response_type: Models::Oauth2ConsentTokenList ) - end # Get a token family issued under an OAuth2 consent by its unique ID. The @@ -223,22 +229,24 @@ def list_consent_tokens(consent_id:, queries: nil, total: nil) # @param [String] token_id Token unique ID. # # @return [Oauth2ConsentToken] - def get_consent_token(consent_id:, token_id:) + def get_consent_token( + consent_id:, + token_id: + ) api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', consent_id) .gsub('{tokenId}', token_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -251,7 +259,6 @@ def get_consent_token(consent_id:, token_id:) params: api_params, response_type: Models::Oauth2ConsentToken ) - end # Delete a token family issued under an OAuth2 consent by its unique ID. The @@ -262,22 +269,24 @@ def get_consent_token(consent_id:, token_id:) # @param [String] token_id Token unique ID. # # @return [] - def delete_consent_token(consent_id:, token_id:) + def delete_consent_token( + consent_id:, + token_id: + ) api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', consent_id) .gsub('{tokenId}', token_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -290,7 +299,6 @@ def delete_consent_token(consent_id:, token_id:) headers: api_headers, params: api_params, ) - end # Update currently logged in user account email address. After changing user @@ -300,28 +308,31 @@ def delete_consent_token(consent_id:, token_id:) # user password is required to complete this request. # This endpoint can also be used to convert an anonymous account to a normal # one, by passing an email address and a new password. - # + # # # @param [String] email User email. # @param [String] password User password. Must be at least 8 chars. # # @return [User] - def update_email(email:, password:) + def update_email( + email:, + password: + ) api_path = '/account/email' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { email: email, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -335,7 +346,6 @@ def update_email(email:, password:) params: api_params, response_type: Models::User ) - end # Get the list of identities for the currently logged in user. @@ -344,14 +354,17 @@ def update_email(email:, password:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IdentityList] - def list_identities(queries: nil, total: nil) + def list_identities( + queries: nil, + total: nil + ) api_path = '/account/identities' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -364,7 +377,6 @@ def list_identities(queries: nil, total: nil) params: api_params, response_type: Models::IdentityList ) - end # Delete an identity by its unique ID. @@ -372,17 +384,18 @@ def list_identities(queries: nil, total: nil) # @param [String] identity_id Identity ID. # # @return [] - def delete_identity(identity_id:) + def delete_identity( + identity_id: + ) api_path = '/account/identities/{identityId}' .gsub('{identityId}', identity_id) if identity_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "identityId"') + raise Appwrite::Exception.new('Missing required parameter: "identityId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -394,7 +407,6 @@ def delete_identity(identity_id:) headers: api_headers, params: api_params, ) - end # Get the list of latest security activity logs for the currently logged in @@ -404,14 +416,17 @@ def delete_identity(identity_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [LogList] - def list_logs(queries: nil, total: nil) + def list_logs( + queries: nil, + total: nil + ) api_path = '/account/logs' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -424,7 +439,6 @@ def list_logs(queries: nil, total: nil) params: api_params, response_type: Models::LogList ) - end # Enable or disable MFA on an account. @@ -432,17 +446,19 @@ def list_logs(queries: nil, total: nil) # @param [] mfa Enable or disable MFA. # # @return [User] - def update_mfa(mfa:) + def update_mfa( + mfa: + ) api_path = '/account/mfa' if mfa.nil? - raise Appwrite::Exception.new('Missing required parameter: "mfa"') + raise Appwrite::Exception.new('Missing required parameter: "mfa"') end api_params = { mfa: mfa, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -456,7 +472,6 @@ def update_mfa(mfa:) params: api_params, response_type: Models::User ) - end # Add an authenticator app to be used as an MFA factor. Verify the @@ -467,17 +482,18 @@ def update_mfa(mfa:) # @param [AuthenticatorType] type Type of authenticator. Must be `totp` # # @return [MfaType] - def create_mfa_authenticator(type:) + def create_mfa_authenticator( + type: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -491,7 +507,6 @@ def create_mfa_authenticator(type:) params: api_params, response_type: Models::MfaType ) - end # Verify an authenticator app after adding it using the [add @@ -502,22 +517,25 @@ def create_mfa_authenticator(type:) # @param [String] otp Valid verification token. # # @return [User] - def update_mfa_authenticator(type:, otp:) + def update_mfa_authenticator( + type:, + otp: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -531,7 +549,6 @@ def update_mfa_authenticator(type:, otp:) params: api_params, response_type: Models::User ) - end # Delete an authenticator for a user by ID. @@ -539,17 +556,18 @@ def update_mfa_authenticator(type:, otp:) # @param [AuthenticatorType] type Type of authenticator. # # @return [] - def delete_mfa_authenticator(type:) + def delete_mfa_authenticator( + type: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -561,7 +579,6 @@ def delete_mfa_authenticator(type:) headers: api_headers, params: api_params, ) - end # Begin the process of MFA verification after sign-in. Finish the flow with @@ -571,17 +588,19 @@ def delete_mfa_authenticator(type:) # @param [AuthenticationFactor] factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. # # @return [MfaChallenge] - def create_mfa_challenge(factor:) + def create_mfa_challenge( + factor: + ) api_path = '/account/mfa/challenges' if factor.nil? - raise Appwrite::Exception.new('Missing required parameter: "factor"') + raise Appwrite::Exception.new('Missing required parameter: "factor"') end api_params = { factor: factor, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -595,7 +614,6 @@ def create_mfa_challenge(factor:) params: api_params, response_type: Models::MfaChallenge ) - end # Complete the MFA challenge by providing the one-time password. Finish the @@ -608,22 +626,25 @@ def create_mfa_challenge(factor:) # @param [String] otp Valid verification token. # # @return [Session] - def update_mfa_challenge(challenge_id:, otp:) + def update_mfa_challenge( + challenge_id:, + otp: + ) api_path = '/account/mfa/challenges' if challenge_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "challengeId"') + raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { challengeId: challenge_id, otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -637,7 +658,6 @@ def update_mfa_challenge(challenge_id:, otp:) params: api_params, response_type: Models::Session ) - end # List the factors available on the account to be used as a MFA challange. @@ -647,9 +667,8 @@ def update_mfa_challenge(challenge_id:, otp:) def list_mfa_factors() api_path = '/account/mfa/factors' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -662,7 +681,6 @@ def list_mfa_factors() params: api_params, response_type: Models::MfaFactors ) - end # Get recovery codes that can be used as backup for MFA flow. Before getting @@ -675,9 +693,8 @@ def list_mfa_factors() def get_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -690,10 +707,9 @@ def get_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end - # Generate recovery codes as backup for MFA flow. It's recommended to + # Generate recovery codes as backup for MFA flow. It's recommended to # generate and show then immediately after user successfully adds their # authehticator. Recovery codes can be used as a MFA verification type in # [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) @@ -704,9 +720,8 @@ def get_mfa_recovery_codes() def create_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -720,7 +735,6 @@ def create_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Regenerate recovery codes that can be used as backup for MFA flow. Before @@ -733,9 +747,8 @@ def create_mfa_recovery_codes() def update_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -749,7 +762,6 @@ def update_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Update currently logged in user account name. @@ -757,17 +769,19 @@ def update_mfa_recovery_codes() # @param [String] name User name. Max length: 128 chars. # # @return [User] - def update_name(name:) + def update_name( + name: + ) api_path = '/account/name' if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + 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', @@ -781,7 +795,6 @@ def update_name(name:) params: api_params, response_type: Models::User ) - end # Update currently logged in user password. For validation, user is required @@ -792,18 +805,21 @@ def update_name(name:) # @param [String] old_password Current user password. Max length: 256 chars. # # @return [User] - def update_password(password:, old_password: nil) + def update_password( + password:, + old_password: nil + ) api_path = '/account/password' if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { password: password, oldPassword: old_password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -817,35 +833,37 @@ def update_password(password:, old_password: nil) params: api_params, response_type: Models::User ) - end - # Update the currently logged in user's phone number. After updating the + # Update the currently logged in user's phone number. After updating the # phone number, the phone verification status will be reset. A confirmation # SMS is not sent automatically, however you can use the [POST # /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) # endpoint to send a confirmation SMS. # - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] password User password. Must be at least 8 chars. # # @return [User] - def update_phone(phone:, password:) + def update_phone( + phone:, + password: + ) api_path = '/account/phone' if phone.nil? - raise Appwrite::Exception.new('Missing required parameter: "phone"') + raise Appwrite::Exception.new('Missing required parameter: "phone"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { phone: phone, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -859,7 +877,6 @@ def update_phone(phone:, password:) params: api_params, response_type: Models::User ) - end # Get the preferences as a key-value object for the currently logged in user. @@ -869,9 +886,8 @@ def update_phone(phone:, password:) def get_prefs() api_path = '/account/prefs' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -884,7 +900,6 @@ def get_prefs() params: api_params, response_type: Models::Preferences ) - end # Update currently logged in user account preferences. The object you pass is @@ -894,17 +909,19 @@ def get_prefs() # @param [Hash] prefs Prefs key-value JSON object. # # @return [User] - def update_prefs(prefs:) + def update_prefs( + prefs: + ) api_path = '/account/prefs' if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -918,7 +935,6 @@ def update_prefs(prefs:) params: api_params, response_type: Models::User ) - end # Sends the user an email with a temporary secret key for password reset. @@ -927,29 +943,32 @@ def update_prefs(prefs:) # attached to the URL query string. Use the query string params to submit a # request to the [PUT # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) - # endpoint to complete the process. The verification link sent to the user's + # endpoint to complete the process. The verification link sent to the user's # email address is valid for 1 hour. # # @param [String] email User email. # @param [String] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_recovery(email:, url:) + def create_recovery( + email:, + url: + ) api_path = '/account/recovery' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { email: email, url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -963,7 +982,6 @@ def create_recovery(email:, url:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user account password reset. Both the @@ -971,7 +989,7 @@ def create_recovery(email:, url:) # the redirect URL you have provided when sending your request to the [POST # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) # endpoint. - # + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) # the only valid redirect URLs are the ones from domains you have set when @@ -982,19 +1000,23 @@ def create_recovery(email:, url:) # @param [String] password New user password. Must be between 8 and 256 chars. # # @return [Token] - def update_recovery(user_id:, secret:, password:) + def update_recovery( + user_id:, + secret:, + password: + ) api_path = '/account/recovery' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -1002,7 +1024,7 @@ def update_recovery(user_id:, secret:, password:) secret: secret, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1016,7 +1038,6 @@ def update_recovery(user_id:, secret:, password:) params: api_params, response_type: Models::Token ) - end # Get the list of active sessions across different devices for the currently @@ -1027,9 +1048,8 @@ def update_recovery(user_id:, secret:, password:) def list_sessions() api_path = '/account/sessions' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1042,7 +1062,6 @@ def list_sessions() params: api_params, response_type: Models::SessionList ) - end # Delete all sessions from the user account and remove any sessions cookies @@ -1053,9 +1072,8 @@ def list_sessions() def delete_sessions() api_path = '/account/sessions' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1067,7 +1085,6 @@ def delete_sessions() headers: api_headers, params: api_params, ) - end # Use this endpoint to allow a new user to register an anonymous account in @@ -1083,9 +1100,8 @@ def delete_sessions() def create_anonymous_session() api_path = '/account/sessions/anonymous' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1099,12 +1115,11 @@ def create_anonymous_session() params: api_params, response_type: Models::Session ) - end # Allow the user to login into their account by providing a valid email and # password combination. This route will create a new session for the user. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). @@ -1113,22 +1128,25 @@ def create_anonymous_session() # @param [String] password User password. Must be at least 8 chars. # # @return [Session] - def create_email_password_session(email:, password:) + def create_email_password_session( + email:, + password: + ) api_path = '/account/sessions/email' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { email: email, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1142,7 +1160,6 @@ def create_email_password_session(email:, password:) params: api_params, response_type: Models::Session ) - end # @@ -1152,26 +1169,29 @@ def create_email_password_session(email:, password:) # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Valid verification token. # # @return [Session] - def update_magic_url_session(user_id:, secret:) + def update_magic_url_session( + user_id:, + secret: + ) api_path = '/account/sessions/magic-url' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1185,7 +1205,6 @@ def update_magic_url_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end # @@ -1195,26 +1214,29 @@ def update_magic_url_session(user_id:, secret:) # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Valid verification token. # # @return [Session] - def update_phone_session(user_id:, secret:) + def update_phone_session( + user_id:, + secret: + ) api_path = '/account/sessions/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1228,33 +1250,35 @@ def update_phone_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end # Use this endpoint to create a session from token. Provide the **userId** # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. # # @return [Session] - def create_session(user_id:, secret:) + def create_session( + user_id:, + secret: + ) api_path = '/account/sessions/token' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1268,26 +1292,26 @@ def create_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end - # Use this endpoint to get a logged in user's session using a Session ID. - # Inputting 'current' will return the current session being used. + # Use this endpoint to get a logged in user's session using a Session ID. + # Inputting 'current' will return the current session being used. # - # @param [String] session_id Session ID. Use the string 'current' to get the current device session. + # @param [String] session_id Session ID. Use the string 'current' to get the current device session. # # @return [Session] - def get_session(session_id:) + def get_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1300,27 +1324,27 @@ def get_session(session_id:) params: api_params, response_type: Models::Session ) - end - # Use this endpoint to extend a session's length. Extending a session is + # Use this endpoint to extend a session's length. Extending a session is # useful when session expiry is short. If the session was created using an # OAuth provider, this endpoint refreshes the access token from the provider. # - # @param [String] session_id Session ID. Use the string 'current' to update the current device session. + # @param [String] session_id Session ID. Use the string 'current' to update the current device session. # # @return [Session] - def update_session(session_id:) + def update_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1334,29 +1358,29 @@ def update_session(session_id:) params: api_params, response_type: Models::Session ) - end - # Logout the user. Use 'current' as the session ID to logout on this device, - # use a session ID to logout on another device. If you're looking to logout + # Logout the user. Use 'current' as the session ID to logout on this device, + # use a session ID to logout on another device. If you're looking to logout # the user on all devices, use [Delete # Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) # instead. # - # @param [String] session_id Session ID. Use the string 'current' to delete the current device session. + # @param [String] session_id Session ID. Use the string 'current' to delete the current device session. # # @return [] - def delete_session(session_id:) + def delete_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1368,7 +1392,6 @@ def delete_session(session_id:) headers: api_headers, params: api_params, ) - end # Block the currently logged in user account. Behind the scene, the user @@ -1380,9 +1403,8 @@ def delete_session(session_id:) def update_status() api_path = '/account/status' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1396,7 +1418,6 @@ def update_status() params: api_params, response_type: Models::User ) - end # Sends the user an email with a secret key for creating a session. If the @@ -1406,28 +1427,32 @@ def update_status() # email with the one-time password. Use the returned user ID and secret and # submit a request to the [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The secret sent to the user's email + # endpoint to complete the login process. The secret sent to the user's email # is valid for 15 minutes. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). - # # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. + # + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. # @param [String] email User email. # @param [] phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. # # @return [Token] - def create_email_token(user_id:, email:, phrase: nil) + def create_email_token( + user_id:, + email:, + phrase: nil + ) api_path = '/account/tokens/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { @@ -1435,7 +1460,7 @@ def create_email_token(user_id:, email:, phrase: nil) email: email, phrase: phrase, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1449,7 +1474,6 @@ def create_email_token(user_id:, email:, phrase: nil) params: api_params, response_type: Models::Token ) - end # Sends the user an email with a secret key for creating a session. If the @@ -1459,29 +1483,34 @@ def create_email_token(user_id:, email:, phrase: nil) # query string. Use the query string parameters to submit a request to the # [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The link sent to the user's email + # endpoint to complete the login process. The link sent to the user's email # address is valid for 1 hour. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). - # # - # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. + # + # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. # @param [String] email User email. # @param [String] url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [] phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. # # @return [Token] - def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) + def create_magic_url_token( + user_id:, + email:, + url: nil, + phrase: nil + ) api_path = '/account/tokens/magic-url' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { @@ -1490,7 +1519,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) url: url, phrase: phrase, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1504,36 +1533,40 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) params: api_params, response_type: Models::Token ) - end # Allow the user to login to their account using the OAuth2 provider of their # choice. Each OAuth2 provider should be enabled from the Appwrite console - # first. Use the success and failure arguments to provide a redirect URL's - # back to your app when login is completed. - # + # first. Use the success and failure arguments to provide a redirect URL's + # back to your app when login is completed. + # # If authentication succeeds, `userId` and `secret` of a token will be # appended to the success URL as query parameters. These can be used to # create a new session using the [Create # session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) # endpoint. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. # # @return [] - def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) + def create_o_auth2_token( + provider:, + success: nil, + failure: nil, + scopes: nil + ) api_path = '/account/tokens/oauth2/{provider}' .gsub('{provider}', provider) if provider.nil? - raise Appwrite::Exception.new('Missing required parameter: "provider"') + raise Appwrite::Exception.new('Missing required parameter: "provider"') end api_params = { @@ -1541,7 +1574,7 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) failure: failure, scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'text/html', @@ -1554,40 +1587,42 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) params: api_params, response_type: "location" ) - end # Sends the user an SMS with a secret key for creating a session. If the # provided user ID has not be registered, a new user will be created. Use the # returned user ID and secret and submit a request to the [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The secret sent to the user's phone + # endpoint to complete the login process. The secret sent to the user's phone # is valid for 15 minutes. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # # @return [Token] - def create_phone_token(user_id:, phone:) + def create_phone_token( + user_id:, + phone: + ) api_path = '/account/tokens/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if phone.nil? - raise Appwrite::Exception.new('Missing required parameter: "phone"') + raise Appwrite::Exception.new('Missing required parameter: "phone"') end api_params = { userId: user_id, phone: phone, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1601,7 +1636,6 @@ def create_phone_token(user_id:, phone:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to send a verification message to your user email address @@ -1612,28 +1646,30 @@ def create_phone_token(user_id:, phone:) # verification process by verifying both the **userId** and **secret** # parameters. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). - # The verification link sent to the user's email address is valid for 7 days. - # + # The verification link sent to the user's email address is valid for 7 days. + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), # the only valid redirect URLs are the ones from domains you have set when # adding your platforms in the console interface. - # + # # # @param [String] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_email_verification(url:) + def create_email_verification( + url: + ) api_path = '/account/verifications/email' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1647,7 +1683,6 @@ def create_email_verification(url:) params: api_params, response_type: Models::Token ) - end # @@ -1661,28 +1696,30 @@ def create_email_verification(url:) # verification process by verifying both the **userId** and **secret** # parameters. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). - # The verification link sent to the user's email address is valid for 7 days. - # + # The verification link sent to the user's email address is valid for 7 days. + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), # the only valid redirect URLs are the ones from domains you have set when # adding your platforms in the console interface. - # + # # # @param [String] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_verification(url:) + def create_verification( + url: + ) api_path = '/account/verifications/email' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1696,7 +1733,6 @@ def create_verification(url:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user email verification process. Use both @@ -1708,22 +1744,25 @@ def create_verification(url:) # @param [String] secret Valid verification token. # # @return [Token] - def update_email_verification(user_id:, secret:) + def update_email_verification( + user_id:, + secret: + ) api_path = '/account/verifications/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1737,7 +1776,6 @@ def update_email_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end # @@ -1752,22 +1790,25 @@ def update_email_verification(user_id:, secret:) # @param [String] secret Valid verification token. # # @return [Token] - def update_verification(user_id:, secret:) + def update_verification( + user_id:, + secret: + ) api_path = '/account/verifications/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1781,16 +1822,15 @@ def update_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to send a verification SMS to the currently logged in - # user. This endpoint is meant for use after updating a user's phone number + # user. This endpoint is meant for use after updating a user's phone number # using the # [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) # endpoint. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). - # The verification code sent to the user's phone number is valid for 15 + # The verification code sent to the user's phone number is valid for 15 # minutes. # # @@ -1798,9 +1838,8 @@ def update_verification(user_id:, secret:) def create_phone_verification() api_path = '/account/verifications/phone' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1814,11 +1853,10 @@ def create_phone_verification() params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user phone verification process. Use the - # **userId** and **secret** that were sent to your user's phone number to + # **userId** and **secret** that were sent to your user's phone number to # verify the user email ownership. If confirmed this route will return a 200 # status code. # @@ -1826,22 +1864,25 @@ def create_phone_verification() # @param [String] secret Valid verification token. # # @return [Token] - def update_phone_verification(user_id:, secret:) + def update_phone_verification( + user_id:, + secret: + ) api_path = '/account/verifications/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1855,8 +1896,6 @@ def update_phone_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end - - end + end end diff --git a/lib/appwrite/services/activities.rb b/lib/appwrite/services/activities.rb index 27b91242..2c4c457f 100644 --- a/lib/appwrite/services/activities.rb +++ b/lib/appwrite/services/activities.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Activities < Service - def initialize(client) @client = client end @@ -12,13 +11,15 @@ def initialize(client) # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. # # @return [ActivityEventList] - def list_events(queries: nil) + def list_events( + queries: nil + ) api_path = '/activities/events' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -31,26 +32,26 @@ def list_events(queries: nil) params: api_params, response_type: Models::ActivityEventList ) - end # Get event by ID. - # + # # # @param [String] event_id Event ID. # # @return [ActivityEvent] - def get_event(event_id:) + def get_event( + event_id: + ) api_path = '/activities/events/{eventId}' .gsub('{eventId}', event_id) if event_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "eventId"') + raise Appwrite::Exception.new('Missing required parameter: "eventId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -63,8 +64,6 @@ def get_event(event_id:) params: api_params, response_type: Models::ActivityEvent ) - end - - end + end end diff --git a/lib/appwrite/services/advisor.rb b/lib/appwrite/services/advisor.rb index 571216cf..7efe9fa7 100644 --- a/lib/appwrite/services/advisor.rb +++ b/lib/appwrite/services/advisor.rb @@ -1,28 +1,30 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Advisor < Service - def initialize(client) @client = client end - # Get a list of all the project's analyzer reports. You can use the query + # Get a list of all the project's analyzer reports. You can use the query # params to filter your results. - # + # # # @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. You may filter on the following attributes: appId, type, targetType, target, analyzedAt # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ReportList] - def list_reports(queries: nil, total: nil) + def list_reports( + queries: nil, + total: nil + ) api_path = '/reports' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -35,27 +37,27 @@ def list_reports(queries: nil, total: nil) params: api_params, response_type: Models::ReportList ) - end - # Get an analyzer report by its unique ID. The response includes the report's + # Get an analyzer report by its unique ID. The response includes the report's # metadata and the nested insights it produced. - # + # # # @param [String] report_id Report ID. # # @return [Report] - def get_report(report_id:) + def get_report( + report_id: + ) api_path = '/reports/{reportId}' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -68,27 +70,27 @@ def get_report(report_id:) params: api_params, response_type: Models::Report ) - end # Delete an analyzer report by its unique ID. Nested insights and CTA # metadata are removed asynchronously by the deletes worker. - # + # # # @param [String] report_id Report ID. # # @return [] - def delete_report(report_id:) + def delete_report( + report_id: + ) api_path = '/reports/{reportId}' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -100,31 +102,34 @@ def delete_report(report_id:) headers: api_headers, params: api_params, ) - end # List the insights produced under a single analyzer report. You can use the # query params to filter your results further. - # + # # # @param [String] report_id Parent report ID. # @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. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [InsightList] - def list_insights(report_id:, queries: nil, total: nil) + def list_insights( + report_id:, + queries: nil, + total: nil + ) api_path = '/reports/{reportId}/insights' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -137,32 +142,33 @@ def list_insights(report_id:, queries: nil, total: nil) params: api_params, response_type: Models::InsightList ) - end # Get an insight by its unique ID, scoped to its parent report. - # + # # # @param [String] report_id Parent report ID. # @param [String] insight_id Insight ID. # # @return [Insight] - def get_insight(report_id:, insight_id:) + def get_insight( + report_id:, + insight_id: + ) api_path = '/reports/{reportId}/insights/{insightId}' .gsub('{reportId}', report_id) .gsub('{insightId}', insight_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end if insight_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "insightId"') + raise Appwrite::Exception.new('Missing required parameter: "insightId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -175,8 +181,6 @@ def get_insight(report_id:, insight_id:) params: api_params, response_type: Models::Insight ) - end - - end + end end diff --git a/lib/appwrite/services/apps.rb b/lib/appwrite/services/apps.rb index b55b8d88..c4c15c1f 100644 --- a/lib/appwrite/services/apps.rb +++ b/lib/appwrite/services/apps.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Apps < Service - def initialize(client) @client = client end @@ -13,14 +12,17 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppsList] - def list(queries: nil, total: nil) + def list( + queries: nil, + total: nil + ) api_path = '/apps' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -33,12 +35,11 @@ def list(queries: nil, total: nil) params: api_params, response_type: Models::AppsList ) - end # Create a new application. # - # @param [String] app_id Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] app_id Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Application name. # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. # @param [String] description Application description shown to users during OAuth2 consent. @@ -59,19 +60,39 @@ def list(queries: nil, total: nil) # @param [String] team_id Team unique ID. # # @return [App] - def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil) + def create( + app_id:, + name:, + redirect_uris:, + description: nil, + client_uri: nil, + logo_uri: nil, + privacy_policy_url: nil, + terms_url: nil, + contacts: nil, + tagline: nil, + tags: nil, + images: nil, + support_url: nil, + data_deletion_url: nil, + post_logout_redirect_uris: nil, + enabled: nil, + type: nil, + device_flow: nil, + team_id: nil + ) api_path = '/apps' if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if redirect_uris.nil? - raise Appwrite::Exception.new('Missing required parameter: "redirectUris"') + raise Appwrite::Exception.new('Missing required parameter: "redirectUris"') end api_params = { @@ -95,7 +116,7 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo deviceFlow: device_flow, teamId: team_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -109,7 +130,6 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo params: api_params, response_type: Models::App ) - end # List scopes an application can request when installed on a team. @@ -119,9 +139,8 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo def list_installation_scopes() api_path = '/apps/scopes/installations' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -134,7 +153,6 @@ def list_installation_scopes() params: api_params, response_type: Models::AppScopeList ) - end # List scopes an application can request during the OAuth2 flow. @@ -144,9 +162,8 @@ def list_installation_scopes() def list_o_auth2_scopes() api_path = '/apps/scopes/oauth2' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -159,7 +176,6 @@ def list_o_auth2_scopes() params: api_params, response_type: Models::AppScopeList ) - end # Get an application by its unique ID. @@ -167,17 +183,18 @@ def list_o_auth2_scopes() # @param [String] app_id Application unique ID. # # @return [App] - def get(app_id:) + def get( + app_id: + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -190,7 +207,6 @@ def get(app_id:) params: api_params, response_type: Models::App ) - end # Update an application by its unique ID. @@ -213,20 +229,41 @@ def get(app_id:) # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. + # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. # @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. # # @return [App] - def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil) + def update( + app_id:, + name:, + description: nil, + client_uri: nil, + logo_uri: nil, + privacy_policy_url: nil, + terms_url: nil, + contacts: nil, + tagline: nil, + tags: nil, + images: nil, + support_url: nil, + data_deletion_url: nil, + enabled: nil, + redirect_uris: nil, + post_logout_redirect_uris: nil, + type: nil, + device_flow: nil, + installation_scopes: nil, + installation_redirect_url: nil + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -250,7 +287,7 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri installationScopes: installation_scopes, installationRedirectUrl: installation_redirect_url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -264,7 +301,6 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri params: api_params, response_type: Models::App ) - end # Delete an application by its unique ID. @@ -272,17 +308,18 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri # @param [String] app_id Application unique ID. # # @return [] - def delete(app_id:) + def delete( + app_id: + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -295,7 +332,6 @@ def delete(app_id:) headers: api_headers, params: api_params, ) - end # List installations of an application. Requires an app key sent in the @@ -307,19 +343,23 @@ def delete(app_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(app_id:, queries: nil, total: nil) + def list_installations( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/installations' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -332,7 +372,6 @@ def list_installations(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Get an installation of an application by its unique ID. Requires an app key @@ -343,22 +382,24 @@ def list_installations(app_id:, queries: nil, total: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(app_id:, installation_id:) + def get_installation( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -371,7 +412,6 @@ def get_installation(app_id:, installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Delete an installation of an application by its unique ID. Requires a @@ -382,22 +422,24 @@ def get_installation(app_id:, installation_id:) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(app_id:, installation_id:) + def delete_installation( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -410,7 +452,6 @@ def delete_installation(app_id:, installation_id:) headers: api_headers, params: api_params, ) - end # Create a token for an installation of an application. Requires an app key @@ -426,22 +467,24 @@ def delete_installation(app_id:, installation_id:) # @param [String] installation_id Installation unique ID. # # @return [Oauth2Token] - def create_installation_token(app_id:, installation_id:) + def create_installation_token( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}/tokens' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -455,7 +498,6 @@ def create_installation_token(app_id:, installation_id:) params: api_params, response_type: Models::Oauth2Token ) - end # List app keys for an application. @@ -465,19 +507,23 @@ def create_installation_token(app_id:, installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppKeyList] - def list_keys(app_id:, queries: nil, total: nil) + def list_keys( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/keys' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -490,27 +536,27 @@ def list_keys(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppKeyList ) - end # Create a new app key for an application. App keys carry no scopes; send one # in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to - # list the application's installations and create installation access tokens. + # list the application's installations and create installation access tokens. # # @param [String] app_id Application unique ID. # # @return [AppKey] - def create_key(app_id:) + def create_key( + app_id: + ) api_path = '/apps/{appId}/keys' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -524,7 +570,6 @@ def create_key(app_id:) params: api_params, response_type: Models::AppKey ) - end # Get an app key by its unique ID. @@ -533,22 +578,24 @@ def create_key(app_id:) # @param [String] key_id App key unique ID. # # @return [AppKey] - def get_key(app_id:, key_id:) + def get_key( + app_id:, + key_id: + ) api_path = '/apps/{appId}/keys/{keyId}' .gsub('{appId}', app_id) .gsub('{keyId}', key_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -561,7 +608,6 @@ def get_key(app_id:, key_id:) params: api_params, response_type: Models::AppKey ) - end # Delete an app key by its unique ID. @@ -570,22 +616,24 @@ def get_key(app_id:, key_id:) # @param [String] key_id App key unique ID. # # @return [] - def delete_key(app_id:, key_id:) + def delete_key( + app_id:, + key_id: + ) api_path = '/apps/{appId}/keys/{keyId}' .gsub('{appId}', app_id) .gsub('{keyId}', key_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -598,7 +646,6 @@ def delete_key(app_id:, key_id:) headers: api_headers, params: api_params, ) - end # Update the labels of an application. Labels are read-only for clients; only @@ -609,22 +656,25 @@ def delete_key(app_id:, key_id:) # @param [Array] labels Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [App] - def update_labels(app_id:, labels:) + def update_labels( + app_id:, + labels: + ) api_path = '/apps/{appId}/labels' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -638,7 +688,6 @@ def update_labels(app_id:, labels:) params: api_params, response_type: Models::App ) - end # List client secrets for an application. @@ -648,19 +697,23 @@ def update_labels(app_id:, labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppSecretList] - def list_secrets(app_id:, queries: nil, total: nil) + def list_secrets( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/secrets' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -673,7 +726,6 @@ def list_secrets(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppSecretList ) - end # Create a new client secret for an application. @@ -681,17 +733,18 @@ def list_secrets(app_id:, queries: nil, total: nil) # @param [String] app_id Application unique ID. # # @return [AppSecretPlaintext] - def create_secret(app_id:) + def create_secret( + app_id: + ) api_path = '/apps/{appId}/secrets' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -705,7 +758,6 @@ def create_secret(app_id:) params: api_params, response_type: Models::AppSecretPlaintext ) - end # Get an application client secret by its unique ID. @@ -714,22 +766,24 @@ def create_secret(app_id:) # @param [String] secret_id Secret unique ID. # # @return [AppSecret] - def get_secret(app_id:, secret_id:) + def get_secret( + app_id:, + secret_id: + ) api_path = '/apps/{appId}/secrets/{secretId}' .gsub('{appId}', app_id) .gsub('{secretId}', secret_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if secret_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "secretId"') + raise Appwrite::Exception.new('Missing required parameter: "secretId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -742,7 +796,6 @@ def get_secret(app_id:, secret_id:) params: api_params, response_type: Models::AppSecret ) - end # Delete an application client secret by its unique ID. @@ -751,22 +804,24 @@ def get_secret(app_id:, secret_id:) # @param [String] secret_id Secret unique ID. # # @return [] - def delete_secret(app_id:, secret_id:) + def delete_secret( + app_id:, + secret_id: + ) api_path = '/apps/{appId}/secrets/{secretId}' .gsub('{appId}', app_id) .gsub('{secretId}', secret_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if secret_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "secretId"') + raise Appwrite::Exception.new('Missing required parameter: "secretId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -779,7 +834,6 @@ def delete_secret(app_id:, secret_id:) headers: api_headers, params: api_params, ) - end # Transfer an application to another team by its unique ID. @@ -788,22 +842,25 @@ def delete_secret(app_id:, secret_id:) # @param [String] team_id Team ID of the team to transfer application to. # # @return [App] - def update_team(app_id:, team_id:) + def update_team( + app_id:, + team_id: + ) api_path = '/apps/{appId}/team' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { teamId: team_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -817,7 +874,6 @@ def update_team(app_id:, team_id:) params: api_params, response_type: Models::App ) - end # Revoke all tokens for an application by its unique ID. @@ -825,17 +881,18 @@ def update_team(app_id:, team_id:) # @param [String] app_id Application unique ID. # # @return [] - def delete_tokens(app_id:) + def delete_tokens( + app_id: + ) api_path = '/apps/{appId}/tokens' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -848,8 +905,6 @@ def delete_tokens(app_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index e4163c75..fb6cafec 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Avatars < Service - def initialize(client) @client = client end @@ -12,7 +11,7 @@ def initialize(client) # /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) # endpoint. Use width, height and quality arguments to change the output # settings. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size @@ -24,12 +23,17 @@ def initialize(client) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_browser(code:, width: nil, height: nil, quality: nil) + def get_browser( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/browsers/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -37,7 +41,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -49,18 +53,17 @@ def get_browser(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # The credit card endpoint will return you the icon of the credit card # provider you need. Use width, height and quality arguments to change the # output settings. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -68,12 +71,17 @@ def get_browser(code:, width: nil, height: nil, quality: nil) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_credit_card(code:, width: nil, height: nil, quality: nil) + def get_credit_card( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/credit-cards/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -81,7 +89,7 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -93,28 +101,29 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to fetch the favorite icon (AKA favicon) of any remote # website URL. - # + # # This endpoint does not follow HTTP redirects. # # @param [String] url Website URL which you want to fetch the favicon from. # # @return [] - def get_favicon(url:) + def get_favicon( + url: + ) api_path = '/avatars/favicon' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -126,19 +135,18 @@ def get_favicon(url:) headers: api_headers, params: api_params, ) - end # You can use this endpoint to show different country flags icons to your # users. The code argument receives the 2 letter country code. Use width, # height and quality arguments to change the output settings. Country codes # follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [Flag] code Country Code. ISO Alpha-2 country code format. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -146,12 +154,17 @@ def get_favicon(url:) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_flag(code:, width: nil, height: nil, quality: nil) + def get_flag( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/flags/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -159,7 +172,7 @@ def get_flag(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -171,19 +184,18 @@ def get_flag(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to fetch a remote image URL and crop it to any image size # you want. This endpoint is very useful if you need to crop and display # remote images in your app or in case you want to make sure a 3rd party # image is properly served using a TLS protocol. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 400x400px. - # + # # This endpoint does not follow HTTP redirects. # # @param [String] url Image URL which you want to crop. @@ -191,11 +203,15 @@ def get_flag(code:, width: nil, height: nil, quality: nil) # @param [Integer] height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. # # @return [] - def get_image(url:, width: nil, height: nil) + def get_image( + url:, + width: nil, + height: nil + ) api_path = '/avatars/image' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { @@ -203,7 +219,7 @@ def get_image(url:, width: nil, height: nil) width: width, height: height, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -215,25 +231,24 @@ def get_image(url:, width: nil, height: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to show your user initials avatar icon on your website or # app. By default, this route will try to print your logged-in user name or - # email initials. You can also overwrite the user name if you pass the 'name' + # email initials. You can also overwrite the user name if you pass the 'name' # parameter. If no name is given and no user is logged, an empty avatar will # be returned. - # + # # You can use the color and background params to change the avatar colors. By # default, a random theme will be selected. The random theme will persist for - # the user's initials when reloading the same theme will always return for + # the user's initials when reloading the same theme will always return for # the same initials. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [String] name Full Name. When empty, current user name or email will be used. Max length: 128 chars. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -241,7 +256,12 @@ def get_image(url:, width: nil, height: nil) # @param [String] background Changes background color. By default a random color will be picked and stay will persistent to the given name. # # @return [] - def get_initials(name: nil, width: nil, height: nil, background: nil) + def get_initials( + name: nil, + width: nil, + height: nil, + background: nil + ) api_path = '/avatars/initials' api_params = { @@ -250,7 +270,7 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) height: height, background: background, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -262,24 +282,87 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) headers: api_headers, params: api_params, ) + end + + # Returns the best available profile photo for a user. The endpoint tries + # each source in priority order and returns the first successful result: + # OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in + # static fallback. + # + # The photo resolves for the currently authenticated user unless `userId` + # points at another user. Passing `emailHash` and/or `name` resolves the + # avatar from those values alone: the hash is looked up on Gravatar and + # Libravatar, the name is rendered as initials, and the user's own identity + # photos, email, and name leave the chain so they never shadow the avatar + # being asked for. Emails are only ever accepted pre-hashed, so no address + # ends up in a URL. + # + # @param [Integer] width Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. + # @param [Integer] height Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. + # @param [Integer] quality Output image quality between 0 and 100. Defaults to 100. + # @param [String] output Output image format. Defaults to 'png'. + # @param [String] rating Maximum image rating to fetch from Gravatar/Libravatar. Defaults to 'g'. + # @param [String] user_id User ID to resolve the photo for. Defaults to 'current()' for the currently authenticated user. + # @param [String] email_hash SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own photo sources. Pass the hash, never the address itself. + # @param [String] name Name to render initials from instead of the user's own photo sources. Max length: 128 chars. + # + # @return [] + def get_photo( + width: nil, + height: nil, + quality: nil, + output: nil, + rating: nil, + user_id: nil, + email_hash: nil, + name: nil + ) + api_path = '/avatars/photo' + + api_params = { + width: width, + height: height, + quality: quality, + output: output, + rating: rating, + userId: user_id, + emailHash: email_hash, + name: name, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/*', + } + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + ) end # Converts a given plain text to a QR code image. You can use the query # parameters to change the size and style of the resulting image. - # + # # # @param [String] text Plain text to be converted to QR code image. # @param [Integer] size QR code size. Pass an integer between 1 to 1000. Defaults to 400. # @param [Integer] margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1. - # @param [] download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. + # @param [] download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. # # @return [] - def get_qr(text:, size: nil, margin: nil, download: nil) + def get_qr( + text:, + size: nil, + margin: nil, + download: nil + ) api_path = '/avatars/qr' if text.nil? - raise Appwrite::Exception.new('Missing required parameter: "text"') + raise Appwrite::Exception.new('Missing required parameter: "text"') end api_params = { @@ -288,7 +371,7 @@ def get_qr(text:, size: nil, margin: nil, download: nil) margin: margin, download: download, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -300,16 +383,15 @@ def get_qr(text:, size: nil, margin: nil, download: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to capture a screenshot of any website URL. This endpoint # uses a headless browser to render the webpage and capture it as an image. - # + # # You can configure the browser viewport size, theme, user agent, # geolocation, permissions, and more. Capture either just the viewport or the # full page scroll. - # + # # When width and height are specified, the image is resized accordingly. If # both dimensions are 0, the API provides an image at original size. If # dimensions are not specified, the default viewport size is 1280x720px. @@ -319,16 +401,16 @@ def get_qr(text:, size: nil, margin: nil, download: nil) # @param [Integer] viewport_width Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. # @param [Integer] viewport_height Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. # @param [Float] scale Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - # @param [BrowserTheme] theme Browser theme. Pass "light" or "dark". Defaults to "light". + # @param [BrowserTheme] theme Browser theme. Pass "light" or "dark". Defaults to "light". # @param [String] user_agent Custom user agent string. Defaults to browser default. # @param [] fullpage Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. - # @param [String] locale Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. - # @param [Timezone] timezone IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. + # @param [String] locale Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. + # @param [Timezone] timezone IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. # @param [Float] latitude Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. # @param [Float] longitude Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. # @param [Float] accuracy Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. # @param [] touch Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - # @param [Array] permissions Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + # @param [Array] permissions Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. # @param [Integer] sleep Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. # @param [Integer] width Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). # @param [Integer] height Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). @@ -336,11 +418,32 @@ def get_qr(text:, size: nil, margin: nil, download: nil) # @param [ImageFormat] output Output format type (jpeg, jpg, png, gif and webp). # # @return [] - def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil, scale: nil, theme: nil, user_agent: nil, fullpage: nil, locale: nil, timezone: nil, latitude: nil, longitude: nil, accuracy: nil, touch: nil, permissions: nil, sleep: nil, width: nil, height: nil, quality: nil, output: nil) + def get_screenshot( + url:, + headers: nil, + viewport_width: nil, + viewport_height: nil, + scale: nil, + theme: nil, + user_agent: nil, + fullpage: nil, + locale: nil, + timezone: nil, + latitude: nil, + longitude: nil, + accuracy: nil, + touch: nil, + permissions: nil, + sleep: nil, + width: nil, + height: nil, + quality: nil, + output: nil + ) api_path = '/avatars/screenshots' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { @@ -365,7 +468,7 @@ def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil quality: quality, output: output, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -377,8 +480,6 @@ def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/backups.rb b/lib/appwrite/services/backups.rb index 10a8b3eb..f74a5917 100644 --- a/lib/appwrite/services/backups.rb +++ b/lib/appwrite/services/backups.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Backups < Service - def initialize(client) @client = client end @@ -12,13 +11,15 @@ def initialize(client) # @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. # # @return [BackupArchiveList] - def list_archives(queries: nil) + def list_archives( + queries: nil + ) api_path = '/backups/archives' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -31,7 +32,6 @@ def list_archives(queries: nil) params: api_params, response_type: Models::BackupArchiveList ) - end # Create a new archive asynchronously for a project. @@ -40,18 +40,21 @@ def list_archives(queries: nil) # @param [String] resource_id Resource ID. When set, only this single resource will be backed up. # # @return [BackupArchive] - def create_archive(services:, resource_id: nil) + def create_archive( + services:, + resource_id: nil + ) api_path = '/backups/archives' if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { services: services, resourceId: resource_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -65,25 +68,25 @@ def create_archive(services:, resource_id: nil) params: api_params, response_type: Models::BackupArchive ) - end - # Get a backup archive using it's ID. + # Get a backup archive using it's ID. # - # @param [String] archive_id Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] archive_id Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupArchive] - def get_archive(archive_id:) + def get_archive( + archive_id: + ) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -96,25 +99,25 @@ def get_archive(archive_id:) params: api_params, response_type: Models::BackupArchive ) - end # Delete an existing archive for a project. # - # @param [String] archive_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] archive_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [] - def delete_archive(archive_id:) + def delete_archive( + archive_id: + ) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -127,7 +130,6 @@ def delete_archive(archive_id:) headers: api_headers, params: api_params, ) - end # List all policies for a project. @@ -135,13 +137,15 @@ def delete_archive(archive_id:) # @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. # # @return [BackupPolicyList] - def list_policies(queries: nil) + def list_policies( + queries: nil + ) api_path = '/backups/policies' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -154,37 +158,44 @@ def list_policies(queries: nil) params: api_params, response_type: Models::BackupPolicyList ) - end # Create a new backup policy. # - # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Array] services Array of services to backup # @param [Integer] retention Days to keep backups before deletion # @param [String] schedule Schedule CRON syntax. # @param [String] name Policy name. Max length: 128 chars. # @param [String] resource_id Resource ID. When set, only this single resource will be backed up. - # @param [] enabled Is policy enabled? When set to 'disabled', no backups will be taken + # @param [] enabled Is policy enabled? When set to 'disabled', no backups will be taken # # @return [BackupPolicy] - def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil) + def create_policy( + policy_id:, + services:, + retention:, + schedule:, + name: nil, + resource_id: nil, + enabled: nil + ) api_path = '/backups/policies' if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end if retention.nil? - raise Appwrite::Exception.new('Missing required parameter: "retention"') + raise Appwrite::Exception.new('Missing required parameter: "retention"') end if schedule.nil? - raise Appwrite::Exception.new('Missing required parameter: "schedule"') + raise Appwrite::Exception.new('Missing required parameter: "schedule"') end api_params = { @@ -196,7 +207,7 @@ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resou retention: retention, schedule: schedule, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -210,25 +221,25 @@ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resou params: api_params, response_type: Models::BackupPolicy ) - end - # Get a backup policy using it's ID. + # Get a backup policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupPolicy] - def get_policy(policy_id:) + def get_policy( + policy_id: + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -241,24 +252,29 @@ def get_policy(policy_id:) params: api_params, response_type: Models::BackupPolicy ) - end - # Update an existing policy using it's ID. + # Update an existing policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Policy name. Max length: 128 chars. # @param [Integer] retention Days to keep backups before deletion # @param [String] schedule Cron expression - # @param [] enabled Is Backup enabled? When set to 'disabled', No backup will be taken + # @param [] enabled Is Backup enabled? When set to 'disabled', No backup will be taken # # @return [BackupPolicy] - def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil) + def update_policy( + policy_id:, + name: nil, + retention: nil, + schedule: nil, + enabled: nil + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end api_params = { @@ -267,7 +283,7 @@ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: schedule: schedule, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -281,25 +297,25 @@ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: params: api_params, response_type: Models::BackupPolicy ) - end - # Delete a policy using it's ID. + # Delete a policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [] - def delete_policy(policy_id:) + def delete_policy( + policy_id: + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -312,24 +328,23 @@ def delete_policy(policy_id:) headers: api_headers, params: api_params, ) - end # Create and trigger a new restoration for a backup on a project. - # + # # For a backup of one database, the restoration resolves its destination # before it is queued. When `newResourceId` is omitted, the archived database # is restored in place and its own ID is returned in `options`. Pass a # different `newResourceId` to restore alongside it as a new database # instead. - # + # # The restoration migration records the archived database in `resourceId` and # `resourceType`, and the resolved database in `destinationResourceId` and # `destinationResourceType`. Database types are stored canonically as # `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave # these fields empty because they do not have a single source or destination # database. - # + # # To list every migration related to one database, use its canonical type in # a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and # destination relation pairs: `(resourceType, resourceId)`, @@ -337,32 +352,37 @@ def delete_policy(policy_id:) # destinationResourceId)`. Legacy and TablesDB databases use `database`; the # operational `resourceType` of a table migration is not rewritten to # `tablesdb`. - # + # # When restoring a DocumentsDB or VectorsDB database from a dedicated source, # the restore provisions a fresh dedicated backing database at the source - # database's own specification and lands the data there. An in-place restore + # database's own specification and lands the data there. An in-place restore # swaps the database onto that backing only once the restore has succeeded, # and retires the backing it displaced only once that swap is confirmed, so # the source keeps serving its own data until the restored data is in place # and any failure leaves it untouched. A serverless source has no dedicated # backing to clone and restores onto the archived database instead. - # + # # # @param [String] archive_id Backup archive ID to restore # @param [Array] services Array of services to restore - # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] new_resource_name Database name. Max length: 128 chars. # # @return [BackupRestoration] - def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) + def create_restoration( + archive_id:, + services:, + new_resource_id: nil, + new_resource_name: nil + ) api_path = '/backups/restoration' if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { @@ -371,7 +391,7 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc newResourceId: new_resource_id, newResourceName: new_resource_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -385,7 +405,6 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc params: api_params, response_type: Models::BackupRestoration ) - end # List all backup restorations for a project. @@ -393,13 +412,15 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc # @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. # # @return [BackupRestorationList] - def list_restorations(queries: nil) + def list_restorations( + queries: nil + ) api_path = '/backups/restorations' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -412,25 +433,25 @@ def list_restorations(queries: nil) params: api_params, response_type: Models::BackupRestorationList ) - end # Get the current status of a backup restoration. # - # @param [String] restoration_id Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] restoration_id Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupRestoration] - def get_restoration(restoration_id:) + def get_restoration( + restoration_id: + ) api_path = '/backups/restorations/{restorationId}' .gsub('{restorationId}', restoration_id) if restoration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -443,8 +464,6 @@ def get_restoration(restoration_id:) params: api_params, response_type: Models::BackupRestoration ) - end - - end + end end diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 57466163..414f91cd 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Databases < Service - def initialize(client) @client = client end @@ -18,7 +17,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DatabaseList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/databases' api_params = { @@ -26,7 +29,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -39,29 +42,32 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DatabaseList ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. # # Create a new Database. - # # - # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Database name. Max length: 128 chars. - # @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. + # @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. # # @return [Database] - def create(database_id:, name:, enabled: nil) + def create( + database_id:, + name:, + enabled: nil + ) api_path = '/databases' if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -69,7 +75,7 @@ def create(database_id:, name:, enabled: nil) name: name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -83,7 +89,6 @@ def create(database_id:, name:, enabled: nil) params: api_params, response_type: Models::Database ) - end # @@ -94,13 +99,15 @@ def create(database_id:, name:, enabled: nil) # @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). # # @return [TransactionList] - def list_transactions(queries: nil) + def list_transactions( + queries: nil + ) api_path = '/databases/transactions' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -113,7 +120,6 @@ def list_transactions(queries: nil) params: api_params, response_type: Models::TransactionList ) - end # @@ -124,13 +130,15 @@ def list_transactions(queries: nil) # @param [Integer] ttl Seconds before the transaction expires. # # @return [Transaction] - def create_transaction(ttl: nil) + def create_transaction( + ttl: nil + ) api_path = '/databases/transactions' api_params = { ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -144,7 +152,6 @@ def create_transaction(ttl: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -155,17 +162,18 @@ def create_transaction(ttl: nil) # @param [String] transaction_id Transaction ID. # # @return [Transaction] - def get_transaction(transaction_id:) + def get_transaction( + transaction_id: + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -178,7 +186,6 @@ def get_transaction(transaction_id:) params: api_params, response_type: Models::Transaction ) - end # @@ -191,19 +198,23 @@ def get_transaction(transaction_id:) # @param [] rollback Rollback transaction? # # @return [Transaction] - def update_transaction(transaction_id:, commit: nil, rollback: nil) + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { commit: commit, rollback: rollback, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -217,7 +228,6 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -228,17 +238,18 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) # @param [String] transaction_id Transaction ID. # # @return [] - def delete_transaction(transaction_id:) + def delete_transaction( + transaction_id: + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -250,7 +261,6 @@ def delete_transaction(transaction_id:) headers: api_headers, params: api_params, ) - end # @@ -262,18 +272,21 @@ def delete_transaction(transaction_id:) # @param [Array] operations Array of staged operations. # # @return [Transaction] - def create_operations(transaction_id:, operations: nil) + def create_operations( + transaction_id:, + operations: nil + ) api_path = '/databases/transactions/{transactionId}/operations' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { operations: operations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -287,7 +300,6 @@ def create_operations(transaction_id:, operations: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -299,17 +311,18 @@ def create_operations(transaction_id:, operations: nil) # @param [String] database_id Database ID. # # @return [Database] - def get(database_id:) + def get( + database_id: + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -322,7 +335,6 @@ def get(database_id:) params: api_params, response_type: Models::Database ) - end # @@ -332,22 +344,26 @@ def get(database_id:) # # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. - # @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. + # @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. # # @return [Database] - def update(database_id:, name: nil, enabled: nil) + def update( + database_id:, + name: nil, + enabled: nil + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { name: name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -361,7 +377,6 @@ def update(database_id:, name: nil, enabled: nil) params: api_params, response_type: Models::Database ) - end # @@ -373,17 +388,18 @@ def update(database_id:, name: nil, enabled: nil) # @param [String] database_id Database ID. # # @return [] - def delete(database_id:) + def delete( + database_id: + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -395,7 +411,6 @@ def delete(database_id:) headers: api_headers, params: api_params, ) - end # @@ -410,12 +425,17 @@ def delete(database_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [CollectionList] - def list_collections(database_id:, queries: nil, search: nil, total: nil) + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -423,7 +443,7 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -436,7 +456,6 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::CollectionList ) - end # @@ -448,29 +467,38 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) # API or directly from your database console. # # @param [String] database_id Database ID. - # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Collection name. Max length: 128 chars. # @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). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # @param [Array] attributes Array of attribute definitions to create. Each attribute 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. # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Collection] - def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil, attributes: nil, indexes: nil) + def create_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + attributes: nil, + indexes: nil + ) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -482,7 +510,7 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc attributes: attributes, indexes: indexes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -496,7 +524,6 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc params: api_params, response_type: Models::Collection ) - end # @@ -509,22 +536,24 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc # @param [String] collection_id Collection ID. # # @return [Collection] - def get_collection(database_id:, collection_id:) + def get_collection( + database_id:, + collection_id: + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -537,7 +566,6 @@ def get_collection(database_id:, collection_id:) params: api_params, response_type: Models::Collection ) - end # @@ -550,21 +578,29 @@ def get_collection(database_id:, collection_id:) # @param [String] name Collection name. Max length: 128 chars. # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. # # @return [Collection] - def update_collection(database_id:, collection_id:, name: nil, permissions: nil, document_security: nil, enabled: nil, purge: nil) + def update_collection( + database_id:, + collection_id:, + name: nil, + permissions: nil, + document_security: nil, + enabled: nil, + purge: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -574,7 +610,7 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, enabled: enabled, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -588,7 +624,6 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, params: api_params, response_type: Models::Collection ) - end # @@ -601,22 +636,24 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, # @param [String] collection_id Collection ID. # # @return [] - def delete_collection(database_id:, collection_id:) + def delete_collection( + database_id:, + collection_id: + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -628,7 +665,6 @@ def delete_collection(database_id:, collection_id:) headers: api_headers, params: api_params, ) - end # @@ -642,24 +678,29 @@ def delete_collection(database_id:, collection_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AttributeList] - def list_attributes(database_id:, collection_id:, queries: nil, total: nil) + def list_attributes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -672,7 +713,6 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) params: api_params, response_type: Models::AttributeList ) - end # @@ -680,7 +720,7 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) # # Create a bigint attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -692,25 +732,34 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) # @param [] array Is attribute an array? # # @return [AttributeBigint] - def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_big_int_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -721,7 +770,7 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -735,7 +784,6 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: params: api_params, response_type: Models::AttributeBigint ) - end # @@ -743,7 +791,7 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: # # Update a bigint attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -755,30 +803,39 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: # @param [String] new_key New Attribute Key. # # @return [AttributeBigint] - def update_big_int_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_big_int_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -788,7 +845,7 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -802,14 +859,13 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBigint ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. # # Create a boolean attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -819,25 +875,32 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeBoolean] - def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_boolean_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -846,7 +909,7 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -860,7 +923,6 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBoolean ) - end # @@ -877,30 +939,37 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] new_key New attribute key. # # @return [AttributeBoolean] - def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_boolean_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -908,7 +977,7 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -922,7 +991,6 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBoolean ) - end # @@ -938,25 +1006,32 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeDatetime] - def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_datetime_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -965,7 +1040,7 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -979,7 +1054,6 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeDatetime ) - end # @@ -996,30 +1070,37 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def # @param [String] new_key New attribute key. # # @return [AttributeDatetime] - def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_datetime_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1027,7 +1108,7 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1041,14 +1122,13 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeDatetime ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. # # Create an email attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1058,25 +1138,32 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def # @param [] array Is attribute an array? # # @return [AttributeEmail] - def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_email_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1085,7 +1172,7 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1099,7 +1186,6 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeEmail ) - end # @@ -1107,7 +1193,7 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul # # Update an email attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1117,30 +1203,37 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul # @param [String] new_key New Attribute Key. # # @return [AttributeEmail] - def update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_email_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1148,7 +1241,7 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1162,15 +1255,14 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeEmail ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. # # Create an enum attribute. The `elements` param acts as a white-list of - # accepted values for this attribute. - # + # accepted values for this attribute. + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1181,29 +1273,37 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul # @param [] array Is attribute an array? # # @return [AttributeEnum] - def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil) + def create_enum_attribute( + database_id:, + collection_id:, + key:, + elements:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1213,7 +1313,7 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1227,7 +1327,6 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require params: api_params, response_type: Models::AttributeEnum ) - end # @@ -1235,7 +1334,7 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require # # Update an enum attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1246,34 +1345,42 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require # @param [String] new_key New Attribute Key. # # @return [AttributeEnum] - def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) + def update_enum_attribute( + database_id:, + collection_id:, + key:, + elements:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1282,7 +1389,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1296,7 +1403,6 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require params: api_params, response_type: Models::AttributeEnum ) - end # @@ -1304,7 +1410,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require # # Create a float attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1316,25 +1422,34 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require # @param [] array Is attribute an array? # # @return [AttributeFloat] - def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_float_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1345,7 +1460,7 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1359,7 +1474,6 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n params: api_params, response_type: Models::AttributeFloat ) - end # @@ -1367,7 +1481,7 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n # # Update a float attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1379,30 +1493,39 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n # @param [String] new_key New Attribute Key. # # @return [AttributeFloat] - def update_float_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_float_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1412,7 +1535,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1426,7 +1549,6 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeFloat ) - end # @@ -1434,7 +1556,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul # # Create an integer attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1446,25 +1568,34 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul # @param [] array Is attribute an array? # # @return [AttributeInteger] - def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_integer_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1475,7 +1606,7 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1489,7 +1620,6 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: params: api_params, response_type: Models::AttributeInteger ) - end # @@ -1497,7 +1627,7 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: # # Update an integer attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1509,30 +1639,39 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: # @param [String] new_key New Attribute Key. # # @return [AttributeInteger] - def update_integer_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_integer_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1542,7 +1681,7 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1556,14 +1695,13 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeInteger ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. # # Create IP address attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1573,25 +1711,32 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeIp] - def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_ip_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1600,7 +1745,7 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1614,7 +1759,6 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeIp ) - end # @@ -1622,7 +1766,7 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: # # Update an ip attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1632,30 +1776,37 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: # @param [String] new_key New Attribute Key. # # @return [AttributeIp] - def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_ip_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1663,7 +1814,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1677,7 +1828,6 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, params: api_params, response_type: Models::AttributeIp ) - end # @@ -1692,25 +1842,31 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, # @param [Array] default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. # # @return [AttributeLine] - def create_line_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_line_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1718,7 +1874,7 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1732,7 +1888,6 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeLine ) - end # @@ -1749,26 +1904,33 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default # @param [String] new_key New attribute key. # # @return [AttributeLine] - def update_line_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_line_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1776,7 +1938,7 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1790,14 +1952,13 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeLine ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLongtextColumn` instead. # # Create a longtext attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1808,25 +1969,33 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeLongtext] - def create_longtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_longtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1836,7 +2005,7 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1850,7 +2019,6 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeLongtext ) - end # @@ -1858,7 +2026,7 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def # # Update a longtext attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1868,30 +2036,37 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def # @param [String] new_key New Attribute Key. # # @return [AttributeLongtext] - def update_longtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_longtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1899,7 +2074,7 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1913,14 +2088,13 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeLongtext ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createMediumtextColumn` instead. # # Create a mediumtext attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1931,25 +2105,33 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeMediumtext] - def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_mediumtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1959,7 +2141,7 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1973,7 +2155,6 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d params: api_params, response_type: Models::AttributeMediumtext ) - end # @@ -1981,7 +2162,7 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # # Update a mediumtext attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1991,30 +2172,37 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # @param [String] new_key New Attribute Key. # # @return [AttributeMediumtext] - def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_mediumtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2022,7 +2210,7 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2036,7 +2224,6 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d params: api_params, response_type: Models::AttributeMediumtext ) - end # @@ -2051,25 +2238,31 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # @param [Array] default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. # # @return [AttributePoint] - def create_point_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_point_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2077,7 +2270,7 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2091,7 +2284,6 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributePoint ) - end # @@ -2108,26 +2300,33 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul # @param [String] new_key New attribute key. # # @return [AttributePoint] - def update_point_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_point_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2135,7 +2334,7 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2149,7 +2348,6 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributePoint ) - end # @@ -2164,25 +2362,31 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul # @param [Array] default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. # # @return [AttributePolygon] - def create_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_polygon_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2190,7 +2394,7 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2204,7 +2408,6 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributePolygon ) - end # @@ -2221,26 +2424,33 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] new_key New attribute key. # # @return [AttributePolygon] - def update_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_polygon_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2248,7 +2458,7 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2262,7 +2472,6 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributePolygon ) - end # @@ -2270,7 +2479,7 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa # # Create relationship attribute. [Learn more about relationship # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2282,25 +2491,34 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [AttributeRelationship] - def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) + def create_relationship_attribute( + database_id:, + collection_id:, + related_collection_id:, + type:, + two_way: nil, + key: nil, + two_way_key: nil, + on_delete: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if related_collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"') + raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -2311,7 +2529,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti twoWayKey: two_way_key, onDelete: on_delete, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2325,7 +2543,6 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti params: api_params, response_type: Models::AttributeRelationship ) - end # @@ -2333,7 +2550,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti # # Update relationship attribute. [Learn more about relationship # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2342,29 +2559,35 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti # @param [String] new_key New Attribute Key. # # @return [AttributeRelationship] - def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) + def update_relationship_attribute( + database_id:, + collection_id:, + key:, + on_delete: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { onDelete: on_delete, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2378,14 +2601,13 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: params: api_params, response_type: Models::AttributeRelationship ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. # # Create a string attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2397,29 +2619,38 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeString] - def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_string_attribute( + database_id:, + collection_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2430,7 +2661,7 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2444,7 +2675,6 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: params: api_params, response_type: Models::AttributeString ) - end # @@ -2452,7 +2682,7 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: # # Update a string attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2463,30 +2693,38 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: # @param [String] new_key New Attribute Key. # # @return [AttributeString] - def update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) + def update_string_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2495,7 +2733,7 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2509,14 +2747,13 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau params: api_params, response_type: Models::AttributeString ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTextColumn` instead. # # Create a text attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2527,25 +2764,33 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeText] - def create_text_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_text_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2555,7 +2800,7 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2569,7 +2814,6 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeText ) - end # @@ -2577,7 +2821,7 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default # # Update a text attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2587,30 +2831,37 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default # @param [String] new_key New Attribute Key. # # @return [AttributeText] - def update_text_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_text_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2618,7 +2869,7 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2632,14 +2883,13 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeText ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. # # Create a URL attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2649,25 +2899,32 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default # @param [] array Is attribute an array? # # @return [AttributeUrl] - def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_url_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2676,7 +2933,7 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2690,7 +2947,6 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeUrl ) - end # @@ -2698,7 +2954,7 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: # # Update an url attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2708,30 +2964,37 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: # @param [String] new_key New Attribute Key. # # @return [AttributeUrl] - def update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_url_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2739,7 +3002,7 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2753,14 +3016,13 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeUrl ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createVarcharColumn` instead. # # Create a varchar attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2772,29 +3034,38 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeVarchar] - def create_varchar_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_varchar_attribute( + database_id:, + collection_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2805,7 +3076,7 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2819,7 +3090,6 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required params: api_params, response_type: Models::AttributeVarchar ) - end # @@ -2827,7 +3097,7 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required # # Update a varchar attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2838,30 +3108,38 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required # @param [String] new_key New Attribute Key. # # @return [AttributeVarchar] - def update_varchar_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) + def update_varchar_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2870,7 +3148,7 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2884,7 +3162,6 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeVarchar ) - end # @@ -2897,27 +3174,30 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] key Attribute Key. # # @return [AttributeBoolean, AttributeInteger, AttributeFloat, AttributeEmail, AttributeEnum, AttributeUrl, AttributeIp, AttributeDatetime, AttributeRelationship, AttributeString] - def get_attribute(database_id:, collection_id:, key:) + def get_attribute( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2985,7 +3265,6 @@ def get_attribute(database_id:, collection_id:, key:) end raise Exception, "Unable to match response to any expected response model" - end # @@ -2998,27 +3277,30 @@ def get_attribute(database_id:, collection_id:, key:) # @param [String] key Attribute Key. # # @return [] - def delete_attribute(database_id:, collection_id:, key:) + def delete_attribute( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3030,13 +3312,12 @@ def delete_attribute(database_id:, collection_id:, key:) headers: api_headers, params: api_params, ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. # - # Get a list of all the user's documents in a given collection. You can use + # Get a list of all the user's documents in a given collection. You can use # the query params to filter your results. # # @param [String] database_id Database ID. @@ -3047,17 +3328,24 @@ def delete_attribute(database_id:, collection_id:, key:) # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [DocumentList] - def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil) + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -3066,7 +3354,7 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3079,7 +3367,6 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3092,31 +3379,38 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Document data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil, transaction_id: nil) + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if data.nil? - raise Appwrite::Exception.new('Missing required parameter: "data"') + raise Appwrite::Exception.new('Missing required parameter: "data"') end api_params = { @@ -3125,7 +3419,7 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3139,7 +3433,6 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio params: api_params, response_type: Models::Document ) - end # @@ -3156,28 +3449,33 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def create_documents(database_id:, collection_id:, documents:, transaction_id: nil) + def create_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if documents.nil? - raise Appwrite::Exception.new('Missing required parameter: "documents"') + raise Appwrite::Exception.new('Missing required parameter: "documents"') end api_params = { documents: documents, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3191,7 +3489,6 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3201,7 +3498,7 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n # new collection resource using either a [server # integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) # API or directly from your database console. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -3209,28 +3506,33 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def upsert_documents(database_id:, collection_id:, documents:, transaction_id: nil) + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if documents.nil? - raise Appwrite::Exception.new('Missing required parameter: "documents"') + raise Appwrite::Exception.new('Missing required parameter: "documents"') end api_params = { documents: documents, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3244,7 +3546,6 @@ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3261,17 +3562,23 @@ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: n # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def update_documents(database_id:, collection_id:, data: nil, queries: nil, transaction_id: nil) + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -3279,7 +3586,7 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3293,7 +3600,6 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran params: api_params, response_type: Models::DocumentList ) - end # @@ -3308,24 +3614,29 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: nil) + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3339,7 +3650,6 @@ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: params: api_params, response_type: Models::DocumentList ) - end # @@ -3355,29 +3665,35 @@ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. # # @return [Document] - def get_document(database_id:, collection_id:, document_id:, queries: nil, transaction_id: nil) + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3390,7 +3706,6 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil, trans params: api_params, response_type: Models::Document ) - end # @@ -3409,22 +3724,29 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil, trans # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def upsert_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil) + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { @@ -3432,7 +3754,7 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3446,7 +3768,6 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi params: api_params, response_type: Models::Document ) - end # @@ -3463,22 +3784,29 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil) + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { @@ -3486,7 +3814,7 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3500,7 +3828,6 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi params: api_params, response_type: Models::Document ) - end # @@ -3514,28 +3841,33 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi # @param [String] transaction_id Transaction ID for staging the operation. # # @return [] - def delete_document(database_id:, collection_id:, document_id:, transaction_id: nil) + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3547,7 +3879,6 @@ def delete_document(database_id:, collection_id:, document_id:, transaction_id: headers: api_headers, params: api_params, ) - end # @@ -3564,7 +3895,15 @@ def delete_document(database_id:, collection_id:, document_id:, transaction_id: # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def decrement_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, min: nil, transaction_id: nil) + def decrement_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + min: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -3572,19 +3911,19 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att .gsub('{attribute}', attribute) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if attribute.nil? - raise Appwrite::Exception.new('Missing required parameter: "attribute"') + raise Appwrite::Exception.new('Missing required parameter: "attribute"') end api_params = { @@ -3592,7 +3931,7 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att min: min, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3606,7 +3945,6 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att params: api_params, response_type: Models::Document ) - end # @@ -3623,7 +3961,15 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def increment_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, max: nil, transaction_id: nil) + def increment_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + max: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -3631,19 +3977,19 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att .gsub('{attribute}', attribute) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if attribute.nil? - raise Appwrite::Exception.new('Missing required parameter: "attribute"') + raise Appwrite::Exception.new('Missing required parameter: "attribute"') end api_params = { @@ -3651,7 +3997,7 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att max: max, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3665,7 +4011,6 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att params: api_params, response_type: Models::Document ) - end # @@ -3679,24 +4024,29 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IndexList] - def list_indexes(database_id:, collection_id:, queries: nil, total: nil) + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3709,7 +4059,6 @@ def list_indexes(database_id:, collection_id:, queries: nil, total: nil) params: api_params, response_type: Models::IndexList ) - end # @@ -3728,29 +4077,37 @@ def list_indexes(database_id:, collection_id:, queries: nil, total: nil) # @param [Array] lengths Length of index. Maximum of 100 # # @return [Index] - def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil, lengths: nil) + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if attributes.nil? - raise Appwrite::Exception.new('Missing required parameter: "attributes"') + raise Appwrite::Exception.new('Missing required parameter: "attributes"') end api_params = { @@ -3760,7 +4117,7 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: orders: orders, lengths: lengths, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3774,7 +4131,6 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: params: api_params, response_type: Models::Index ) - end # @@ -3787,27 +4143,30 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: # @param [String] key Index Key. # # @return [Index] - def get_index(database_id:, collection_id:, key:) + def get_index( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3820,7 +4179,6 @@ def get_index(database_id:, collection_id:, key:) params: api_params, response_type: Models::Index ) - end # @@ -3833,27 +4191,30 @@ def get_index(database_id:, collection_id:, key:) # @param [String] key Index Key. # # @return [] - def delete_index(database_id:, collection_id:, key:) + def delete_index( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3865,8 +4226,6 @@ def delete_index(database_id:, collection_id:, key:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/documents_db.rb b/lib/appwrite/services/documents_db.rb new file mode 100644 index 00000000..4869c1f4 --- /dev/null +++ b/lib/appwrite/services/documents_db.rb @@ -0,0 +1,1683 @@ +# frozen_string_literal: true + +module Appwrite + class DocumentsDB < Service + def initialize(client) + @client = client + end + + # Get a list of all databases from the current Appwrite project. You can use + # the search parameter to filter your results. + # + # @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. You may filter on the following columns: name + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [DatabaseList] + def list( + queries: nil, + total: nil + ) + api_path = '/documentsdb' + + 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::DatabaseList + ) + end + + # Create a new Database. + # + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database name. Max length: 128 chars. + # @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. + # @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. + # @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. + # @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. + # + # @return [Database] + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/documentsdb' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + 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::Database + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/documentsdb/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + end + + # List transactions across all databases. + # + # @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). + # + # @return [TransactionList] + def list_transactions( + queries: nil + ) + api_path = '/documentsdb/transactions' + + api_params = { + queries: queries, + } + + 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::TransactionList + ) + end + + # Create a new transaction. + # + # @param [Integer] ttl Seconds before the transaction expires. + # + # @return [Transaction] + def create_transaction( + ttl: nil + ) + api_path = '/documentsdb/transactions' + + api_params = { + ttl: ttl, + } + + 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::Transaction + ) + end + + # Get a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [Transaction] + def get_transaction( + transaction_id: + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + 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::Transaction + ) + end + + # Update a transaction, to either commit or roll back its operations. + # + # @param [String] transaction_id Transaction ID. + # @param [] commit Commit transaction? + # @param [] rollback Rollback transaction? + # + # @return [Transaction] + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + commit: commit, + rollback: rollback, + } + + 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::Transaction + ) + end + + # Delete a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [] + def delete_transaction( + transaction_id: + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + 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 + + # Create multiple operations in a single transaction. + # + # @param [String] transaction_id Transaction ID. + # @param [Array] operations Array of staged operations. + # + # @return [Transaction] + def create_operations( + transaction_id:, + operations: nil + ) + api_path = '/documentsdb/transactions/{transactionId}/operations' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + operations: operations, + } + + 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::Transaction + ) + end + + # Get a database by its unique ID. This endpoint response returns a JSON + # object with the database metadata. + # + # @param [String] database_id Database ID. + # + # @return [Database] + def get( + database_id: + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::Database + ) + end + + # Update a database by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] name Database name. Max length: 128 chars. + # @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. + # @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. + # @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. + # @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. + # + # @return [Database] + def update( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + 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::Database + ) + end + + # Delete a database by its unique ID. Only API keys with with databases.write + # scope can delete a database. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 a list of all collections that belong to the provided databaseId. You + # can use the search parameter to filter your results. + # + # @param [String] database_id Database ID. + # @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. You may filter on the following attributes: name, enabled, documentSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [CollectionList] + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) + api_path = '/documentsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + 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::CollectionList + ) + end + + # Create a new Collection. Before using this route, you should create a new + # database resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Collection name. Max length: 128 chars. + # @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). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [Array] attributes Array of attribute definitions to create. Each attribute 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. + # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + # + # @return [Collection] + def create_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + attributes: nil, + indexes: nil + ) + api_path = '/documentsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + collectionId: collection_id, + name: name, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + attributes: attributes, + indexes: indexes, + } + + 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::Collection + ) + end + + # Get a collection by its unique ID. This endpoint response returns a JSON + # object with the collection metadata. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [Collection] + def get_collection( + database_id:, + collection_id: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + 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::Collection + ) + end + + # Update a collection by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + # + # @return [Collection] + def update_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + purge: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + purge: purge, + } + + 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::Collection + ) + end + + # Delete a collection by its unique ID. Only users with write permissions + # have access to delete this resource. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [] + def delete_collection( + database_id:, + collection_id: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + 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 a list of all the user's documents in a given collection. You can use + # the query params to filter your results. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + 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::DocumentList + ) + end + + # Create a new Document. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Hash] data Document data as JSON object. + # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # + # @return [Document] + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + documentId: document_id, + data: data, + permissions: permissions, + } + + 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::Document + ) + end + + # Create new Documents. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [Array] documents Array of documents data as JSON objects. + # + # @return [DocumentList] + def create_documents( + database_id:, + collection_id:, + documents: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + } + + 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::DocumentList + ) + end + + # Create or update Documents. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Array] documents Array of document data as JSON objects. May contain partial documents. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + transactionId: transaction_id, + } + + 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::DocumentList + ) + end + + # Update all documents that match your queries, if no queries are submitted + # then all documents are updated. You can pass only specific fields to be + # updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated. + # @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. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + data: data, + queries: queries, + transactionId: transaction_id, + } + + 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::DocumentList + ) + end + + # Bulk delete documents using queries, if no queries are passed then all + # documents are deleted. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + 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, + response_type: Models::DocumentList + ) + end + + # Get a document by its unique ID. This endpoint response returns a JSON + # object with the document data. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @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. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # + # @return [Document] + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Create or update a Document. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Update a document by its unique ID. Using the patch method you can pass + # only specific fields that will get updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Delete a document by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [] + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + transactionId: transaction_id, + } + + 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 + + # Decrement a specific column of a row by a given value. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [String] attribute Attribute key. + # @param [Float] value Value to decrement the attribute by. The value must be a number. + # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def decrement_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + min: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + min: min, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Increment a specific column of a row by a given value. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [String] attribute Attribute key. + # @param [Float] value Value to increment the attribute by. The value must be a number. + # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def increment_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + max: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + max: max, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # List indexes in the collection. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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. You may filter on the following attributes: key, type, status, attributes, error + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [IndexList] + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + 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::IndexList + ) + end + + # Creates an index on the attributes listed. Your index should include all + # the attributes you will query in a single request. + # Attributes can be `key`, `fulltext`, and `unique`. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # @param [DocumentsDBIndexType] type Index type. + # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed. + # @param [Array] lengths Length of index. Maximum of 100 + # + # @return [Index] + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + if attributes.nil? + raise Appwrite::Exception.new('Missing required parameter: "attributes"') + end + + api_params = { + key: key, + type: type, + attributes: attributes, + orders: orders, + lengths: lengths, + } + + 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::Index + ) + end + + # Get index by ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [Index] + def get_index( + database_id:, + collection_id:, + key: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + 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::Index + ) + end + + # Delete an index. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [] + def delete_index( + database_id:, + collection_id:, + key: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + 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 + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/documentsdb/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/documentsdb/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/documentsdb/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/documentsdb/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + end + end +end diff --git a/lib/appwrite/services/embeddings.rb b/lib/appwrite/services/embeddings.rb index 5056314f..3b7003db 100644 --- a/lib/appwrite/services/embeddings.rb +++ b/lib/appwrite/services/embeddings.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Embeddings < Service - def initialize(client) @client = client end @@ -10,24 +9,27 @@ def initialize(client) # Generate vector embeddings for an array of text using the selected # embedding model. Use the returned vectors to power semantic search and # similarity queries against your vector collections. - # + # # # @param [Array] texts Array of text to generate embeddings. # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings. # # @return [EmbeddingList] - def create_text_embeddings(texts:, model: nil) + def create_text_embeddings( + texts:, + model: nil + ) api_path = '/embeddings/text' if texts.nil? - raise Appwrite::Exception.new('Missing required parameter: "texts"') + raise Appwrite::Exception.new('Missing required parameter: "texts"') end api_params = { texts: texts, model: model, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -41,8 +43,6 @@ def create_text_embeddings(texts:, model: nil) params: api_params, response_type: Models::EmbeddingList ) - end - - end + end end diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index c0a16a74..0d514383 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Functions < Service - def initialize(client) @client = client end - # Get a list of all the project's functions. You can use the query params to + # Get a list of all the project's functions. You can use the query params to # filter your results. # # @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. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [FunctionList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/functions' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,7 +39,6 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::FunctionList ) - end # Create a new function. You can pass a list of @@ -44,16 +46,16 @@ def list(queries: nil, search: nil, total: nil) # project users or team with access to execute the function using the client # API. # - # @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Function name. Max length: 128 chars. # @param [Runtime] runtime Execution runtime. # @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # @param [Array] events Events list. Maximum of 100 events are allowed. # @param [String] schedule Schedule CRON syntax. # @param [Integer] timeout Function maximum execution time in seconds. - # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. - # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". + # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. # @param [Array] scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment. @@ -68,19 +70,42 @@ def list(queries: nil, search: nil, total: nil) # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. # # @return [Function] - def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def create( + function_id:, + name:, + runtime:, + execute: nil, + events: nil, + schedule: nil, + timeout: nil, + enabled: nil, + logging: nil, + entrypoint: nil, + commands: nil, + scopes: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil + ) api_path = '/functions' if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if runtime.nil? - raise Appwrite::Exception.new('Missing required parameter: "runtime"') + raise Appwrite::Exception.new('Missing required parameter: "runtime"') end api_params = { @@ -107,7 +132,7 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -121,7 +146,6 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n params: api_params, response_type: Models::Function ) - end # Get a list of all runtimes that are currently active on your instance. @@ -131,9 +155,8 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n def list_runtimes() api_path = '/functions/runtimes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -146,7 +169,6 @@ def list_runtimes() params: api_params, response_type: Models::RuntimeList ) - end # List allowed function specifications for this instance. @@ -154,13 +176,15 @@ def list_runtimes() # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] - def list_specifications(type: nil) + def list_specifications( + type: nil + ) api_path = '/functions/specifications' api_params = { type: type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -173,7 +197,6 @@ def list_specifications(type: nil) params: api_params, response_type: Models::SpecificationList ) - end # Get a function by its unique ID. @@ -181,17 +204,18 @@ def list_specifications(type: nil) # @param [String] function_id Function ID. # # @return [Function] - def get(function_id:) + def get( + function_id: + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -204,7 +228,6 @@ def get(function_id:) params: api_params, response_type: Models::Function ) - end # Update function by its unique ID. @@ -216,9 +239,9 @@ def get(function_id:) # @param [Array] events Events list. Maximum of 100 events are allowed. # @param [String] schedule Schedule CRON syntax. # @param [Integer] timeout Maximum execution time in seconds. - # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. - # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". + # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. # @param [Array] scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Controle System) deployment. @@ -233,16 +256,39 @@ def get(function_id:) # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. # # @return [Function] - def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def update( + function_id:, + name:, + runtime: nil, + execute: nil, + events: nil, + schedule: nil, + timeout: nil, + enabled: nil, + logging: nil, + entrypoint: nil, + commands: nil, + scopes: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -268,7 +314,7 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -282,7 +328,6 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul params: api_params, response_type: Models::Function ) - end # Delete a function by its unique ID. @@ -290,17 +335,18 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul # @param [String] function_id Function ID. # # @return [] - def delete(function_id:) + def delete( + function_id: + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -312,7 +358,6 @@ def delete(function_id:) headers: api_headers, params: api_params, ) - end # Update the function active deployment. Use this endpoint to switch the code @@ -322,22 +367,25 @@ def delete(function_id:) # @param [String] deployment_id Deployment ID. # # @return [Function] - def update_function_deployment(function_id:, deployment_id:) + def update_function_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployment' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -351,10 +399,9 @@ def update_function_deployment(function_id:, deployment_id:) params: api_params, response_type: Models::Function ) - end - # Get a list of all the function's code deployments. You can use the query + # Get a list of all the function's code deployments. You can use the query # params to filter your results. # # @param [String] function_id Function ID. @@ -363,12 +410,17 @@ def update_function_deployment(function_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DeploymentList] - def list_deployments(function_id:, queries: nil, search: nil, total: nil) + def list_deployments( + function_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/functions/{functionId}/deployments' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -376,7 +428,7 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -389,19 +441,18 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DeploymentList ) - end # Create a new function code deployment. Use this endpoint to upload a new - # version of your code function. To execute your newly uploaded code, you'll - # need to update the function's deployment to use your new deployment UID. - # + # version of your code function. To execute your newly uploaded code, you'll + # need to update the function's deployment to use your new deployment UID. + # # This endpoint accepts a tar.gz file compressed with your code. Make sure to # include any dependencies your code has within the compressed file. You can # learn more about code packaging in the [Appwrite Cloud Functions # tutorial](https://appwrite.io/docs/functions). - # - # Use the "command" param to set the entrypoint used to execute your code. + # + # Use the "command" param to set the entrypoint used to execute your code. # # @param [String] function_id Function ID. # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -410,20 +461,27 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) # @param [String] commands Build Commands. # # @return [Deployment] - def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: nil, on_progress: nil) + def create_deployment( + function_id:, + code:, + activate:, + entrypoint: nil, + commands: nil, + on_progress: nil + ) api_path = '/functions/{functionId}/deployments' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end if activate.nil? - raise Appwrite::Exception.new('Missing required parameter: "activate"') + raise Appwrite::Exception.new('Missing required parameter: "activate"') end api_params = { @@ -432,7 +490,7 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: code: code, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -451,37 +509,40 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: on_progress: on_progress, response_type: Models::Deployment ) - end # Create a new build for an existing function deployment. This endpoint # allows you to rebuild a deployment with the updated function configuration, # including its entrypoint and build commands if they have been modified. The # build process will be queued and executed asynchronously. The original - # deployment's code will be preserved and used for the new build. + # deployment's code will be preserved and used for the new build. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. # @param [String] build_id Build unique ID. # # @return [Deployment] - def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) + def create_duplicate_deployment( + function_id:, + deployment_id:, + build_id: nil + ) api_path = '/functions/{functionId}/deployments/duplicate' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, buildId: build_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -495,11 +556,10 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) params: api_params, response_type: Models::Deployment ) - end # Create a deployment based on a template. - # + # # Use this endpoint with combination of # [listTemplates](https://appwrite.io/docs/products/functions/templates) to # find the template details. @@ -513,32 +573,40 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_template_deployment(function_id:, repository:, owner:, root_directory:, type:, reference:, activate: nil) + def create_template_deployment( + function_id:, + repository:, + owner:, + root_directory:, + type:, + reference:, + activate: nil + ) api_path = '/functions/{functionId}/deployments/template' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if repository.nil? - raise Appwrite::Exception.new('Missing required parameter: "repository"') + raise Appwrite::Exception.new('Missing required parameter: "repository"') end if owner.nil? - raise Appwrite::Exception.new('Missing required parameter: "owner"') + raise Appwrite::Exception.new('Missing required parameter: "owner"') end if root_directory.nil? - raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') + raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -549,7 +617,7 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -563,11 +631,10 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory params: api_params, response_type: Models::Deployment ) - end # Create a deployment when a function is connected to VCS. - # + # # This endpoint lets you create deployment from a branch, commit, or a tag. # # @param [String] function_id Function ID. @@ -576,20 +643,25 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_vcs_deployment(function_id:, type:, reference:, activate: nil) + def create_vcs_deployment( + function_id:, + type:, + reference:, + activate: nil + ) api_path = '/functions/{functionId}/deployments/vcs' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -597,7 +669,7 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -611,7 +683,6 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) params: api_params, response_type: Models::Deployment ) - end # Get a function deployment by its unique ID. @@ -620,22 +691,24 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def get_deployment(function_id:, deployment_id:) + def get_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -648,7 +721,6 @@ def get_deployment(function_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Delete a code deployment by its unique ID. @@ -657,22 +729,24 @@ def get_deployment(function_id:, deployment_id:) # @param [String] deployment_id Deployment ID. # # @return [] - def delete_deployment(function_id:, deployment_id:) + def delete_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -684,37 +758,41 @@ def delete_deployment(function_id:, deployment_id:) headers: api_headers, params: api_params, ) - end # Get a function deployment content by its unique ID. The endpoint response - # return with a 'Content-Disposition: attachment' header that tells the + # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. - # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(function_id:, deployment_id:, type: nil, token: nil) + def get_deployment_download( + function_id:, + deployment_id:, + type: nil, + token: nil + ) api_path = '/functions/{functionId}/deployments/{deploymentId}/download' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { type: type, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -726,35 +804,36 @@ def get_deployment_download(function_id:, deployment_id:, type: nil, token: nil) headers: api_headers, params: api_params, ) - end # Cancel an ongoing function deployment build. If the build is already in - # progress, it will be stopped and marked as canceled. If the build hasn't + # progress, it will be stopped and marked as canceled. If the build hasn't # started yet, it will be marked as canceled without executing. You cannot - # cancel builds that have already completed (status 'ready') or failed. The + # cancel builds that have already completed (status 'ready') or failed. The # response includes the final build status and details. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def update_deployment_status(function_id:, deployment_id:) + def update_deployment_status( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}/status' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -768,7 +847,6 @@ def update_deployment_status(function_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Get a list of all the current user function execution logs. You can use the @@ -779,19 +857,23 @@ def update_deployment_status(function_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ExecutionList] - def list_executions(function_id:, queries: nil, total: nil) + def list_executions( + function_id:, + queries: nil, + total: nil + ) api_path = '/functions/{functionId}/executions' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -804,7 +886,6 @@ def list_executions(function_id:, queries: nil, total: nil) params: api_params, response_type: Models::ExecutionList ) - end # Trigger a function execution. The returned object will return you the @@ -821,12 +902,20 @@ def list_executions(function_id:, queries: nil, total: nil) # @param [String] scheduled_at Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. # # @return [Execution] - def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: nil, headers: nil, scheduled_at: nil) + def create_execution( + function_id:, + body: nil, + async: nil, + xpath: nil, + method: nil, + headers: nil, + scheduled_at: nil + ) api_path = '/functions/{functionId}/executions' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -837,7 +926,7 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni headers: headers, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -851,7 +940,6 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni params: api_params, response_type: Models::Execution ) - end # Get a function execution log by its unique ID. @@ -860,22 +948,24 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni # @param [String] execution_id Execution ID. # # @return [Execution] - def get_execution(function_id:, execution_id:) + def get_execution( + function_id:, + execution_id: + ) api_path = '/functions/{functionId}/executions/{executionId}' .gsub('{functionId}', function_id) .gsub('{executionId}', execution_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if execution_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "executionId"') + raise Appwrite::Exception.new('Missing required parameter: "executionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -888,7 +978,6 @@ def get_execution(function_id:, execution_id:) params: api_params, response_type: Models::Execution ) - end # Delete a function execution by its unique ID. @@ -897,22 +986,24 @@ def get_execution(function_id:, execution_id:) # @param [String] execution_id Execution ID. # # @return [] - def delete_execution(function_id:, execution_id:) + def delete_execution( + function_id:, + execution_id: + ) api_path = '/functions/{functionId}/executions/{executionId}' .gsub('{functionId}', function_id) .gsub('{executionId}', execution_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if execution_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "executionId"') + raise Appwrite::Exception.new('Missing required parameter: "executionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -924,7 +1015,6 @@ def delete_execution(function_id:, execution_id:) headers: api_headers, params: api_params, ) - end # Get a list of all variables of a specific function. @@ -934,19 +1024,23 @@ def delete_execution(function_id:, execution_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(function_id:, queries: nil, total: nil) + def list_variables( + function_id:, + queries: nil, + total: nil + ) api_path = '/functions/{functionId}/variables' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -959,37 +1053,42 @@ def list_variables(function_id:, queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new function environment variable. These variables can be accessed # in the function at runtime as environment variables. # # @param [String] function_id Function unique ID. - # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime. # # @return [Variable] - def create_variable(function_id:, variable_id:, key:, value:, secret: nil) + def create_variable( + function_id:, + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/functions/{functionId}/variables' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -998,7 +1097,7 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1012,7 +1111,6 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end # Get a variable by its unique ID. @@ -1021,22 +1119,24 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(function_id:, variable_id:) + def get_variable( + function_id:, + variable_id: + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1049,29 +1149,34 @@ def get_variable(function_id:, variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] function_id Function unique ID. # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime. # # @return [Variable] - def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + function_id:, + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -1079,7 +1184,7 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1093,7 +1198,6 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni params: api_params, response_type: Models::Variable ) - end # Delete a variable by its unique ID. @@ -1102,22 +1206,24 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(function_id:, variable_id:) + def delete_variable( + function_id:, + variable_id: + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1129,8 +1235,6 @@ def delete_variable(function_id:, variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/graphql.rb b/lib/appwrite/services/graphql.rb index 2ba03f56..210f528a 100644 --- a/lib/appwrite/services/graphql.rb +++ b/lib/appwrite/services/graphql.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Graphql < Service - def initialize(client) @client = client end @@ -12,17 +11,19 @@ def initialize(client) # @param [Hash] query The query or queries to execute. # # @return [] - def query(query:) + def query( + query: + ) api_path = '/graphql' if query.nil? - raise Appwrite::Exception.new('Missing required parameter: "query"') + raise Appwrite::Exception.new('Missing required parameter: "query"') end api_params = { query: query, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', @@ -36,7 +37,6 @@ def query(query:) headers: api_headers, params: api_params, ) - end # Execute a GraphQL mutation. @@ -44,17 +44,19 @@ def query(query:) # @param [Hash] query The query or queries to execute. # # @return [] - def mutation(query:) + def mutation( + query: + ) api_path = '/graphql/mutation' if query.nil? - raise Appwrite::Exception.new('Missing required parameter: "query"') + raise Appwrite::Exception.new('Missing required parameter: "query"') end api_params = { query: query, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', @@ -68,8 +70,6 @@ def mutation(query:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/locale.rb b/lib/appwrite/services/locale.rb index 6c76a957..3728751b 100644 --- a/lib/appwrite/services/locale.rb +++ b/lib/appwrite/services/locale.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Locale < Service - def initialize(client) @client = client end @@ -11,7 +10,7 @@ def initialize(client) # country code, country name, continent name, continent code, ip address and # suggested currency. You can use the locale header to get the data in a # supported language. - # + # # ([IP Geolocation by DB-IP](https://db-ip.com)) # # @@ -19,9 +18,8 @@ def initialize(client) def get() api_path = '/locale' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -34,7 +32,6 @@ def get() params: api_params, response_type: Models::Locale ) - end # List of all locale codes in [ISO @@ -45,9 +42,8 @@ def get() def list_codes() api_path = '/locale/codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -60,7 +56,6 @@ def list_codes() params: api_params, response_type: Models::LocaleCodeList ) - end # List of all continents. You can use the locale header to get the data in a @@ -71,9 +66,8 @@ def list_codes() def list_continents() api_path = '/locale/continents' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -86,7 +80,6 @@ def list_continents() params: api_params, response_type: Models::ContinentList ) - end # List of all countries. You can use the locale header to get the data in a @@ -97,9 +90,8 @@ def list_continents() def list_countries() api_path = '/locale/countries' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -112,7 +104,6 @@ def list_countries() params: api_params, response_type: Models::CountryList ) - end # List of all countries that are currently members of the EU. You can use the @@ -123,9 +114,8 @@ def list_countries() def list_countries_eu() api_path = '/locale/countries/eu' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -138,7 +128,6 @@ def list_countries_eu() params: api_params, response_type: Models::CountryList ) - end # List of all countries phone codes. You can use the locale header to get the @@ -149,9 +138,8 @@ def list_countries_eu() def list_countries_phones() api_path = '/locale/countries/phones' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -164,7 +152,6 @@ def list_countries_phones() params: api_params, response_type: Models::PhoneList ) - end # List of all currencies, including currency symbol, name, plural, and @@ -176,9 +163,8 @@ def list_countries_phones() def list_currencies() api_path = '/locale/currencies' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -191,7 +177,6 @@ def list_currencies() params: api_params, response_type: Models::CurrencyList ) - end # List of all languages classified by ISO 639-1 including 2-letter code, name @@ -202,9 +187,8 @@ def list_currencies() def list_languages() api_path = '/locale/languages' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -217,8 +201,6 @@ def list_languages() params: api_params, response_type: Models::LanguageList ) - end - - end + end end diff --git a/lib/appwrite/services/messaging.rb b/lib/appwrite/services/messaging.rb index d982aa12..30ab729f 100644 --- a/lib/appwrite/services/messaging.rb +++ b/lib/appwrite/services/messaging.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Messaging < Service - def initialize(client) @client = client end @@ -14,7 +13,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MessageList] - def list_messages(queries: nil, search: nil, total: nil) + def list_messages( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/messages' api_params = { @@ -22,7 +25,7 @@ def list_messages(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -35,12 +38,11 @@ def list_messages(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MessageList ) - end # Create a new email message. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] subject Email Subject. # @param [String] content Email Content. # @param [Array] topics List of Topic IDs. @@ -48,25 +50,38 @@ def list_messages(queries: nil, search: nil, total: nil) # @param [Array] targets List of Targets IDs. # @param [Array] cc Array of target IDs to be added as CC. # @param [Array] bcc Array of target IDs to be added as BCC. - # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. + # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [] draft Is message a draft # @param [] html Is content of type HTML # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def create_email(message_id:, subject:, content:, topics: nil, users: nil, targets: nil, cc: nil, bcc: nil, attachments: nil, draft: nil, html: nil, scheduled_at: nil) + def create_email( + message_id:, + subject:, + content:, + topics: nil, + users: nil, + targets: nil, + cc: nil, + bcc: nil, + attachments: nil, + draft: nil, + html: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/email' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end if subject.nil? - raise Appwrite::Exception.new('Missing required parameter: "subject"') + raise Appwrite::Exception.new('Missing required parameter: "subject"') end if content.nil? - raise Appwrite::Exception.new('Missing required parameter: "content"') + raise Appwrite::Exception.new('Missing required parameter: "content"') end api_params = { @@ -83,7 +98,7 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe html: html, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -97,13 +112,12 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe params: api_params, response_type: Models::Message ) - end # Update an email message by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -116,15 +130,28 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe # @param [Array] cc Array of target IDs to be added as CC. # @param [Array] bcc Array of target IDs to be added as BCC. # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. + # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. # # @return [Message] - def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil, attachments: nil) + def update_email( + message_id:, + topics: nil, + users: nil, + targets: nil, + subject: nil, + content: nil, + draft: nil, + html: nil, + cc: nil, + bcc: nil, + scheduled_at: nil, + attachments: nil + ) api_path = '/messaging/messages/email/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -140,7 +167,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni scheduledAt: scheduled_at, attachments: attachments, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -154,12 +181,11 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni params: api_params, response_type: Models::Message ) - end # Create a new push notification. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] title Title for push notification. # @param [String] body Body for push notification. # @param [Array] topics List of Topic IDs. @@ -167,7 +193,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni # @param [Array] targets List of Targets IDs. # @param [Hash] data Additional key-value pair data for push notification. # @param [String] action Action for push notification. - # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. + # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [String] icon Icon for push notification. Available only for Android and Web Platform. # @param [String] sound Sound for push notification. Available only for Android and iOS Platform. # @param [String] color Color for push notification. Available only for Android Platform. @@ -177,14 +203,34 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # @param [] content_available If set to true, the notification will be delivered in the background. Available only for iOS Platform. # @param [] critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - # @param [MessagePriority] priority Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + # @param [MessagePriority] priority Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. # # @return [Message] - def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, targets: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil, content_available: nil, critical: nil, priority: nil) + def create_push( + message_id:, + title: nil, + body: nil, + topics: nil, + users: nil, + targets: nil, + data: nil, + action: nil, + image: nil, + icon: nil, + sound: nil, + color: nil, + tag: nil, + badge: nil, + draft: nil, + scheduled_at: nil, + content_available: nil, + critical: nil, + priority: nil + ) api_path = '/messaging/messages/push' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -208,7 +254,7 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar critical: critical, priority: priority, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -222,13 +268,12 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar params: api_params, response_type: Models::Message ) - end # Update a push notification by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -238,7 +283,7 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar # @param [String] body Body for push notification. # @param [Hash] data Additional Data for push notification. # @param [String] action Action for push notification. - # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. + # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [String] icon Icon for push notification. Available only for Android and Web platforms. # @param [String] sound Sound for push notification. Available only for Android and iOS platforms. # @param [String] color Color for push notification. Available only for Android platforms. @@ -248,15 +293,35 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # @param [] content_available If set to true, the notification will be delivered in the background. Available only for iOS Platform. # @param [] critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - # @param [MessagePriority] priority Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + # @param [MessagePriority] priority Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. # # @return [Message] - def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, body: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil, content_available: nil, critical: nil, priority: nil) + def update_push( + message_id:, + topics: nil, + users: nil, + targets: nil, + title: nil, + body: nil, + data: nil, + action: nil, + image: nil, + icon: nil, + sound: nil, + color: nil, + tag: nil, + badge: nil, + draft: nil, + scheduled_at: nil, + content_available: nil, + critical: nil, + priority: nil + ) api_path = '/messaging/messages/push/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -279,7 +344,7 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, critical: critical, priority: priority, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -293,12 +358,11 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, params: api_params, response_type: Models::Message ) - end # Create a new SMS message. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] content SMS Content. # @param [Array] topics List of Topic IDs. # @param [Array] users List of User IDs. @@ -307,15 +371,23 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, draft: nil, scheduled_at: nil) + def create_sms( + message_id:, + content:, + topics: nil, + users: nil, + targets: nil, + draft: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/sms' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end if content.nil? - raise Appwrite::Exception.new('Missing required parameter: "content"') + raise Appwrite::Exception.new('Missing required parameter: "content"') end api_params = { @@ -327,7 +399,7 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra draft: draft, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -341,13 +413,12 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra params: api_params, response_type: Models::Message ) - end # Update an SMS message by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -358,12 +429,20 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, draft: nil, scheduled_at: nil) + def update_sms( + message_id:, + topics: nil, + users: nil, + targets: nil, + content: nil, + draft: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/sms/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -374,7 +453,7 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, draft: draft, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -388,26 +467,26 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, params: api_params, response_type: Models::Message ) - end # Get a message by its unique ID. - # + # # # @param [String] message_id Message ID. # # @return [Message] - def get_message(message_id:) + def get_message( + message_id: + ) api_path = '/messaging/messages/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -420,7 +499,6 @@ def get_message(message_id:) params: api_params, response_type: Models::Message ) - end # Delete a message. If the message is not a draft or scheduled, but has been @@ -429,17 +507,18 @@ def get_message(message_id:) # @param [String] message_id Message ID. # # @return [] - def delete(message_id:) + def delete( + message_id: + ) api_path = '/messaging/messages/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -451,7 +530,6 @@ def delete(message_id:) headers: api_headers, params: api_params, ) - end # Get a list of the targets associated with a message. @@ -461,19 +539,23 @@ def delete(message_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TargetList] - def list_targets(message_id:, queries: nil, total: nil) + def list_targets( + message_id:, + queries: nil, + total: nil + ) api_path = '/messaging/messages/{messageId}/targets' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -486,7 +568,6 @@ def list_targets(message_id:, queries: nil, total: nil) params: api_params, response_type: Models::TargetList ) - end # Get a list of all providers from the current Appwrite project. @@ -496,7 +577,11 @@ def list_targets(message_id:, queries: nil, total: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProviderList] - def list_providers(queries: nil, search: nil, total: nil) + def list_providers( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/providers' api_params = { @@ -504,7 +589,7 @@ def list_providers(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -517,12 +602,11 @@ def list_providers(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::ProviderList ) - end # Create a new Apple Push Notification service provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] auth_key APNS authentication key. # @param [String] auth_key_id APNS authentication key ID. @@ -532,15 +616,24 @@ def list_providers(queries: nil, search: nil, total: nil) # @param [] enabled Set as enabled. # # @return [Provider] - def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil, enabled: nil) + def create_apns_provider( + provider_id:, + name:, + auth_key: nil, + auth_key_id: nil, + team_id: nil, + bundle_id: nil, + sandbox: nil, + enabled: nil + ) api_path = '/messaging/providers/apns' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -553,7 +646,7 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t sandbox: sandbox, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -567,7 +660,6 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t params: api_params, response_type: Models::Provider ) - end # Update a Apple Push Notification service provider by its unique ID. @@ -582,12 +674,21 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t # @param [] sandbox Use APNS sandbox environment. # # @return [Provider] - def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil) + def update_apns_provider( + provider_id:, + name: nil, + enabled: nil, + auth_key: nil, + auth_key_id: nil, + team_id: nil, + bundle_id: nil, + sandbox: nil + ) api_path = '/messaging/providers/apns/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -599,7 +700,7 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a bundleId: bundle_id, sandbox: sandbox, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -613,26 +714,30 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a params: api_params, response_type: Models::Provider ) - end # Create a new Firebase Cloud Messaging provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [Hash] service_account_json FCM service account JSON. # @param [] enabled Set as enabled. # # @return [Provider] - def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: nil) + def create_fcm_provider( + provider_id:, + name:, + service_account_json: nil, + enabled: nil + ) api_path = '/messaging/providers/fcm' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -641,7 +746,7 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: serviceAccountJSON: service_account_json, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -655,7 +760,6 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: params: api_params, response_type: Models::Provider ) - end # Update a Firebase Cloud Messaging provider by its unique ID. @@ -666,12 +770,17 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: # @param [Hash] service_account_json FCM service account JSON. # # @return [Provider] - def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_json: nil) + def update_fcm_provider( + provider_id:, + name: nil, + enabled: nil, + service_account_json: nil + ) api_path = '/messaging/providers/fcm/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -679,7 +788,7 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j enabled: enabled, serviceAccountJSON: service_account_json, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -693,12 +802,11 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j params: api_params, response_type: Models::Provider ) - end # Create a new Mailgun provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Mailgun API Key. # @param [String] domain Mailgun Domain. @@ -710,15 +818,26 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j # @param [] enabled Set as enabled. # # @return [Provider] - def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_eu_region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_mailgun_provider( + provider_id:, + name:, + api_key: nil, + domain: nil, + is_eu_region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/mailgun' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -733,7 +852,7 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -747,7 +866,6 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e params: api_params, response_type: Models::Provider ) - end # Update a Mailgun provider by its unique ID. @@ -764,12 +882,23 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email. # # @return [Provider] - def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, is_eu_region: nil, enabled: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_mailgun_provider( + provider_id:, + name: nil, + api_key: nil, + domain: nil, + is_eu_region: nil, + enabled: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/mailgun/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -783,7 +912,7 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -797,12 +926,11 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, params: api_params, response_type: Models::Provider ) - end # Create a new MSG91 provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] template_id Msg91 template ID # @param [String] sender_id Msg91 sender ID. @@ -810,15 +938,22 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, auth_key: nil, enabled: nil) + def create_msg91_provider( + provider_id:, + name:, + template_id: nil, + sender_id: nil, + auth_key: nil, + enabled: nil + ) api_path = '/messaging/providers/msg91' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -829,7 +964,7 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, authKey: auth_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -843,7 +978,6 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, params: api_params, response_type: Models::Provider ) - end # Update a MSG91 provider by its unique ID. @@ -856,12 +990,19 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, # @param [String] auth_key Msg91 auth key. # # @return [Provider] - def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: nil, sender_id: nil, auth_key: nil) + def update_msg91_provider( + provider_id:, + name: nil, + enabled: nil, + template_id: nil, + sender_id: nil, + auth_key: nil + ) api_path = '/messaging/providers/msg91/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -871,7 +1012,7 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni senderId: sender_id, authKey: auth_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -885,12 +1026,11 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni params: api_params, response_type: Models::Provider ) - end # Create a new Resend provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Resend API key. # @param [String] from_name Sender Name. @@ -900,15 +1040,24 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni # @param [] enabled Set as enabled. # # @return [Provider] - def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_resend_provider( + provider_id:, + name:, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/resend' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -921,7 +1070,7 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -935,7 +1084,6 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr params: api_params, response_type: Models::Provider ) - end # Update a Resend provider by its unique ID. @@ -950,12 +1098,21 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_resend_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/resend/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -967,7 +1124,7 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -981,12 +1138,11 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, params: api_params, response_type: Models::Provider ) - end # Create a new Sendgrid provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Sendgrid API key. # @param [String] from_name Sender Name. @@ -996,15 +1152,24 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_sendgrid_provider( + provider_id:, + name:, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/sendgrid' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1017,7 +1182,7 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1031,7 +1196,6 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, params: api_params, response_type: Models::Provider ) - end # Update a Sendgrid provider by its unique ID. @@ -1046,12 +1210,21 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_sendgrid_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/sendgrid/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1063,7 +1236,7 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1077,12 +1250,11 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil params: api_params, response_type: Models::Provider ) - end # Create a new Amazon SES provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] access_key AWS access key ID. # @param [String] secret_key AWS secret access key. @@ -1094,15 +1266,26 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil # @param [] enabled Set as enabled. # # @return [Provider] - def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_ses_provider( + provider_id:, + name:, + access_key: nil, + secret_key: nil, + region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/ses' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1117,7 +1300,7 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1131,7 +1314,6 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r params: api_params, response_type: Models::Provider ) - end # Update an Amazon SES provider by its unique ID. @@ -1148,12 +1330,23 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, secret_key: nil, region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_ses_provider( + provider_id:, + name: nil, + enabled: nil, + access_key: nil, + secret_key: nil, + region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/ses/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1167,7 +1360,7 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1181,18 +1374,17 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, params: api_params, response_type: Models::Provider ) - end # Create a new SMTP provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. # @param [Integer] port The default SMTP server port. # @param [String] username Authentication username. # @param [String] password Authentication password. - # @param [SmtpEncryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls' + # @param [SmtpEncryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls' # @param [] auto_tls Enable SMTP AutoTLS feature. # @param [String] mailer The value to use for the X-Mailer header. # @param [String] from_name Sender Name. @@ -1202,19 +1394,34 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_smtp_provider( + provider_id:, + name:, + host:, + port: nil, + username: nil, + password: nil, + encryption: nil, + auto_tls: nil, + mailer: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/smtp' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if host.nil? - raise Appwrite::Exception.new('Missing required parameter: "host"') + raise Appwrite::Exception.new('Missing required parameter: "host"') end api_params = { @@ -1233,7 +1440,7 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1247,18 +1454,17 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p params: api_params, response_type: Models::Provider ) - end # Update a SMTP provider by its unique ID. # # @param [String] provider_id Provider ID. # @param [String] name Provider name. - # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. # @param [Integer] port SMTP port. # @param [String] username Authentication username. # @param [String] password Authentication password. - # @param [SmtpEncryption] encryption Encryption type. Can be 'ssl' or 'tls' + # @param [SmtpEncryption] encryption Encryption type. Can be 'ssl' or 'tls' # @param [] auto_tls Enable SMTP AutoTLS feature. # @param [String] mailer The value to use for the X-Mailer header. # @param [String] from_name Sender Name. @@ -1268,12 +1474,27 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p # @param [] enabled Set as enabled. # # @return [Provider] - def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def update_smtp_provider( + provider_id:, + name: nil, + host: nil, + port: nil, + username: nil, + password: nil, + encryption: nil, + auto_tls: nil, + mailer: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/smtp/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1291,7 +1512,7 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1305,28 +1526,34 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username params: api_params, response_type: Models::Provider ) - end # Create a new Telesign provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] customer_id Telesign customer ID. # @param [String] api_key Telesign API key. # @param [] enabled Set as enabled. # # @return [Provider] - def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, api_key: nil, enabled: nil) + def create_telesign_provider( + provider_id:, + name:, + from: nil, + customer_id: nil, + api_key: nil, + enabled: nil + ) api_path = '/messaging/providers/telesign' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1337,7 +1564,7 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a apiKey: api_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1351,7 +1578,6 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a params: api_params, response_type: Models::Provider ) - end # Update a Telesign provider by its unique ID. @@ -1364,12 +1590,19 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a # @param [String] from Sender number. # # @return [Provider] - def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: nil, api_key: nil, from: nil) + def update_telesign_provider( + provider_id:, + name: nil, + enabled: nil, + customer_id: nil, + api_key: nil, + from: nil + ) api_path = '/messaging/providers/telesign/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1379,7 +1612,7 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: apiKey: api_key, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1393,28 +1626,34 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: params: api_params, response_type: Models::Provider ) - end # Create a new Textmagic provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] username Textmagic username. # @param [String] api_key Textmagic apiKey. # @param [] enabled Set as enabled. # # @return [Provider] - def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api_key: nil, enabled: nil) + def create_textmagic_provider( + provider_id:, + name:, + from: nil, + username: nil, + api_key: nil, + enabled: nil + ) api_path = '/messaging/providers/textmagic' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1425,7 +1664,7 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api apiKey: api_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1439,7 +1678,6 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api params: api_params, response_type: Models::Provider ) - end # Update a Textmagic provider by its unique ID. @@ -1452,12 +1690,19 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api # @param [String] from Sender number. # # @return [Provider] - def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: nil, api_key: nil, from: nil) + def update_textmagic_provider( + provider_id:, + name: nil, + enabled: nil, + username: nil, + api_key: nil, + from: nil + ) api_path = '/messaging/providers/textmagic/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1467,7 +1712,7 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n apiKey: api_key, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1481,28 +1726,34 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n params: api_params, response_type: Models::Provider ) - end # Create a new Twilio provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] account_sid Twilio account secret ID. # @param [String] auth_token Twilio authentication token. # @param [] enabled Set as enabled. # # @return [Provider] - def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, auth_token: nil, enabled: nil) + def create_twilio_provider( + provider_id:, + name:, + from: nil, + account_sid: nil, + auth_token: nil, + enabled: nil + ) api_path = '/messaging/providers/twilio' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1513,7 +1764,7 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut authToken: auth_token, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1527,7 +1778,6 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut params: api_params, response_type: Models::Provider ) - end # Update a Twilio provider by its unique ID. @@ -1540,12 +1790,19 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut # @param [String] from Sender number. # # @return [Provider] - def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: nil, auth_token: nil, from: nil) + def update_twilio_provider( + provider_id:, + name: nil, + enabled: nil, + account_sid: nil, + auth_token: nil, + from: nil + ) api_path = '/messaging/providers/twilio/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1555,7 +1812,7 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n authToken: auth_token, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1569,28 +1826,34 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n params: api_params, response_type: Models::Provider ) - end # Create a new Vonage provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] api_key Vonage API key. # @param [String] api_secret Vonage API secret. # @param [] enabled Set as enabled. # # @return [Provider] - def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_secret: nil, enabled: nil) + def create_vonage_provider( + provider_id:, + name:, + from: nil, + api_key: nil, + api_secret: nil, + enabled: nil + ) api_path = '/messaging/providers/vonage' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1601,7 +1864,7 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec apiSecret: api_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1615,7 +1878,6 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec params: api_params, response_type: Models::Provider ) - end # Update a Vonage provider by its unique ID. @@ -1628,12 +1890,19 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec # @param [String] from Sender number. # # @return [Provider] - def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_secret: nil, from: nil) + def update_vonage_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + api_secret: nil, + from: nil + ) api_path = '/messaging/providers/vonage/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1643,7 +1912,7 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, apiSecret: api_secret, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1657,26 +1926,26 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, params: api_params, response_type: Models::Provider ) - end # Get a provider by its unique ID. - # + # # # @param [String] provider_id Provider ID. # # @return [Provider] - def get_provider(provider_id:) + def get_provider( + provider_id: + ) api_path = '/messaging/providers/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1689,7 +1958,6 @@ def get_provider(provider_id:) params: api_params, response_type: Models::Provider ) - end # Delete a provider by its unique ID. @@ -1697,17 +1965,18 @@ def get_provider(provider_id:) # @param [String] provider_id Provider ID. # # @return [] - def delete_provider(provider_id:) + def delete_provider( + provider_id: + ) api_path = '/messaging/providers/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1719,7 +1988,6 @@ def delete_provider(provider_id:) headers: api_headers, params: api_params, ) - end # Get a list of all topics from the current Appwrite project. @@ -1729,7 +1997,11 @@ def delete_provider(provider_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TopicList] - def list_topics(queries: nil, search: nil, total: nil) + def list_topics( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/topics' api_params = { @@ -1737,7 +2009,7 @@ def list_topics(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1750,7 +2022,6 @@ def list_topics(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TopicList ) - end # Create a new topic. @@ -1760,15 +2031,19 @@ def list_topics(queries: nil, search: nil, total: nil) # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # # @return [Topic] - def create_topic(topic_id:, name:, subscribe: nil) + def create_topic( + topic_id:, + name:, + subscribe: nil + ) api_path = '/messaging/topics' if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1776,7 +2051,7 @@ def create_topic(topic_id:, name:, subscribe: nil) name: name, subscribe: subscribe, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1790,26 +2065,26 @@ def create_topic(topic_id:, name:, subscribe: nil) params: api_params, response_type: Models::Topic ) - end # Get a topic by its unique ID. - # + # # # @param [String] topic_id Topic ID. # # @return [Topic] - def get_topic(topic_id:) + def get_topic( + topic_id: + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1822,30 +2097,33 @@ def get_topic(topic_id:) params: api_params, response_type: Models::Topic ) - end # Update a topic by its unique ID. - # + # # # @param [String] topic_id Topic ID. # @param [String] name Topic Name. # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # # @return [Topic] - def update_topic(topic_id:, name: nil, subscribe: nil) + def update_topic( + topic_id:, + name: nil, + subscribe: nil + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end api_params = { name: name, subscribe: subscribe, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1859,7 +2137,6 @@ def update_topic(topic_id:, name: nil, subscribe: nil) params: api_params, response_type: Models::Topic ) - end # Delete a topic by its unique ID. @@ -1867,17 +2144,18 @@ def update_topic(topic_id:, name: nil, subscribe: nil) # @param [String] topic_id Topic ID. # # @return [] - def delete_topic(topic_id:) + def delete_topic( + topic_id: + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1889,7 +2167,6 @@ def delete_topic(topic_id:) headers: api_headers, params: api_params, ) - end # Get a list of all subscribers from the current Appwrite project. @@ -1900,12 +2177,17 @@ def delete_topic(topic_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SubscriberList] - def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) + def list_subscribers( + topic_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/topics/{topicId}/subscribers' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end api_params = { @@ -1913,7 +2195,7 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1926,7 +2208,6 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::SubscriberList ) - end # Create a new subscriber. @@ -1936,27 +2217,31 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) # @param [String] target_id Target ID. The target ID to link to the specified Topic ID. # # @return [Subscriber] - def create_subscriber(topic_id:, subscriber_id:, target_id:) + def create_subscriber( + topic_id:, + subscriber_id:, + target_id: + ) api_path = '/messaging/topics/{topicId}/subscribers' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end api_params = { subscriberId: subscriber_id, targetId: target_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1970,32 +2255,33 @@ def create_subscriber(topic_id:, subscriber_id:, target_id:) params: api_params, response_type: Models::Subscriber ) - end # Get a subscriber by its unique ID. - # + # # # @param [String] topic_id Topic ID. The topic ID subscribed to. # @param [String] subscriber_id Subscriber ID. # # @return [Subscriber] - def get_subscriber(topic_id:, subscriber_id:) + def get_subscriber( + topic_id:, + subscriber_id: + ) api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' .gsub('{topicId}', topic_id) .gsub('{subscriberId}', subscriber_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2008,7 +2294,6 @@ def get_subscriber(topic_id:, subscriber_id:) params: api_params, response_type: Models::Subscriber ) - end # Delete a subscriber by its unique ID. @@ -2017,22 +2302,24 @@ def get_subscriber(topic_id:, subscriber_id:) # @param [String] subscriber_id Subscriber ID. # # @return [] - def delete_subscriber(topic_id:, subscriber_id:) + def delete_subscriber( + topic_id:, + subscriber_id: + ) api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' .gsub('{topicId}', topic_id) .gsub('{subscriberId}', subscriber_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2044,8 +2331,6 @@ def delete_subscriber(topic_id:, subscriber_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/mongo.rb b/lib/appwrite/services/mongo.rb new file mode 100644 index 00000000..b745310b --- /dev/null +++ b/lib/appwrite/services/mongo.rb @@ -0,0 +1,1359 @@ +# frozen_string_literal: true + +module Appwrite + class Mongo < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/mongo' + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/mongo' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + 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::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/mongo/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + 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::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @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. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/mongo/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/mongo/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + 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::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/mongo/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/mongo/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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 + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/mongo/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + 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::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/mongo/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/mongo/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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 + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/mongo/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/mongo/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + 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::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/mongo/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + 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, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/mongo/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + 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::DedicatedDatabase + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/mongo/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/mongo/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + 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::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/mongo/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + 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::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/mongo/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/mongo/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabasePITRWindows + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/mongo/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/mongo/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/mongo/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + 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::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/mongo/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + 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::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/mongo/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/mongo/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + 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::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/mysql.rb b/lib/appwrite/services/mysql.rb new file mode 100644 index 00000000..1a9cf257 --- /dev/null +++ b/lib/appwrite/services/mysql.rb @@ -0,0 +1,1503 @@ +# frozen_string_literal: true + +module Appwrite + class Mysql < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/mysql' + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/mysql' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + 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::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/mysql/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + 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::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @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. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/mysql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/mysql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + 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::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/mysql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/mysql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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 + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/mysql/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + 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::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/mysql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/mysql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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 + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/mysql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/mysql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + 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::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/mysql/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + 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, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/mysql/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + 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::DedicatedDatabase + ) + end + + # Execute SQL through the console-facing Cloud endpoint. Cloud proxies + # through the edge platform to the per-database SQL API sidecar. Application + # traffic should bypass cloud entirely and POST directly to the per-database + # hostname: + # `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + # an `X-Appwrite-Key` header — that path scales to the whole DB fleet + # without a per-query cloud round-trip. The statement type must be on the + # database's configured allow-list. Use bound parameters for any + # user-supplied values — the API does not interpolate raw strings. + # + # @param [String] database_id Database ID. + # @param [String] sql SQL statement to execute. Exactly one statement per request. + # @param [Hash] bindings Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + # @param [Integer] timeout_seconds Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + # + # @return [DedicatedDatabaseExecution] + def create_execution( + database_id:, + sql:, + bindings: nil, + timeout_seconds: nil + ) + api_path = '/mysql/{databaseId}/executions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if sql.nil? + raise Appwrite::Exception.new('Missing required parameter: "sql"') + end + + api_params = { + sql: sql, + bindings: bindings, + timeoutSeconds: timeout_seconds, + } + + 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::DedicatedDatabaseExecution + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/mysql/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/mysql/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + 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::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/mysql/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + 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::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/mysql/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/mysql/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabasePITRWindows + ) + end + + # Get the connection pooler configuration for a dedicated database. Returns + # pooler mode, max connections, and pool size settings. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePooler] + def get_pooler( + database_id: + ) + api_path = '/mysql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabasePooler + ) + end + + # Update the connection pooler configuration for a dedicated database. + # Configure pool mode, max connections, and pool sizes. + # + # @param [String] database_id Database ID. + # @param [String] mode Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + # @param [Integer] max_connections Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + # @param [Integer] default_pool_size Default pool size per user. + # @param [] read_write_splitting Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + # @param [String] pooler_cpu_request Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + # @param [String] pooler_cpu_limit Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + # @param [String] pooler_memory_request Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + # @param [String] pooler_memory_limit Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + # + # @return [DedicatedDatabasePooler] + def update_pooler( + database_id:, + mode: nil, + max_connections: nil, + default_pool_size: nil, + read_write_splitting: nil, + pooler_cpu_request: nil, + pooler_cpu_limit: nil, + pooler_memory_request: nil, + pooler_memory_limit: nil + ) + api_path = '/mysql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + mode: mode, + maxConnections: max_connections, + defaultPoolSize: default_pool_size, + readWriteSplitting: read_write_splitting, + poolerCpuRequest: pooler_cpu_request, + poolerCpuLimit: pooler_cpu_limit, + poolerMemoryRequest: pooler_memory_request, + poolerMemoryLimit: pooler_memory_limit, + } + + 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::DedicatedDatabasePooler + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/mysql/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/mysql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/mysql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + 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::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/mysql/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + 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::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/mysql/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/mysql/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + 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::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/oauth2.rb b/lib/appwrite/services/oauth2.rb index 0f72a909..0080fe00 100644 --- a/lib/appwrite/services/oauth2.rb +++ b/lib/appwrite/services/oauth2.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Oauth2 < Service - def initialize(client) @client = client end @@ -18,12 +17,16 @@ def initialize(client) # @param [String] scope Space-separated scopes the user consented to. Must be a subset of the scopes originally requested; identity scopes such as `openid` are always retained. Optional; omit to keep the originally requested scopes. # # @return [Oauth2Approve] - def approve(grant_id:, authorization_details: nil, scope: nil) + def approve( + grant_id:, + authorization_details: nil, + scope: nil + ) api_path = '/oauth2/{project_id}/approve' .gsub('{project_id}', @client.get_config('project')) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end api_params = { @@ -31,7 +34,7 @@ def approve(grant_id:, authorization_details: nil, scope: nil) authorization_details: authorization_details, scope: scope, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -44,7 +47,6 @@ def approve(grant_id:, authorization_details: nil, scope: nil) params: api_params, response_type: Models::Oauth2Approve ) - end # Begin the OAuth2 authorization flow. When called without a session, the @@ -69,7 +71,22 @@ def approve(grant_id:, authorization_details: nil, scope: nil) # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. # # @return [Oauth2Authorize] - def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + def authorize( + client_id: nil, + redirect_uri: nil, + response_type: nil, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil, + request_uri: nil + ) api_path = '/oauth2/{project_id}/authorize' .gsub('{project_id}', @client.get_config('project')) @@ -89,7 +106,7 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, audience: audience, request_uri: request_uri, } - + api_headers = { "accept": 'application/json', } @@ -101,7 +118,6 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, params: api_params, response_type: Models::Oauth2Authorize ) - end # Begin the OAuth2 authorization flow. When called without a session, the @@ -126,7 +142,22 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. # # @return [Oauth2Authorize] - def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + def authorize_post( + client_id: nil, + redirect_uri: nil, + response_type: nil, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil, + request_uri: nil + ) api_path = '/oauth2/{project_id}/authorize' .gsub('{project_id}', @client.get_config('project')) @@ -146,7 +177,7 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: audience: audience, request_uri: request_uri, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -159,7 +190,6 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: params: api_params, response_type: Models::Oauth2Authorize ) - end # Start the OAuth2 Device Authorization Grant. Returns the device code, user @@ -172,7 +202,13 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2DeviceAuthorization] - def create_device_authorization(client_id: nil, scope: nil, authorization_details: nil, resource: nil, audience: nil) + def create_device_authorization( + client_id: nil, + scope: nil, + authorization_details: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/device_authorization' .gsub('{project_id}', @client.get_config('project')) @@ -183,7 +219,7 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -196,7 +232,6 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail params: api_params, response_type: Models::Oauth2DeviceAuthorization ) - end # Exchange a device flow user code for an OAuth2 grant. The authenticated @@ -207,18 +242,20 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail # @param [String] user_code User code displayed on the device. # # @return [Oauth2Grant] - def create_grant(user_code:) + def create_grant( + user_code: + ) api_path = '/oauth2/{project_id}/grants' .gsub('{project_id}', @client.get_config('project')) if user_code.nil? - raise Appwrite::Exception.new('Missing required parameter: "userCode"') + raise Appwrite::Exception.new('Missing required parameter: "userCode"') end api_params = { user_code: user_code, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -231,7 +268,6 @@ def create_grant(user_code:) params: api_params, response_type: Models::Oauth2Grant ) - end # Get an OAuth2 grant by its ID. Used by the consent screen to display the @@ -241,18 +277,19 @@ def create_grant(user_code:) # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. # # @return [Oauth2Grant] - def get_grant(grant_id:) + def get_grant( + grant_id: + ) api_path = '/oauth2/{project_id}/grants/{grant_id}' .gsub('{project_id}', @client.get_config('project')) .gsub('{grant_id}', grant_id) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end - api_params = { - } - + api_params = {} + api_headers = { "accept": 'application/json', } @@ -264,11 +301,10 @@ def get_grant(grant_id:) params: api_params, response_type: Models::Oauth2Grant ) - end # List the organizations the OAuth2 access token can access. Resolves the - # token's `organization` authorization details, expanding the `*` wildcard + # token's `organization` authorization details, expanding the `*` wildcard # into the concrete set of organizations the user can see. # # @param [Integer] limit Maximum number of organizations to return. Between 1 and 5000. @@ -276,7 +312,11 @@ def get_grant(grant_id:) # @param [String] search Search term to filter your list results. Max length: 256 chars. # # @return [Oauth2OrganizationList] - def list_organizations(limit: nil, offset: nil, search: nil) + def list_organizations( + limit: nil, + offset: nil, + search: nil + ) api_path = '/oauth2/{project_id}/organizations' .gsub('{project_id}', @client.get_config('project')) @@ -285,7 +325,7 @@ def list_organizations(limit: nil, offset: nil, search: nil) offset: offset, search: search, } - + api_headers = { "accept": 'application/json', } @@ -297,7 +337,6 @@ def list_organizations(limit: nil, offset: nil, search: nil) params: api_params, response_type: Models::Oauth2OrganizationList ) - end # Store an OAuth2 authorization request server-side and receive a short-lived @@ -318,20 +357,34 @@ def list_organizations(limit: nil, offset: nil, search: nil) # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2PAR] - def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil) + def create_par( + client_id:, + redirect_uri:, + response_type:, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/par' .gsub('{project_id}', @client.get_config('project')) if client_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "clientId"') + raise Appwrite::Exception.new('Missing required parameter: "clientId"') end if redirect_uri.nil? - raise Appwrite::Exception.new('Missing required parameter: "redirectUri"') + raise Appwrite::Exception.new('Missing required parameter: "redirectUri"') end if response_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "responseType"') + raise Appwrite::Exception.new('Missing required parameter: "responseType"') end api_params = { @@ -349,7 +402,7 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -362,10 +415,9 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil params: api_params, response_type: Models::Oauth2PAR ) - end - # List the projects the OAuth2 access token can access. Resolves the token's + # List the projects the OAuth2 access token can access. Resolves the token's # `project` authorization details, expanding the `*` wildcard into the # concrete set of projects the user can see. # @@ -374,7 +426,11 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil # @param [String] search Search term to filter your list results. Max length: 256 chars. # # @return [Oauth2ProjectList] - def list_projects(limit: nil, offset: nil, search: nil) + def list_projects( + limit: nil, + offset: nil, + search: nil + ) api_path = '/oauth2/{project_id}/projects' .gsub('{project_id}', @client.get_config('project')) @@ -383,7 +439,7 @@ def list_projects(limit: nil, offset: nil, search: nil) offset: offset, search: search, } - + api_headers = { "accept": 'application/json', } @@ -395,7 +451,6 @@ def list_projects(limit: nil, offset: nil, search: nil) params: api_params, response_type: Models::Oauth2ProjectList ) - end # Reject an OAuth2 grant when the user denies consent. Returns the @@ -406,18 +461,20 @@ def list_projects(limit: nil, offset: nil, search: nil) # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. # # @return [Oauth2Reject] - def reject(grant_id:) + def reject( + grant_id: + ) api_path = '/oauth2/{project_id}/reject' .gsub('{project_id}', @client.get_config('project')) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end api_params = { grant_id: grant_id, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -430,7 +487,6 @@ def reject(grant_id:) params: api_params, response_type: Models::Oauth2Reject ) - end # Revoke an OAuth2 access token or refresh token. @@ -441,12 +497,17 @@ def reject(grant_id:) # @param [String] client_secret OAuth2 client secret. Required for confidential apps; omitted for public apps. # # @return [] - def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) + def revoke( + token:, + token_type_hint: nil, + client_id: nil, + client_secret: nil + ) api_path = '/oauth2/{project_id}/revoke' .gsub('{project_id}', @client.get_config('project')) if token.nil? - raise Appwrite::Exception.new('Missing required parameter: "token"') + raise Appwrite::Exception.new('Missing required parameter: "token"') end api_params = { @@ -455,7 +516,7 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) client_id: client_id, client_secret: client_secret, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -467,7 +528,6 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) headers: api_headers, params: api_params, ) - end # Exchange an OAuth2 authorization code, refresh token, or device code for @@ -485,12 +545,23 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2Token] - def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, client_id: nil, client_secret: nil, code_verifier: nil, redirect_uri: nil, resource: nil, audience: nil) + def create_token( + grant_type:, + code: nil, + refresh_token: nil, + device_code: nil, + client_id: nil, + client_secret: nil, + code_verifier: nil, + redirect_uri: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/token' .gsub('{project_id}', @client.get_config('project')) if grant_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantType"') + raise Appwrite::Exception.new('Missing required parameter: "grantType"') end api_params = { @@ -505,7 +576,7 @@ def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, c resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -518,8 +589,6 @@ def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, c params: api_params, response_type: Models::Oauth2Token ) - end - - end + end end diff --git a/lib/appwrite/services/organization.rb b/lib/appwrite/services/organization.rb index 71a003f7..83c2817d 100644 --- a/lib/appwrite/services/organization.rb +++ b/lib/appwrite/services/organization.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Organization < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/organization' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -29,25 +27,26 @@ def get() params: api_params, response_type: Models::Organization ) - end - # Update the current organization's name. + # Update the current organization's name. # # @param [String] name New organization name. Max length: 128 chars. # # @return [Organization] - def update(name:) + def update( + name: + ) api_path = '/organization' if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + 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', @@ -61,7 +60,6 @@ def update(name:) params: api_params, response_type: Models::Organization ) - end # Delete the current organization. All projects that belong to the @@ -72,9 +70,8 @@ def update(name:) def delete() api_path = '/organization' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -86,7 +83,6 @@ def delete() headers: api_headers, params: api_params, ) - end # List app installations on the organization. Any organization member can @@ -96,14 +92,17 @@ def delete() # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(queries: nil, total: nil) + 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', @@ -116,7 +115,6 @@ def list_installations(queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Install an app on the organization. Only organization members with the @@ -127,18 +125,21 @@ def list_installations(queries: nil, total: nil) # @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. # # @return [AppInstallation] - def create_installation(app_id:, authorization_details: nil) + def create_installation( + app_id:, + authorization_details: nil + ) api_path = '/organization/installations' if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { appId: app_id, authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -152,7 +153,6 @@ def create_installation(app_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Get an app installation on the organization by its unique ID. Any @@ -161,17 +161,18 @@ def create_installation(app_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(installation_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -184,11 +185,10 @@ def get_installation(installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Update an app installation on the organization. Only organization members - # with the owner role can update installations. The installation's granted + # 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. # @@ -196,18 +196,21 @@ def get_installation(installation_id:) # @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. # # @return [AppInstallation] - def update_installation(installation_id:, authorization_details: nil) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -221,7 +224,6 @@ def update_installation(installation_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Uninstall an app from the organization by its installation ID. Only @@ -231,17 +233,18 @@ def update_installation(installation_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(installation_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -254,7 +257,6 @@ def delete_installation(installation_id:) headers: api_headers, params: api_params, ) - end # Get a list of all API keys from the current organization. @@ -263,14 +265,17 @@ def delete_installation(installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [KeyList] - def list_keys(queries: nil, total: nil) + 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', @@ -283,30 +288,34 @@ def list_keys(queries: nil, total: nil) params: api_params, response_type: Models::KeyList ) - end # Create a new organization API key. # - # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Key name. Max length: 128 chars. # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def create_key(key_id:, name:, scopes:, expire: nil) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -315,7 +324,7 @@ def create_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -329,7 +338,6 @@ def create_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Get a key by its unique ID. This endpoint returns details about a specific @@ -338,17 +346,18 @@ def create_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key unique ID. # # @return [Key] - def get_key(key_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -361,7 +370,6 @@ def get_key(key_id:) params: api_params, response_type: Models::Key ) - end # Update a key by its unique ID. Use this endpoint to update the name, @@ -373,20 +381,25 @@ def get_key(key_id:) # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def update_key(key_id:, name:, scopes:, expire: nil) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -394,7 +407,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -408,7 +421,6 @@ def update_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Delete a key by its unique ID. Once deleted, the key can no longer be used @@ -417,17 +429,18 @@ def update_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key unique ID. # # @return [] - def delete_key(key_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -439,7 +452,6 @@ def delete_key(key_id:) headers: api_headers, params: api_params, ) - end # Get a list of all memberships from the current organization. @@ -449,7 +461,11 @@ def delete_key(key_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(queries: nil, search: nil, total: nil) + def list_memberships( + queries: nil, + search: nil, + total: nil + ) api_path = '/organization/memberships' api_params = { @@ -457,7 +473,7 @@ def list_memberships(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -470,26 +486,32 @@ def list_memberships(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # 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. + # 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. # # @param [Array] roles Array of strings. Use this param to set the user roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # @param [String] email Email of the new organization member. # @param [String] user_id ID of the user to be added to the organization. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. # @param [String] name Name of the new organization member. Max length: 128 chars. # # @return [Membership] - def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { @@ -500,7 +522,7 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na url: url, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -514,7 +536,6 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na params: api_params, response_type: Models::Membership ) - end # Get a membership from the current organization by its unique ID. @@ -522,17 +543,18 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na # @param [String] membership_id Membership ID. # # @return [Membership] - def get_membership(membership_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -545,31 +567,33 @@ def get_membership(membership_id:) params: api_params, response_type: Models::Membership ) - end # Modify the roles of a member in the current organization. # # @param [String] membership_id Membership ID. - # @param [Array] roles An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # @param [Array] roles An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # # @return [Membership] - def update_membership(membership_id:, roles:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + 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', @@ -583,7 +607,6 @@ def update_membership(membership_id:, roles:) params: api_params, response_type: Models::Membership ) - end # Remove a member from the current organization. The member is removed @@ -593,17 +616,18 @@ def update_membership(membership_id:, roles:) # @param [String] membership_id Membership ID. # # @return [] - def delete_membership(membership_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -615,7 +639,6 @@ def delete_membership(membership_id:) headers: api_headers, params: api_params, ) - end # Get a list of all projects. You can use the query params to filter your @@ -626,7 +649,11 @@ def delete_membership(membership_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProjectList] - def list_projects(queries: nil, search: nil, total: nil) + def list_projects( + queries: nil, + search: nil, + total: nil + ) api_path = '/organization/projects' api_params = { @@ -634,7 +661,7 @@ def list_projects(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -647,25 +674,28 @@ def list_projects(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::ProjectList ) - end # Create a new project. # - # @param [String] project_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. + # @param [String] project_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. # @param [String] name Project name. Max length: 128 chars. # @param [Region] region Project Region. # # @return [Project] - def create_project(project_id:, name:, region: nil) + def create_project( + project_id:, + name:, + region: nil + ) api_path = '/organization/projects' if project_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "projectId"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -673,7 +703,7 @@ def create_project(project_id:, name:, region: nil) name: name, region: region, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -687,7 +717,6 @@ def create_project(project_id:, name:, region: nil) params: api_params, response_type: Models::Project ) - end # Get a project. @@ -695,17 +724,18 @@ def create_project(project_id:, name:, region: nil) # @param [String] project_id Project unique ID. # # @return [Project] - def get_project(project_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), } @@ -717,7 +747,6 @@ def get_project(project_id:) params: api_params, response_type: Models::Project ) - end # Update a project by its unique ID. @@ -726,22 +755,25 @@ def get_project(project_id:) # @param [String] name Project name. Max length: 128 chars. # # @return [Project] - def update_project(project_id:, name:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + 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', @@ -755,7 +787,6 @@ def update_project(project_id:, name:) params: api_params, response_type: Models::Project ) - end # Delete a project by its unique ID. @@ -763,17 +794,18 @@ def update_project(project_id:, name:) # @param [String] project_id Project unique ID. # # @return [] - def delete_project(project_id:) + 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"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -785,8 +817,6 @@ def delete_project(project_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/postgresql.rb b/lib/appwrite/services/postgresql.rb new file mode 100644 index 00000000..24c1ceb5 --- /dev/null +++ b/lib/appwrite/services/postgresql.rb @@ -0,0 +1,1615 @@ +# frozen_string_literal: true + +module Appwrite + class Postgresql < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/postgresql' + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/postgresql' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + 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::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/postgresql/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + 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::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @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. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/postgresql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/postgresql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + 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::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + 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::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + 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::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + 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 + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/postgresql/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + 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::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/postgresql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/postgresql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + 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 + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/postgresql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/postgresql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + 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::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/postgresql/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + 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, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/postgresql/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + 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::DedicatedDatabase + ) + end + + # Execute SQL through the console-facing Cloud endpoint. Cloud proxies + # through the edge platform to the per-database SQL API sidecar. Application + # traffic should bypass cloud entirely and POST directly to the per-database + # hostname: + # `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + # an `X-Appwrite-Key` header — that path scales to the whole DB fleet + # without a per-query cloud round-trip. The statement type must be on the + # database's configured allow-list. Use bound parameters for any + # user-supplied values — the API does not interpolate raw strings. + # + # @param [String] database_id Database ID. + # @param [String] sql SQL statement to execute. Exactly one statement per request. + # @param [Hash] bindings Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + # @param [Integer] timeout_seconds Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + # + # @return [DedicatedDatabaseExecution] + def create_execution( + database_id:, + sql:, + bindings: nil, + timeout_seconds: nil + ) + api_path = '/postgresql/{databaseId}/executions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if sql.nil? + raise Appwrite::Exception.new('Missing required parameter: "sql"') + end + + api_params = { + sql: sql, + bindings: bindings, + timeoutSeconds: timeout_seconds, + } + + 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::DedicatedDatabaseExecution + ) + end + + # List installed and available extensions for a PostgreSQL database. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseExtensions] + def list_extensions( + database_id: + ) + api_path = '/postgresql/{databaseId}/extensions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseExtensions + ) + end + + # Install a database extension. Only available for PostgreSQL databases. The + # install runs asynchronously; poll the extensions list endpoint for status. + # + # @param [String] database_id Database ID. + # @param [String] name Extension name (e.g., pgvector, postgis, uuid-ossp). + # + # @return [DedicatedDatabase] + def create_extension( + database_id:, + name: + ) + api_path = '/postgresql/{databaseId}/extensions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Uninstall a database extension from a PostgreSQL database. The uninstall + # runs asynchronously; poll the extensions list endpoint for status. + # + # @param [String] database_id Database ID. + # @param [String] extension_name Extension name to uninstall. + # + # @return [DedicatedDatabase] + def delete_extension( + database_id:, + extension_name: + ) + api_path = '/postgresql/{databaseId}/extensions/{extensionName}' + .gsub('{databaseId}', database_id) + .gsub('{extensionName}', extension_name) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if extension_name.nil? + raise Appwrite::Exception.new('Missing required parameter: "extensionName"') + 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, + response_type: Models::DedicatedDatabase + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/postgresql/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/postgresql/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + 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::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/postgresql/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + 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::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/postgresql/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/postgresql/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabasePITRWindows + ) + end + + # Get the connection pooler configuration for a dedicated database. Returns + # pooler mode, max connections, and pool size settings. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePooler] + def get_pooler( + database_id: + ) + api_path = '/postgresql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabasePooler + ) + end + + # Update the connection pooler configuration for a dedicated database. + # Configure pool mode, max connections, and pool sizes. + # + # @param [String] database_id Database ID. + # @param [String] mode Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + # @param [Integer] max_connections Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + # @param [Integer] default_pool_size Default pool size per user. + # @param [] read_write_splitting Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + # @param [String] pooler_cpu_request Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + # @param [String] pooler_cpu_limit Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + # @param [String] pooler_memory_request Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + # @param [String] pooler_memory_limit Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + # + # @return [DedicatedDatabasePooler] + def update_pooler( + database_id:, + mode: nil, + max_connections: nil, + default_pool_size: nil, + read_write_splitting: nil, + pooler_cpu_request: nil, + pooler_cpu_limit: nil, + pooler_memory_request: nil, + pooler_memory_limit: nil + ) + api_path = '/postgresql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + mode: mode, + maxConnections: max_connections, + defaultPoolSize: default_pool_size, + readWriteSplitting: read_write_splitting, + poolerCpuRequest: pooler_cpu_request, + poolerCpuLimit: pooler_cpu_limit, + poolerMemoryRequest: pooler_memory_request, + poolerMemoryLimit: pooler_memory_limit, + } + + 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::DedicatedDatabasePooler + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/postgresql/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/postgresql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/postgresql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + 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::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/postgresql/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + 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::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/postgresql/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/postgresql/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + 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::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/presences.rb b/lib/appwrite/services/presences.rb index d5f1c30c..01a022ed 100644 --- a/lib/appwrite/services/presences.rb +++ b/lib/appwrite/services/presences.rb @@ -1,21 +1,24 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Presences < Service - def initialize(client) @client = client end # List presence logs. Expired entries are filtered out automatically. - # + # # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [PresenceList] - def list(queries: nil, total: nil, ttl: nil) + def list( + queries: nil, + total: nil, + ttl: nil + ) api_path = '/presences' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, total: nil, ttl: nil) total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,27 +39,27 @@ def list(queries: nil, total: nil, ttl: nil) params: api_params, response_type: Models::PresenceList ) - end # Get a presence log by its unique ID. Entries whose `expiresAt` is in the # past are treated as not found. - # + # # # @param [String] presence_id Presence unique ID. # # @return [Presence] - def get(presence_id:) + def get( + presence_id: + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -69,11 +72,10 @@ def get(presence_id:) params: api_params, response_type: Models::Presence ) - end # Create or update a presence log by its user ID. - # + # # # @param [String] presence_id Presence unique ID. # @param [String] user_id User ID. @@ -83,20 +85,27 @@ def get(presence_id:) # @param [Hash] metadata Presence metadata object. # # @return [Presence] - def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, metadata: nil) + def upsert( + presence_id:, + user_id:, + status:, + permissions: nil, + expires_at: nil, + metadata: nil + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if status.nil? - raise Appwrite::Exception.new('Missing required parameter: "status"') + raise Appwrite::Exception.new('Missing required parameter: "status"') end api_params = { @@ -106,7 +115,7 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m expiresAt: expires_at, metadata: metadata, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -120,12 +129,11 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m params: api_params, response_type: Models::Presence ) - end # Update a presence log by its unique ID. Using the patch method you can pass # only specific fields that will get updated. - # + # # # @param [String] presence_id Presence unique ID. # @param [String] user_id User ID. @@ -136,16 +144,24 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m # @param [] purge When true, purge cached responses used by list presences endpoint. # # @return [Presence] - def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: nil, purge: nil) + def update( + presence_id:, + user_id:, + status: nil, + expires_at: nil, + metadata: nil, + permissions: nil, + purge: nil + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -156,7 +172,7 @@ def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: permissions, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -170,26 +186,26 @@ def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, params: api_params, response_type: Models::Presence ) - end # Delete a presence log by its unique ID. - # + # # # @param [String] presence_id Presence unique ID. # # @return [] - def delete(presence_id:) + def delete( + presence_id: + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -201,8 +217,6 @@ def delete(presence_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index ada33927..fa543cf4 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Project < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/project' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), } @@ -28,7 +26,6 @@ def get() params: api_params, response_type: Models::Project ) - end # Delete a project. @@ -38,9 +35,8 @@ def get() def delete() api_path = '/project' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -52,32 +48,34 @@ def delete() headers: api_headers, params: api_params, ) - end # Update properties of a specific auth method. Use this endpoint to enable or - # disable a method in your project. + # disable a method in your project. # # @param [ProjectAuthMethodId] method_id Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone # @param [] enabled Auth method status. # # @return [Project] - def update_auth_method(method_id:, enabled:) + def update_auth_method( + method_id:, + enabled: + ) api_path = '/project/auth-methods/{methodId}' .gsub('{methodId}', method_id) if method_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "methodId"') + raise Appwrite::Exception.new('Missing required parameter: "methodId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -91,7 +89,6 @@ def update_auth_method(method_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Get a list of all API keys from the current project. @@ -100,14 +97,17 @@ def update_auth_method(method_id:, enabled:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [KeyList] - def list_keys(queries: nil, total: nil) + def list_keys( + queries: nil, + total: nil + ) api_path = '/project/keys' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -120,12 +120,11 @@ def list_keys(queries: nil, total: nil) params: api_params, response_type: Models::KeyList ) - end - # Create a new ephemeral API key. It's recommended to have multiple API keys + # Create a new ephemeral API key. It's recommended to have multiple API keys # with strict scopes for separate functions within your project. - # + # # You can also create a standard API key if you need a longer-lived key # instead. # @@ -133,22 +132,25 @@ def list_keys(queries: nil, total: nil) # @param [Integer] duration Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. # # @return [EphemeralKey] - def create_ephemeral_key(scopes:, duration:) + def create_ephemeral_key( + scopes:, + duration: + ) api_path = '/project/keys/ephemeral' if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end if duration.nil? - raise Appwrite::Exception.new('Missing required parameter: "duration"') + raise Appwrite::Exception.new('Missing required parameter: "duration"') end api_params = { scopes: scopes, duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -162,25 +164,25 @@ def create_ephemeral_key(scopes:, duration:) params: api_params, response_type: Models::EphemeralKey ) - end - # Get a key by its unique ID. + # Get a key by its unique ID. # # @param [String] key_id Key ID. # # @return [Key] - def get_key(key_id:) + def get_key( + key_id: + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -193,7 +195,6 @@ def get_key(key_id:) params: api_params, response_type: Models::Key ) - end # Update a key by its unique ID. Use this endpoint to update the name, @@ -205,20 +206,25 @@ def get_key(key_id:) # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def update_key(key_id:, name:, scopes:, expire: nil) + def update_key( + key_id:, + name:, + scopes:, + expire: nil + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -226,7 +232,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -240,7 +246,6 @@ def update_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Delete a key by its unique ID. Once deleted, the key can no longer be used @@ -249,17 +254,18 @@ def update_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key ID. # # @return [] - def delete_key(key_id:) + def delete_key( + key_id: + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -271,7 +277,6 @@ def delete_key(key_id:) headers: api_headers, params: api_params, ) - end # Update the project labels. Labels can be used to easily filter projects in @@ -280,17 +285,19 @@ def delete_key(key_id:) # @param [Array] labels Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [Project] - def update_labels(labels:) + def update_labels( + labels: + ) api_path = '/project/labels' if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -304,7 +311,6 @@ def update_labels(labels:) params: api_params, response_type: Models::Project ) - end # Get a list of all mock phones in the project. This endpoint returns an @@ -314,14 +320,17 @@ def update_labels(labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MockNumberList] - def list_mock_phones(queries: nil, total: nil) + def list_mock_phones( + queries: nil, + total: nil + ) api_path = '/project/mock-phones' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -334,7 +343,6 @@ def list_mock_phones(queries: nil, total: nil) params: api_params, response_type: Models::MockNumberList ) - end # Create a new mock phone for your project. Use this endpoint to register a @@ -344,22 +352,25 @@ def list_mock_phones(queries: nil, total: nil) # @param [String] otp One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. # # @return [MockNumber] - def create_mock_phone(number:, otp:) + def create_mock_phone( + number:, + otp: + ) api_path = '/project/mock-phones' if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { number: number, otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -373,26 +384,26 @@ def create_mock_phone(number:, otp:) params: api_params, response_type: Models::MockNumber ) - end # Get a mock phone by its unique number. This endpoint returns the mock - # phone's OTP. + # phone's OTP. # # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # # @return [MockNumber] - def get_mock_phone(number:) + def get_mock_phone( + number: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -405,32 +416,34 @@ def get_mock_phone(number:) params: api_params, response_type: Models::MockNumber ) - end # Update a mock phone by its unique number. Use this endpoint to update the - # mock phone's OTP. + # mock phone's OTP. # # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # @param [String] otp One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. # # @return [MockNumber] - def update_mock_phone(number:, otp:) + def update_mock_phone( + number:, + otp: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -444,7 +457,6 @@ def update_mock_phone(number:, otp:) params: api_params, response_type: Models::MockNumber ) - end # Delete a mock phone by its unique number. This endpoint removes the mock @@ -453,17 +465,18 @@ def update_mock_phone(number:, otp:) # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # # @return [] - def delete_mock_phone(number:) + def delete_mock_phone( + number: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -475,25 +488,27 @@ def delete_mock_phone(number:) headers: api_headers, params: api_params, ) - end # Get a list of all OAuth2 providers supported by the server, along with the - # project's configuration for each. Credential fields are write-only and + # project's configuration for each. Credential fields are write-only and # always returned empty. # # @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). Only supported methods are limit and offset # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [OAuth2ProviderList] - def list_o_auth2_providers(queries: nil, total: nil) + def list_o_auth2_providers( + queries: nil, + total: nil + ) api_path = '/project/oauth2' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -506,7 +521,6 @@ def list_o_auth2_providers(queries: nil, total: nil) params: api_params, response_type: Models::OAuth2ProviderList ) - end # Update the OAuth2 server (OIDC provider) configuration. @@ -529,15 +543,32 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [Array] installation_scopes List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long. # # @return [Project] - def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil, installation_scopes: nil) + def update_o_auth2_server( + enabled:, + authorization_url:, + scopes: nil, + authorization_details_types: nil, + access_token_duration: nil, + refresh_token_duration: nil, + public_access_token_duration: nil, + public_refresh_token_duration: nil, + installation_access_token_duration: nil, + confidential_pkce: nil, + verification_url: nil, + user_code_length: nil, + user_code_format: nil, + device_code_duration: nil, + default_scopes: nil, + installation_scopes: nil + ) api_path = '/project/oauth2-server' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end if authorization_url.nil? - raise Appwrite::Exception.new('Missing required parameter: "authorizationUrl"') + raise Appwrite::Exception.new('Missing required parameter: "authorizationUrl"') end api_params = { @@ -558,7 +589,7 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati defaultScopes: default_scopes, installationScopes: installation_scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -572,17 +603,20 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati params: api_params, response_type: Models::Project ) - end # Update the project OAuth2 Amazon configuration. # - # @param [String] client_id 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + # @param [String] client_id 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Amazon] - def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_amazon( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/amazon' api_params = { @@ -590,7 +624,7 @@ def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -604,19 +638,24 @@ def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Amazon ) - end # Update the project OAuth2 Apple configuration. # - # @param [String] service_id 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - # @param [String] key_id 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - # @param [String] team_id 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + # @param [String] service_id 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + # @param [String] key_id 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + # @param [String] team_id 'Team ID' of Apple OAuth2 app. For example: D4000000R6 # @param [String] p8_file Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Apple] - def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: nil, enabled: nil) + def update_o_auth2_apple( + service_id: nil, + key_id: nil, + team_id: nil, + p8_file: nil, + enabled: nil + ) api_path = '/project/oauth2/apple' api_params = { @@ -626,7 +665,7 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni p8File: p8_file, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -640,17 +679,20 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni params: api_params, response_type: Models::OAuth2Apple ) - end # Update the project OAuth2 Appwrite configuration. # - # @param [String] client_id 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 - # @param [String] client_secret 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 + # @param [String] client_id 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 + # @param [String] client_secret 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Appwrite] - def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_appwrite( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/appwrite' api_params = { @@ -658,7 +700,7 @@ def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -672,18 +714,22 @@ def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Appwrite ) - end # Update the project OAuth2 Auth0 configuration. # - # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF # @param [String] endpoint Domain of Auth0 instance. For example: example.us.auth0.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Auth0] - def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_auth0( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/auth0' api_params = { @@ -692,7 +738,7 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -706,18 +752,22 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab params: api_params, response_type: Models::OAuth2Auth0 ) - end # Update the project OAuth2 Authentik configuration. # - # @param [String] client_id 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + # @param [String] client_id 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK # @param [String] endpoint Domain of Authentik instance. For example: example.authentik.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Authentik] - def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_authentik( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/authentik' api_params = { @@ -726,7 +776,7 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -740,17 +790,20 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, params: api_params, response_type: Models::OAuth2Authentik ) - end # Update the project OAuth2 Autodesk configuration. # - # @param [String] client_id 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + # @param [String] client_id 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Autodesk] - def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_autodesk( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/autodesk' api_params = { @@ -758,7 +811,7 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -772,17 +825,20 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Autodesk ) - end # Update the project OAuth2 Bitbucket configuration. # - # @param [String] key 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + # @param [String] key 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitbucket] - def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) + def update_o_auth2_bitbucket( + key: nil, + secret: nil, + enabled: nil + ) api_path = '/project/oauth2/bitbucket' api_params = { @@ -790,7 +846,7 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) secret: secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -804,17 +860,20 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Bitbucket ) - end # Update the project OAuth2 Bitly configuration. # - # @param [String] client_id 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + # @param [String] client_id 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitly] - def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_bitly( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/bitly' api_params = { @@ -822,7 +881,7 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -836,17 +895,20 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Bitly ) - end # Update the project OAuth2 Box configuration. # - # @param [String] client_id 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + # @param [String] client_id 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Box] - def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_box( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/box' api_params = { @@ -854,7 +916,7 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -868,17 +930,20 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Box ) - end # Update the project OAuth2 Dailymotion configuration. # - # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dailymotion] - def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) + def update_o_auth2_dailymotion( + api_key: nil, + api_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/dailymotion' api_params = { @@ -886,7 +951,7 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) apiSecret: api_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -900,17 +965,20 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Dailymotion ) - end # Update the project OAuth2 Discord configuration. # - # @param [String] client_id 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + # @param [String] client_id 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Discord] - def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_discord( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/discord' api_params = { @@ -918,7 +986,7 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -932,17 +1000,20 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Discord ) - end # Update the project OAuth2 Disqus configuration. # - # @param [String] public_key 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + # @param [String] public_key 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Disqus] - def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) + def update_o_auth2_disqus( + public_key: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/disqus' api_params = { @@ -950,7 +1021,7 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -964,17 +1035,20 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Disqus ) - end # Update the project OAuth2 Dropbox configuration. # - # @param [String] app_key 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + # @param [String] app_key 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dropbox] - def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) + def update_o_auth2_dropbox( + app_key: nil, + app_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/dropbox' api_params = { @@ -982,7 +1056,7 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) appSecret: app_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -996,17 +1070,20 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Dropbox ) - end # Update the project OAuth2 Etsy configuration. # - # @param [String] key_string 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + # @param [String] key_string 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Etsy] - def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) + def update_o_auth2_etsy( + key_string: nil, + shared_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/etsy' api_params = { @@ -1014,7 +1091,7 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) sharedSecret: shared_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1028,17 +1105,20 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Etsy ) - end # Update the project OAuth2 Facebook configuration. # - # @param [String] app_id 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + # @param [String] app_id 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Facebook] - def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) + def update_o_auth2_facebook( + app_id: nil, + app_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/facebook' api_params = { @@ -1046,7 +1126,7 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) appSecret: app_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1060,17 +1140,20 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Facebook ) - end # Update the project OAuth2 Figma configuration. # - # @param [String] client_id 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + # @param [String] client_id 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Figma] - def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_figma( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/figma' api_params = { @@ -1078,7 +1161,7 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1092,18 +1175,22 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Figma ) - end # Update the project OAuth2 FusionAuth configuration. # - # @param [String] client_id 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + # @param [String] client_id 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc # @param [String] endpoint Domain of FusionAuth instance. For example: example.fusionauth.io # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2FusionAuth] - def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_fusion_auth( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/fusionauth' api_params = { @@ -1112,7 +1199,7 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1126,17 +1213,20 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil params: api_params, response_type: Models::OAuth2FusionAuth ) - end # Update the project OAuth2 GitHub configuration. # - # @param [String] client_id 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + # @param [String] client_id 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Github] - def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_git_hub( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/github' api_params = { @@ -1144,7 +1234,7 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1158,18 +1248,22 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Github ) - end # Update the project OAuth2 Gitlab configuration. # - # @param [String] application_id 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + # @param [String] application_id 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 # @param [String] endpoint Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Gitlab] - def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_gitlab( + application_id: nil, + secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/gitlab' api_params = { @@ -1178,7 +1272,7 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1192,18 +1286,22 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl params: api_params, response_type: Models::OAuth2Gitlab ) - end # Update the project OAuth2 Google configuration. # - # @param [String] client_id 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj - # @param [Array] prompt Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + # @param [String] client_id 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + # @param [Array] prompt Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Google] - def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabled: nil) + def update_o_auth2_google( + client_id: nil, + client_secret: nil, + prompt: nil, + enabled: nil + ) api_path = '/project/oauth2/google' api_params = { @@ -1212,7 +1310,7 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabl prompt: prompt, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1226,19 +1324,59 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabl params: api_params, response_type: Models::OAuth2Google ) + end + + # Update the project OAuth2 Hugging Face configuration. + # + # @param [String] client_id 'Client ID' of Hugging Face OAuth2 app. For example: 2ab9cff9-d711-40ad-a91e-b08a49c42d24 + # @param [String] client_secret 'Client Secret' of Hugging Face OAuth2 app. For example: oauth_app_secret_wcLhRtl000000000000000000000xbNdLt + # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + # + # @return [OAuth2HuggingFace] + def update_o_auth2_hugging_face( + client_id: nil, + client_secret: nil, + enabled: nil + ) + api_path = '/project/oauth2/huggingface' + + api_params = { + clientId: client_id, + clientSecret: client_secret, + enabled: enabled, + } + + 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::OAuth2HuggingFace + ) end # Update the project OAuth2 Keycloak configuration. # - # @param [String] client_id 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + # @param [String] client_id 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO # @param [String] endpoint Domain of Keycloak instance. For example: keycloak.example.com # @param [String] realm_name Keycloak realm name. For example: appwrite-realm # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Keycloak] - def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, realm_name: nil, enabled: nil) + def update_o_auth2_keycloak( + client_id: nil, + client_secret: nil, + endpoint: nil, + realm_name: nil, + enabled: nil + ) api_path = '/project/oauth2/keycloak' api_params = { @@ -1248,7 +1386,7 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r realmName: realm_name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1262,17 +1400,20 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r params: api_params, response_type: Models::OAuth2Keycloak ) - end # Update the project OAuth2 Kick configuration. # - # @param [String] client_id 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + # @param [String] client_id 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Kick] - def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_kick( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/kick' api_params = { @@ -1280,7 +1421,7 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1294,17 +1435,20 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Kick ) - end # Update the project OAuth2 Linkedin configuration. # - # @param [String] client_id 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + # @param [String] client_id 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Linkedin] - def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: nil) + def update_o_auth2_linkedin( + client_id: nil, + primary_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/linkedin' api_params = { @@ -1312,7 +1456,7 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: primaryClientSecret: primary_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1326,18 +1470,22 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: params: api_params, response_type: Models::OAuth2Linkedin ) - end # Update the project OAuth2 Microsoft configuration. # - # @param [String] application_id 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - # @param [String] tenant Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + # @param [String] application_id 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + # @param [String] tenant Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Microsoft] - def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenant: nil, enabled: nil) + def update_o_auth2_microsoft( + application_id: nil, + application_secret: nil, + tenant: nil, + enabled: nil + ) api_path = '/project/oauth2/microsoft' api_params = { @@ -1346,7 +1494,7 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan tenant: tenant, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1360,17 +1508,20 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan params: api_params, response_type: Models::OAuth2Microsoft ) - end # Update the project OAuth2 Notion configuration. # - # @param [String] oauth_client_id 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + # @param [String] oauth_client_id 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Notion] - def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enabled: nil) + def update_o_auth2_notion( + oauth_client_id: nil, + oauth_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/notion' api_params = { @@ -1378,7 +1529,7 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable oauthClientSecret: oauth_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1392,23 +1543,32 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable params: api_params, response_type: Models::OAuth2Notion ) - end # Update the project OAuth2 Oidc configuration. # - # @param [String] client_id 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + # @param [String] client_id 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV # @param [String] well_known_url OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration # @param [String] authorization_url OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize # @param [String] token_url OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token # @param [String] user_info_url OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - # @param [Array] prompt Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + # @param [Array] prompt Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. # @param [Integer] max_age Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds, otherwise they are prompted to re-authenticate. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Oidc] - def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, authorization_url: nil, token_url: nil, user_info_url: nil, prompt: nil, max_age: nil, enabled: nil) + def update_o_auth2_oidc( + client_id: nil, + client_secret: nil, + well_known_url: nil, + authorization_url: nil, + token_url: nil, + user_info_url: nil, + prompt: nil, + max_age: nil, + enabled: nil + ) api_path = '/project/oauth2/oidc' api_params = { @@ -1422,7 +1582,7 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, maxAge: max_age, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1436,19 +1596,24 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, params: api_params, response_type: Models::OAuth2Oidc ) - end # Update the project OAuth2 Okta configuration. # - # @param [String] client_id 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + # @param [String] client_id 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV # @param [String] domain Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ # @param [String] authorization_server_id Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Okta] - def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authorization_server_id: nil, enabled: nil) + def update_o_auth2_okta( + client_id: nil, + client_secret: nil, + domain: nil, + authorization_server_id: nil, + enabled: nil + ) api_path = '/project/oauth2/okta' api_params = { @@ -1458,7 +1623,7 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori authorizationServerId: authorization_server_id, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1472,17 +1637,20 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori params: api_params, response_type: Models::OAuth2Okta ) - end # Update the project OAuth2 Paypal configuration. # - # @param [String] client_id 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + # @param [String] client_id 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] - def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) + def update_o_auth2_paypal( + client_id: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/paypal' api_params = { @@ -1490,7 +1658,7 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1504,17 +1672,20 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Paypal ) - end # Update the project OAuth2 PaypalSandbox configuration. # - # @param [String] client_id 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + # @param [String] client_id 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] - def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) + def update_o_auth2_paypal_sandbox( + client_id: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/paypalSandbox' api_params = { @@ -1522,7 +1693,7 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1536,17 +1707,20 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Paypal ) - end # Update the project OAuth2 Podio configuration. # - # @param [String] client_id 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + # @param [String] client_id 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Podio] - def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_podio( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/podio' api_params = { @@ -1554,7 +1728,7 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1568,17 +1742,20 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Podio ) - end # Update the project OAuth2 Salesforce configuration. # - # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Salesforce] - def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: nil) + def update_o_auth2_salesforce( + customer_key: nil, + customer_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/salesforce' api_params = { @@ -1586,7 +1763,7 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: customerSecret: customer_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1600,17 +1777,20 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: params: api_params, response_type: Models::OAuth2Salesforce ) - end # Update the project OAuth2 Slack configuration. # - # @param [String] client_id 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + # @param [String] client_id 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Slack] - def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_slack( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/slack' api_params = { @@ -1618,7 +1798,7 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1632,17 +1812,20 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Slack ) - end # Update the project OAuth2 Spotify configuration. # - # @param [String] client_id 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + # @param [String] client_id 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Spotify] - def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_spotify( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/spotify' api_params = { @@ -1650,7 +1833,7 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1664,17 +1847,20 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Spotify ) - end # Update the project OAuth2 Stripe configuration. # - # @param [String] client_id 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + # @param [String] client_id 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Stripe] - def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) + def update_o_auth2_stripe( + client_id: nil, + api_secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/stripe' api_params = { @@ -1682,7 +1868,7 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) apiSecretKey: api_secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1696,17 +1882,20 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Stripe ) - end # Update the project OAuth2 Tradeshift configuration. # - # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] - def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, enabled: nil) + def update_o_auth2_tradeshift( + oauth2_client_id: nil, + oauth2_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/tradeshift' api_params = { @@ -1714,7 +1903,7 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, oauth2ClientSecret: oauth2_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1728,17 +1917,20 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, params: api_params, response_type: Models::OAuth2Tradeshift ) - end # Update the project OAuth2 Tradeshift Sandbox configuration. # - # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] - def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secret: nil, enabled: nil) + def update_o_auth2_tradeshift_sandbox( + oauth2_client_id: nil, + oauth2_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/tradeshiftBox' api_params = { @@ -1746,7 +1938,7 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre oauth2ClientSecret: oauth2_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1760,17 +1952,20 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre params: api_params, response_type: Models::OAuth2Tradeshift ) - end # Update the project OAuth2 Twitch configuration. # - # @param [String] client_id 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + # @param [String] client_id 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Twitch] - def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_twitch( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/twitch' api_params = { @@ -1778,7 +1973,7 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1792,17 +1987,20 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Twitch ) - end # Update the project OAuth2 WordPress configuration. # - # @param [String] client_id 'Client ID' of WordPress OAuth2 app. For example: 130005 - # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + # @param [String] client_id 'Client ID' of WordPress OAuth2 app. For example: 130005 + # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2WordPress] - def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_word_press( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/wordpress' api_params = { @@ -1810,7 +2008,7 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1824,17 +2022,20 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2WordPress ) - end # Update the project OAuth2 X configuration. # - # @param [String] customer_key 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + # @param [String] customer_key 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2X] - def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) + def update_o_auth2_x( + customer_key: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/x' api_params = { @@ -1842,7 +2043,7 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1856,17 +2057,20 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2X ) - end # Update the project OAuth2 Yahoo configuration. # - # @param [String] client_id 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + # @param [String] client_id 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yahoo] - def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_yahoo( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/yahoo' api_params = { @@ -1874,7 +2078,7 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1888,17 +2092,20 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Yahoo ) - end # Update the project OAuth2 Yandex configuration. # - # @param [String] client_id 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + # @param [String] client_id 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yandex] - def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_yandex( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/yandex' api_params = { @@ -1906,7 +2113,7 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1920,17 +2127,20 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Yandex ) - end # Update the project OAuth2 Zoho configuration. # - # @param [String] client_id 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + # @param [String] client_id 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoho] - def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_zoho( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/zoho' api_params = { @@ -1938,7 +2148,7 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1952,17 +2162,20 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Zoho ) - end # Update the project OAuth2 Zoom configuration. # - # @param [String] client_id 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + # @param [String] client_id 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoom] - def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_zoom( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/zoom' api_params = { @@ -1970,7 +2183,7 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1984,7 +2197,6 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Zoom ) - end # Get a single OAuth2 provider configuration. Credential fields (client @@ -1992,18 +2204,19 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) # # @param [ProjectOAuthProviderId] provider_id OAuth2 provider key. For example: github, google, apple. # - # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] - def get_o_auth2_provider(provider_id:) + # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] + def get_o_auth2_provider( + provider_id: + ) api_path = '/project/oauth2/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2135,6 +2348,11 @@ def get_o_auth2_provider(provider_id:) return Models::OAuth2Yahoo.from(map: response) end + if response['$id'] == 'huggingface' + + return Models::OAuth2HuggingFace.from(map: response) + end + if response['$id'] == 'linkedin' return Models::OAuth2Linkedin.from(map: response) @@ -2221,7 +2439,6 @@ def get_o_auth2_provider(provider_id:) end raise Exception, "Unable to match response to any expected response model" - end # Get a list of all platforms in the project. This endpoint returns an array @@ -2231,14 +2448,17 @@ def get_o_auth2_provider(provider_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [PlatformList] - def list_platforms(queries: nil, total: nil) + def list_platforms( + queries: nil, + total: nil + ) api_path = '/project/platforms' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2251,31 +2471,34 @@ def list_platforms(queries: nil, total: nil) params: api_params, response_type: Models::PlatformList ) - end # Create a new Android platform for your project. Use this endpoint to # register a new Android platform where your users will run your application # which will interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] application_id Android application ID. Max length: 256 chars. # # @return [PlatformAndroid] - def create_android_platform(platform_id:, name:, application_id:) + def create_android_platform( + platform_id:, + name:, + application_id: + ) api_path = '/project/platforms/android' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if application_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "applicationId"') + raise Appwrite::Exception.new('Missing required parameter: "applicationId"') end api_params = { @@ -2283,7 +2506,7 @@ def create_android_platform(platform_id:, name:, application_id:) name: name, applicationId: application_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2297,38 +2520,41 @@ def create_android_platform(platform_id:, name:, application_id:) params: api_params, response_type: Models::PlatformAndroid ) - end # Update an Android platform by its unique ID. Use this endpoint to update - # the platform's name or application ID. + # the platform's name or application ID. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] application_id Android application ID. Max length: 256 chars. # # @return [PlatformAndroid] - def update_android_platform(platform_id:, name:, application_id:) + def update_android_platform( + platform_id:, + name:, + application_id: + ) api_path = '/project/platforms/android/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if application_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "applicationId"') + raise Appwrite::Exception.new('Missing required parameter: "applicationId"') end api_params = { name: name, applicationId: application_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2342,31 +2568,34 @@ def update_android_platform(platform_id:, name:, application_id:) params: api_params, response_type: Models::PlatformAndroid ) - end # Create a new Apple platform for your project. Use this endpoint to register # a new Apple platform where your users will run your application which will # interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] bundle_identifier Apple bundle identifier. Max length: 256 chars. # # @return [PlatformApple] - def create_apple_platform(platform_id:, name:, bundle_identifier:) + def create_apple_platform( + platform_id:, + name:, + bundle_identifier: + ) api_path = '/project/platforms/apple' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if bundle_identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') + raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') end api_params = { @@ -2374,7 +2603,7 @@ def create_apple_platform(platform_id:, name:, bundle_identifier:) name: name, bundleIdentifier: bundle_identifier, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2388,38 +2617,41 @@ def create_apple_platform(platform_id:, name:, bundle_identifier:) params: api_params, response_type: Models::PlatformApple ) - end # Update an Apple platform by its unique ID. Use this endpoint to update the - # platform's name or bundle identifier. + # platform's name or bundle identifier. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] bundle_identifier Apple bundle identifier. Max length: 256 chars. # # @return [PlatformApple] - def update_apple_platform(platform_id:, name:, bundle_identifier:) + def update_apple_platform( + platform_id:, + name:, + bundle_identifier: + ) api_path = '/project/platforms/apple/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if bundle_identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') + raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') end api_params = { name: name, bundleIdentifier: bundle_identifier, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2433,31 +2665,34 @@ def update_apple_platform(platform_id:, name:, bundle_identifier:) params: api_params, response_type: Models::PlatformApple ) - end # Create a new Linux platform for your project. Use this endpoint to register # a new Linux platform where your users will run your application which will # interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_name Linux package name. Max length: 256 chars. # # @return [PlatformLinux] - def create_linux_platform(platform_id:, name:, package_name:) + def create_linux_platform( + platform_id:, + name:, + package_name: + ) api_path = '/project/platforms/linux' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageName"') + raise Appwrite::Exception.new('Missing required parameter: "packageName"') end api_params = { @@ -2465,7 +2700,7 @@ def create_linux_platform(platform_id:, name:, package_name:) name: name, packageName: package_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2479,38 +2714,41 @@ def create_linux_platform(platform_id:, name:, package_name:) params: api_params, response_type: Models::PlatformLinux ) - end # Update a Linux platform by its unique ID. Use this endpoint to update the - # platform's name or package name. + # platform's name or package name. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_name Linux package name. Max length: 256 chars. # # @return [PlatformLinux] - def update_linux_platform(platform_id:, name:, package_name:) + def update_linux_platform( + platform_id:, + name:, + package_name: + ) api_path = '/project/platforms/linux/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageName"') + raise Appwrite::Exception.new('Missing required parameter: "packageName"') end api_params = { name: name, packageName: package_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2524,31 +2762,34 @@ def update_linux_platform(platform_id:, name:, package_name:) params: api_params, response_type: Models::PlatformLinux ) - end # Create a new web platform for your project. Use this endpoint to register a # new platform where your users will run your application which will interact # with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] hostname Platform web hostname. Max length: 256 chars. # # @return [PlatformWeb] - def create_web_platform(platform_id:, name:, hostname:) + def create_web_platform( + platform_id:, + name:, + hostname: + ) api_path = '/project/platforms/web' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if hostname.nil? - raise Appwrite::Exception.new('Missing required parameter: "hostname"') + raise Appwrite::Exception.new('Missing required parameter: "hostname"') end api_params = { @@ -2556,7 +2797,7 @@ def create_web_platform(platform_id:, name:, hostname:) name: name, hostname: hostname, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2570,38 +2811,41 @@ def create_web_platform(platform_id:, name:, hostname:) params: api_params, response_type: Models::PlatformWeb ) - end # Update a web platform by its unique ID. Use this endpoint to update the - # platform's name or hostname. + # platform's name or hostname. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] hostname Platform web hostname. Max length: 256 chars. # # @return [PlatformWeb] - def update_web_platform(platform_id:, name:, hostname:) + def update_web_platform( + platform_id:, + name:, + hostname: + ) api_path = '/project/platforms/web/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if hostname.nil? - raise Appwrite::Exception.new('Missing required parameter: "hostname"') + raise Appwrite::Exception.new('Missing required parameter: "hostname"') end api_params = { name: name, hostname: hostname, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2615,31 +2859,34 @@ def update_web_platform(platform_id:, name:, hostname:) params: api_params, response_type: Models::PlatformWeb ) - end # Create a new Windows platform for your project. Use this endpoint to # register a new Windows platform where your users will run your application # which will interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_identifier_name Windows package identifier name. Max length: 256 chars. # # @return [PlatformWindows] - def create_windows_platform(platform_id:, name:, package_identifier_name:) + def create_windows_platform( + platform_id:, + name:, + package_identifier_name: + ) api_path = '/project/platforms/windows' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_identifier_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') + raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') end api_params = { @@ -2647,7 +2894,7 @@ def create_windows_platform(platform_id:, name:, package_identifier_name:) name: name, packageIdentifierName: package_identifier_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2661,38 +2908,41 @@ def create_windows_platform(platform_id:, name:, package_identifier_name:) params: api_params, response_type: Models::PlatformWindows ) - end # Update a Windows platform by its unique ID. Use this endpoint to update the - # platform's name or package identifier name. + # platform's name or package identifier name. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_identifier_name Windows package identifier name. Max length: 256 chars. # # @return [PlatformWindows] - def update_windows_platform(platform_id:, name:, package_identifier_name:) + def update_windows_platform( + platform_id:, + name:, + package_identifier_name: + ) api_path = '/project/platforms/windows/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_identifier_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') + raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') end api_params = { name: name, packageIdentifierName: package_identifier_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2706,26 +2956,26 @@ def update_windows_platform(platform_id:, name:, package_identifier_name:) params: api_params, response_type: Models::PlatformWindows ) - end - # Get a platform by its unique ID. This endpoint returns the platform's + # Get a platform by its unique ID. This endpoint returns the platform's # details, including its name, type, and key configurations. # # @param [String] platform_id Platform ID. # # @return [PlatformWeb, PlatformApple, PlatformAndroid, PlatformWindows, PlatformLinux] - def get_platform(platform_id:) + def get_platform( + platform_id: + ) api_path = '/project/platforms/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2768,7 +3018,6 @@ def get_platform(platform_id:) end raise Exception, "Unable to match response to any expected response model" - end # Delete a platform by its unique ID. This endpoint removes the platform and @@ -2777,17 +3026,18 @@ def get_platform(platform_id:) # @param [String] platform_id Platform ID. # # @return [] - def delete_platform(platform_id:) + def delete_platform( + platform_id: + ) api_path = '/project/platforms/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2799,7 +3049,6 @@ def delete_platform(platform_id:) headers: api_headers, params: api_params, ) - end # Get a list of all project policies and their current configuration. @@ -2808,14 +3057,17 @@ def delete_platform(platform_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [PolicyList] - def list_policies(queries: nil, total: nil) + def list_policies( + queries: nil, + total: nil + ) api_path = '/project/policies' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2828,7 +3080,6 @@ def list_policies(queries: nil, total: nil) params: api_params, response_type: Models::PolicyList ) - end # Configures if aliased emails such as subaddresses and emails with suffixes @@ -2837,17 +3088,19 @@ def list_policies(queries: nil, total: nil) # @param [] enabled Set whether or not to block aliased emails during signup and email updates. # # @return [Project] - def update_deny_aliased_email_policy(enabled:) + def update_deny_aliased_email_policy( + enabled: + ) api_path = '/project/policies/deny-aliased-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2861,7 +3114,6 @@ def update_deny_aliased_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if only corporate email addresses (non-free and non-disposable @@ -2870,17 +3122,19 @@ def update_deny_aliased_email_policy(enabled:) # @param [] enabled Set whether or not to restrict sign-ups and email updates to corporate email addresses only. # # @return [Project] - def update_deny_corporate_email_policy(enabled:) + def update_deny_corporate_email_policy( + enabled: + ) api_path = '/project/policies/deny-corporate-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2894,7 +3148,6 @@ def update_deny_corporate_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if disposable emails from known temporary domains are denied @@ -2903,17 +3156,19 @@ def update_deny_corporate_email_policy(enabled:) # @param [] enabled Set whether or not to block disposable email addresses during signup and email updates. # # @return [Project] - def update_deny_disposable_email_policy(enabled:) + def update_deny_disposable_email_policy( + enabled: + ) api_path = '/project/policies/deny-disposable-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2927,7 +3182,6 @@ def update_deny_disposable_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if emails from free providers such as Gmail or Yahoo are denied @@ -2936,17 +3190,19 @@ def update_deny_disposable_email_policy(enabled:) # @param [] enabled Set whether or not to block free email addresses during signup and email updates. # # @return [Project] - def update_deny_free_email_policy(enabled:) + def update_deny_free_email_policy( + enabled: + ) api_path = '/project/policies/deny-free-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2960,7 +3216,6 @@ def update_deny_free_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if team members can see other @@ -2975,7 +3230,14 @@ def update_deny_free_email_policy(enabled:) # @param [] user_accessed_at Set to true if you want make user last access time visible to all team members, or false to hide it. # # @return [Project] - def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: nil, user_name: nil, user_mfa: nil, user_accessed_at: nil) + def update_membership_privacy_policy( + user_id: nil, + user_email: nil, + user_phone: nil, + user_name: nil, + user_mfa: nil, + user_accessed_at: nil + ) api_path = '/project/policies/membership-privacy' api_params = { @@ -2986,7 +3248,7 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: userMFA: user_mfa, userAccessedAt: user_accessed_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3000,7 +3262,6 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control which factors users can use to @@ -3015,7 +3276,12 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: # @param [] custom Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. # # @return [Project] - def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) + def update_mfa_factors_policy( + totp: nil, + email: nil, + phone: nil, + custom: nil + ) api_path = '/project/policies/mfa-factors' api_params = { @@ -3024,7 +3290,7 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) phone: phone, custom: custom, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3038,7 +3304,6 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if new passwords are checked @@ -3048,17 +3313,19 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) # @param [] enabled Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. # # @return [Project] - def update_password_dictionary_policy(enabled:) + def update_password_dictionary_policy( + enabled: + ) api_path = '/project/policies/password-dictionary' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3072,14 +3339,13 @@ def update_password_dictionary_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Updates one of password strength policies. Based on total length # configured, previous password hashes are stored, and users cannot choose a # new password that is already stored in the passwird history list, when # updating an user password, or setting new one through password recovery. - # + # # Keep in mind, while password history policy is disabled, the history is not # being stored. Enabling the policy will not have any history on existing # users, and it will only start to collect and enforce the policy on password @@ -3088,17 +3354,19 @@ def update_password_dictionary_policy(enabled:) # @param [Integer] total Set the password history length per user. Value can be between 1 and 20, or null to disable the limit. # # @return [Project] - def update_password_history_policy(total:) + def update_password_history_policy( + total: + ) api_path = '/project/policies/password-history' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3112,7 +3380,6 @@ def update_password_history_policy(total:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if password strength is checked @@ -3120,20 +3387,22 @@ def update_password_history_policy(total:) # password, the password must not contain user ID, name, email or phone # number. # - # @param [] enabled Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + # @param [] enabled Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. # # @return [Project] - def update_password_personal_data_policy(enabled:) + def update_password_personal_data_policy( + enabled: + ) api_path = '/project/policies/password-personal-data' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3147,7 +3416,6 @@ def update_password_personal_data_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update the password strength requirements for users in the project. @@ -3159,7 +3427,13 @@ def update_password_personal_data_policy(enabled:) # @param [] symbols Whether passwords must include at least one symbol. # # @return [PolicyPasswordStrength] - def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, number: nil, symbols: nil) + def update_password_strength_policy( + min: nil, + uppercase: nil, + lowercase: nil, + number: nil, + symbols: nil + ) api_path = '/project/policies/password-strength' api_params = { @@ -3169,7 +3443,7 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu number: number, symbols: symbols, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3183,7 +3457,6 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu params: api_params, response_type: Models::PolicyPasswordStrength ) - end # Updating this policy allows you to control if email alert is sent upon @@ -3195,17 +3468,19 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu # @param [] enabled Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. # # @return [Project] - def update_session_alert_policy(enabled:) + def update_session_alert_policy( + enabled: + ) api_path = '/project/policies/session-alert' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3219,7 +3494,6 @@ def update_session_alert_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update maximum duration how long sessions created within a project should @@ -3228,17 +3502,19 @@ def update_session_alert_policy(enabled:) # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds. # # @return [Project] - def update_session_duration_policy(duration:) + def update_session_duration_policy( + duration: + ) api_path = '/project/policies/session-duration' if duration.nil? - raise Appwrite::Exception.new('Missing required parameter: "duration"') + raise Appwrite::Exception.new('Missing required parameter: "duration"') end api_params = { duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3252,7 +3528,6 @@ def update_session_duration_policy(duration:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if existing sessions should be @@ -3262,17 +3537,19 @@ def update_session_duration_policy(duration:) # @param [] enabled Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. # # @return [Project] - def update_session_invalidation_policy(enabled:) + def update_session_invalidation_policy( + enabled: + ) api_path = '/project/policies/session-invalidation' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3286,7 +3563,6 @@ def update_session_invalidation_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update the maximum number of sessions allowed per user. When the limit is @@ -3295,17 +3571,19 @@ def update_session_invalidation_policy(enabled:) # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 100. # # @return [Project] - def update_session_limit_policy(total:) + def update_session_limit_policy( + total: + ) api_path = '/project/policies/session-limit' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3319,7 +3597,6 @@ def update_session_limit_policy(total:) params: api_params, response_type: Models::Project ) - end # Update the maximum number of users in the project. When the limit is hit or @@ -3329,17 +3606,19 @@ def update_session_limit_policy(total:) # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit. # # @return [Project] - def update_user_limit_policy(total:) + def update_user_limit_policy( + total: + ) api_path = '/project/policies/user-limit' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3353,7 +3632,6 @@ def update_user_limit_policy(total:) params: api_params, response_type: Models::Project ) - end # Get a policy by its unique ID. This endpoint returns the current @@ -3362,17 +3640,18 @@ def update_user_limit_policy(total:) # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. # # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail] - def get_policy(policy_id:) + def get_policy( + policy_id: + ) api_path = '/project/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3465,32 +3744,34 @@ def get_policy(policy_id:) end raise Exception, "Unable to match response to any expected response model" - end # Update properties of a specific protocol. Use this endpoint to enable or - # disable a protocol in your project. + # disable a protocol in your project. # # @param [ProjectProtocolId] protocol_id Protocol name. Can be one of: rest, graphql, websocket # @param [] enabled Protocol status. # # @return [Project] - def update_protocol(protocol_id:, enabled:) + def update_protocol( + protocol_id:, + enabled: + ) api_path = '/project/protocols/{protocolId}' .gsub('{protocolId}', protocol_id) if protocol_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "protocolId"') + raise Appwrite::Exception.new('Missing required parameter: "protocolId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3504,32 +3785,34 @@ def update_protocol(protocol_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Update properties of a specific service. Use this endpoint to enable or - # disable a service in your project. + # disable a service in your project. # # @param [ProjectServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 # @param [] enabled Service status. # # @return [Project] - def update_service(service_id:, enabled:) + def update_service( + service_id:, + enabled: + ) api_path = '/project/services/{serviceId}' .gsub('{serviceId}', service_id) if service_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "serviceId"') + raise Appwrite::Exception.new('Missing required parameter: "serviceId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3543,11 +3826,10 @@ def update_service(service_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Update the SMTP configuration for your project. Use this endpoint to - # configure your project's SMTP provider with your custom settings for + # configure your project's SMTP provider with your custom settings for # sending transactional emails. # # @param [String] host SMTP server hostname (domain) @@ -3562,7 +3844,18 @@ def update_service(service_id:, enabled:) # @param [] enabled Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. # # @return [Project] - def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email: nil, sender_name: nil, reply_to_email: nil, reply_to_name: nil, secure: nil, enabled: nil) + def update_smtp( + host: nil, + port: nil, + username: nil, + password: nil, + sender_email: nil, + sender_name: nil, + reply_to_email: nil, + reply_to_name: nil, + secure: nil, + enabled: nil + ) api_path = '/project/smtp' api_params = { @@ -3577,7 +3870,7 @@ def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email secure: secure, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3591,25 +3884,26 @@ def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email params: api_params, response_type: Models::Project ) - end - # Send a test email to verify SMTP configuration. + # Send a test email to verify SMTP configuration. # # @param [Array] emails Array of emails to send test email to. Maximum of 10 emails are allowed. # # @return [] - def create_smtp_test(emails:) + def create_smtp_test( + emails: + ) api_path = '/project/smtp/tests' if emails.nil? - raise Appwrite::Exception.new('Missing required parameter: "emails"') + raise Appwrite::Exception.new('Missing required parameter: "emails"') end api_params = { emails: emails, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3621,7 +3915,6 @@ def create_smtp_test(emails:) headers: api_headers, params: api_params, ) - end # Get a list of all custom email templates configured for the project. This @@ -3632,14 +3925,17 @@ def create_smtp_test(emails:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [EmailTemplateList] - def list_email_templates(queries: nil, total: nil) + def list_email_templates( + queries: nil, + total: nil + ) api_path = '/project/templates/email' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3652,7 +3948,6 @@ def list_email_templates(queries: nil, total: nil) params: api_params, response_type: Models::EmailTemplateList ) - end # Update a custom email template for the specified locale and type. Use this @@ -3668,11 +3963,20 @@ def list_email_templates(queries: nil, total: nil) # @param [String] reply_to_name Reply to name. # # @return [EmailTemplate] - def update_email_template(template_id:, locale: nil, subject: nil, message: nil, sender_name: nil, sender_email: nil, reply_to_email: nil, reply_to_name: nil) + def update_email_template( + template_id:, + locale: nil, + subject: nil, + message: nil, + sender_name: nil, + sender_email: nil, + reply_to_email: nil, + reply_to_name: nil + ) api_path = '/project/templates/email' if template_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "templateId"') + raise Appwrite::Exception.new('Missing required parameter: "templateId"') end api_params = { @@ -3685,7 +3989,7 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, replyToEmail: reply_to_email, replyToName: reply_to_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3699,7 +4003,6 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, params: api_params, response_type: Models::EmailTemplate ) - end # Get a custom email template for the specified locale and type. This @@ -3710,18 +4013,21 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, # @param [ProjectEmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. # # @return [EmailTemplate] - def get_email_template(template_id:, locale: nil) + def get_email_template( + template_id:, + locale: nil + ) api_path = '/project/templates/email/{templateId}' .gsub('{templateId}', template_id) if template_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "templateId"') + raise Appwrite::Exception.new('Missing required parameter: "templateId"') end api_params = { locale: locale, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3734,7 +4040,6 @@ def get_email_template(template_id:, locale: nil) params: api_params, response_type: Models::EmailTemplate ) - end # Get a list of all project environment variables. @@ -3743,14 +4048,17 @@ def get_email_template(template_id:, locale: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(queries: nil, total: nil) + def list_variables( + queries: nil, + total: nil + ) api_path = '/project/variables' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3763,31 +4071,35 @@ def list_variables(queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new project environment variable. These variables can be accessed # by all functions and sites in the project. # - # @param [String] variable_id Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime. # # @return [Variable] - def create_variable(variable_id:, key:, value:, secret: nil) + def create_variable( + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/project/variables' if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -3796,7 +4108,7 @@ def create_variable(variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3810,25 +4122,25 @@ def create_variable(variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end - # Get a variable by its unique ID. + # Get a variable by its unique ID. # # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(variable_id:) + def get_variable( + variable_id: + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3841,23 +4153,27 @@ def get_variable(variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime. # # @return [Variable] - def update_variable(variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -3865,7 +4181,7 @@ def update_variable(variable_id:, key: nil, value: nil, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3879,25 +4195,25 @@ def update_variable(variable_id:, key: nil, value: nil, secret: nil) params: api_params, response_type: Models::Variable ) - end - # Delete a variable by its unique ID. + # Delete a variable by its unique ID. # # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(variable_id:) + def delete_variable( + variable_id: + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3909,8 +4225,6 @@ def delete_variable(variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/proxy.rb b/lib/appwrite/services/proxy.rb index 206c395a..48d11c6d 100644 --- a/lib/appwrite/services/proxy.rb +++ b/lib/appwrite/services/proxy.rb @@ -1,15 +1,14 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Proxy < Service - def initialize(client) @client = client end # Create a new CDN cache invalidation for a domain. Executes a hard purge of # cached content. - # + # # Depending on type, the invalidation purges a single cache tag, a single URL # path, or all cached content for the domain. # @@ -18,15 +17,19 @@ def initialize(client) # @param [String] reference Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. # # @return [ProxyInvalidation] - def create_invalidation(domain:, type:, reference: nil) + def create_invalidation( + domain:, + type:, + reference: nil + ) api_path = '/proxy/invalidations' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -34,7 +37,7 @@ def create_invalidation(domain:, type:, reference: nil) type: type, reference: reference, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -48,7 +51,6 @@ def create_invalidation(domain:, type:, reference: nil) params: api_params, response_type: Models::ProxyInvalidation ) - end # Get a list of all the proxy rules. You can use the query params to filter @@ -58,14 +60,17 @@ def create_invalidation(domain:, type:, reference: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProxyRuleList] - def list_rules(queries: nil, total: nil) + def list_rules( + queries: nil, + total: nil + ) api_path = '/proxy/rules' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -78,28 +83,29 @@ def list_rules(queries: nil, total: nil) params: api_params, response_type: Models::ProxyRuleList ) - end - # Create a new proxy rule for serving Appwrite's API on custom domain. - # + # Create a new proxy rule for serving Appwrite's API on custom domain. + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # # @param [String] domain Domain name. # # @return [ProxyRule] - def create_api_rule(domain:) + def create_api_rule( + domain: + ) api_path = '/proxy/rules/api' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end api_params = { domain: domain, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -113,11 +119,10 @@ def create_api_rule(domain:) params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for executing Appwrite Function on custom domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -126,15 +131,19 @@ def create_api_rule(domain:) # @param [String] branch Name of VCS branch to deploy changes automatically # # @return [ProxyRule] - def create_function_rule(domain:, function_id:, branch: nil) + def create_function_rule( + domain:, + function_id:, + branch: nil + ) api_path = '/proxy/rules/function' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -142,7 +151,7 @@ def create_function_rule(domain:, function_id:, branch: nil) functionId: function_id, branch: branch, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -156,12 +165,11 @@ def create_function_rule(domain:, function_id:, branch: nil) params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for to redirect from custom domain to another # domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -172,27 +180,33 @@ def create_function_rule(domain:, function_id:, branch: nil) # @param [ProxyResourceType] resource_type Type of parent resource. # # @return [ProxyRule] - def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_type:) + def create_redirect_rule( + domain:, + url:, + status_code:, + resource_id:, + resource_type: + ) api_path = '/proxy/rules/redirect' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if status_code.nil? - raise Appwrite::Exception.new('Missing required parameter: "statusCode"') + raise Appwrite::Exception.new('Missing required parameter: "statusCode"') end if resource_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "resourceId"') + raise Appwrite::Exception.new('Missing required parameter: "resourceId"') end if resource_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "resourceType"') + raise Appwrite::Exception.new('Missing required parameter: "resourceType"') end api_params = { @@ -202,7 +216,7 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ resourceId: resource_id, resourceType: resource_type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -216,11 +230,10 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for serving Appwrite Site on custom domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -229,15 +242,19 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ # @param [String] branch Name of VCS branch to deploy changes automatically # # @return [ProxyRule] - def create_site_rule(domain:, site_id:, branch: nil) + def create_site_rule( + domain:, + site_id:, + branch: nil + ) api_path = '/proxy/rules/site' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { @@ -245,7 +262,7 @@ def create_site_rule(domain:, site_id:, branch: nil) siteId: site_id, branch: branch, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -259,7 +276,6 @@ def create_site_rule(domain:, site_id:, branch: nil) params: api_params, response_type: Models::ProxyRule ) - end # Get a proxy rule by its unique ID. @@ -267,17 +283,18 @@ def create_site_rule(domain:, site_id:, branch: nil) # @param [String] rule_id Rule ID. # # @return [ProxyRule] - def get_rule(rule_id:) + def get_rule( + rule_id: + ) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -290,7 +307,6 @@ def get_rule(rule_id:) params: api_params, response_type: Models::ProxyRule ) - end # Delete a proxy rule by its unique ID. @@ -298,17 +314,18 @@ def get_rule(rule_id:) # @param [String] rule_id Rule ID. # # @return [] - def delete_rule(rule_id:) + def delete_rule( + rule_id: + ) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -320,7 +337,6 @@ def delete_rule(rule_id:) headers: api_headers, params: api_params, ) - end # If not succeeded yet, retry verification process of a proxy rule domain. @@ -331,17 +347,18 @@ def delete_rule(rule_id:) # @param [String] rule_id Rule ID. # # @return [ProxyRule] - def update_rule_status(rule_id:) + def update_rule_status( + rule_id: + ) api_path = '/proxy/rules/{ruleId}/status' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -355,8 +372,6 @@ def update_rule_status(rule_id:) params: api_params, response_type: Models::ProxyRule ) - end - - end + end end diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index b6028f09..8c191805 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Sites < Service - def initialize(client) @client = client end - # Get a list of all the project's sites. You can use the query params to + # Get a list of all the project's sites. You can use the query params to # filter your results. # # @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. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SiteList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/sites' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,16 +39,15 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::SiteList ) - end # Create a new site. # - # @param [String] site_id Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] site_id Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Site name. Max length: 128 chars. # @param [Framework] framework Sites framework. # @param [BuildRuntime] build_runtime Runtime to use during build step. - # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. # @param [Integer] timeout Maximum request time in seconds. # @param [String] install_command Install Command. @@ -64,25 +66,51 @@ def list(queries: nil, search: nil, total: nil) # @param [String] build_specification Build specification for the site deployments. # @param [String] runtime_specification Runtime specification for the SSR executions. # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + # @param [Array] scopes List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. # # @return [Site] - def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_command: nil, output_directory: nil, adapter: nil, installation_id: nil, fallback_file: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def create( + site_id:, + name:, + framework:, + build_runtime:, + enabled: nil, + logging: nil, + timeout: nil, + install_command: nil, + build_command: nil, + start_command: nil, + output_directory: nil, + adapter: nil, + installation_id: nil, + fallback_file: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil, + scopes: nil + ) api_path = '/sites' if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if framework.nil? - raise Appwrite::Exception.new('Missing required parameter: "framework"') + raise Appwrite::Exception.new('Missing required parameter: "framework"') end if build_runtime.nil? - raise Appwrite::Exception.new('Missing required parameter: "buildRuntime"') + raise Appwrite::Exception.new('Missing required parameter: "buildRuntime"') end api_params = { @@ -109,8 +137,9 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n buildSpecification: build_specification, runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, + scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -124,7 +153,6 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n params: api_params, response_type: Models::Site ) - end # Get a list of all frameworks that are currently available on the server @@ -135,9 +163,8 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n def list_frameworks() api_path = '/sites/frameworks' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -150,7 +177,6 @@ def list_frameworks() params: api_params, response_type: Models::FrameworkList ) - end # List allowed site specifications for this instance. @@ -158,13 +184,15 @@ def list_frameworks() # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] - def list_specifications(type: nil) + def list_specifications( + type: nil + ) api_path = '/sites/specifications' api_params = { type: type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -177,7 +205,6 @@ def list_specifications(type: nil) params: api_params, response_type: Models::SpecificationList ) - end # Get a site by its unique ID. @@ -185,17 +212,18 @@ def list_specifications(type: nil) # @param [String] site_id Site ID. # # @return [Site] - def get(site_id:) + def get( + site_id: + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -208,7 +236,6 @@ def get(site_id:) params: api_params, response_type: Models::Site ) - end # Update site by its unique ID. @@ -216,7 +243,7 @@ def get(site_id:) # @param [String] site_id Site ID. # @param [String] name Site name. Max length: 128 chars. # @param [Framework] framework Sites framework. - # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. # @param [Integer] timeout Maximum request time in seconds. # @param [String] install_command Install Command. @@ -236,22 +263,48 @@ def get(site_id:) # @param [String] build_specification Build specification for the site deployments. # @param [String] runtime_specification Runtime specification for the SSR executions. # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + # @param [Array] scopes List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. # # @return [Site] - def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_command: nil, output_directory: nil, build_runtime: nil, adapter: nil, fallback_file: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def update( + site_id:, + name:, + framework:, + enabled: nil, + logging: nil, + timeout: nil, + install_command: nil, + build_command: nil, + start_command: nil, + output_directory: nil, + build_runtime: nil, + adapter: nil, + fallback_file: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil, + scopes: nil + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if framework.nil? - raise Appwrite::Exception.new('Missing required parameter: "framework"') + raise Appwrite::Exception.new('Missing required parameter: "framework"') end api_params = { @@ -277,8 +330,9 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil buildSpecification: build_specification, runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, + scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -292,7 +346,6 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil params: api_params, response_type: Models::Site ) - end # Delete a site by its unique ID. @@ -300,17 +353,18 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil # @param [String] site_id Site ID. # # @return [] - def delete(site_id:) + def delete( + site_id: + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -322,7 +376,6 @@ def delete(site_id:) headers: api_headers, params: api_params, ) - end # Update the site active deployment. Use this endpoint to switch the code @@ -332,22 +385,25 @@ def delete(site_id:) # @param [String] deployment_id Deployment ID. # # @return [Site] - def update_site_deployment(site_id:, deployment_id:) + def update_site_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployment' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -361,10 +417,9 @@ def update_site_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Site ) - end - # Get a list of all the site's code deployments. You can use the query params + # Get a list of all the site's code deployments. You can use the query params # to filter your results. # # @param [String] site_id Site ID. @@ -373,12 +428,17 @@ def update_site_deployment(site_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DeploymentList] - def list_deployments(site_id:, queries: nil, search: nil, total: nil) + def list_deployments( + site_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/sites/{siteId}/deployments' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { @@ -386,7 +446,7 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -399,12 +459,11 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DeploymentList ) - end # Create a new site code deployment. Use this endpoint to upload a new - # version of your site code. To activate your newly uploaded code, you'll - # need to update the site's deployment to use your new deployment ID. + # version of your site code. To activate your newly uploaded code, you'll + # need to update the site's deployment to use your new deployment ID. # # @param [String] site_id Site ID. # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -414,16 +473,24 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_deployment(site_id:, code:, install_command: nil, build_command: nil, output_directory: nil, activate: nil, on_progress: nil) + def create_deployment( + site_id:, + code:, + install_command: nil, + build_command: nil, + output_directory: nil, + activate: nil, + on_progress: nil + ) api_path = '/sites/{siteId}/deployments' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -433,7 +500,7 @@ def create_deployment(site_id:, code:, install_command: nil, build_command: nil, code: code, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -452,35 +519,37 @@ def create_deployment(site_id:, code:, install_command: nil, build_command: nil, on_progress: on_progress, response_type: Models::Deployment ) - end # Create a new build for an existing site deployment. This endpoint allows # you to rebuild a deployment with the updated site configuration, including # its commands and output directory if they have been modified. The build # process will be queued and executed asynchronously. The original - # deployment's code will be preserved and used for the new build. + # deployment's code will be preserved and used for the new build. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def create_duplicate_deployment(site_id:, deployment_id:) + def create_duplicate_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/duplicate' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -494,11 +563,10 @@ def create_duplicate_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Create a deployment based on a template. - # + # # Use this endpoint with combination of # [listTemplates](https://appwrite.io/docs/products/sites/templates) to find # the template details. @@ -512,32 +580,40 @@ def create_duplicate_deployment(site_id:, deployment_id:) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_template_deployment(site_id:, repository:, owner:, root_directory:, type:, reference:, activate: nil) + def create_template_deployment( + site_id:, + repository:, + owner:, + root_directory:, + type:, + reference:, + activate: nil + ) api_path = '/sites/{siteId}/deployments/template' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if repository.nil? - raise Appwrite::Exception.new('Missing required parameter: "repository"') + raise Appwrite::Exception.new('Missing required parameter: "repository"') end if owner.nil? - raise Appwrite::Exception.new('Missing required parameter: "owner"') + raise Appwrite::Exception.new('Missing required parameter: "owner"') end if root_directory.nil? - raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') + raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -548,7 +624,7 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -562,11 +638,10 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t params: api_params, response_type: Models::Deployment ) - end # Create a deployment when a site is connected to VCS. - # + # # This endpoint lets you create deployment from a branch, commit, or a tag. # # @param [String] site_id Site ID. @@ -575,20 +650,25 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_vcs_deployment(site_id:, type:, reference:, activate: nil) + def create_vcs_deployment( + site_id:, + type:, + reference:, + activate: nil + ) api_path = '/sites/{siteId}/deployments/vcs' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -596,7 +676,7 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -610,7 +690,6 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) params: api_params, response_type: Models::Deployment ) - end # Get a site deployment by its unique ID. @@ -619,22 +698,24 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def get_deployment(site_id:, deployment_id:) + def get_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -647,7 +728,6 @@ def get_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Delete a site deployment by its unique ID. @@ -656,22 +736,24 @@ def get_deployment(site_id:, deployment_id:) # @param [String] deployment_id Deployment ID. # # @return [] - def delete_deployment(site_id:, deployment_id:) + def delete_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -683,37 +765,41 @@ def delete_deployment(site_id:, deployment_id:) headers: api_headers, params: api_params, ) - end # Get a site deployment content by its unique ID. The endpoint response - # return with a 'Content-Disposition: attachment' header that tells the + # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. - # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(site_id:, deployment_id:, type: nil, token: nil) + def get_deployment_download( + site_id:, + deployment_id:, + type: nil, + token: nil + ) api_path = '/sites/{siteId}/deployments/{deploymentId}/download' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { type: type, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -725,35 +811,36 @@ def get_deployment_download(site_id:, deployment_id:, type: nil, token: nil) headers: api_headers, params: api_params, ) - end # Cancel an ongoing site deployment build. If the build is already in - # progress, it will be stopped and marked as canceled. If the build hasn't + # progress, it will be stopped and marked as canceled. If the build hasn't # started yet, it will be marked as canceled without executing. You cannot - # cancel builds that have already completed (status 'ready') or failed. The + # cancel builds that have already completed (status 'ready') or failed. The # response includes the final build status and details. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def update_deployment_status(site_id:, deployment_id:) + def update_deployment_status( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}/status' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -767,7 +854,6 @@ def update_deployment_status(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Get a list of all site logs. You can use the query params to filter your @@ -778,19 +864,23 @@ def update_deployment_status(site_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ExecutionList] - def list_logs(site_id:, queries: nil, total: nil) + def list_logs( + site_id:, + queries: nil, + total: nil + ) api_path = '/sites/{siteId}/logs' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -803,7 +893,6 @@ def list_logs(site_id:, queries: nil, total: nil) params: api_params, response_type: Models::ExecutionList ) - end # Get a site request log by its unique ID. @@ -812,22 +901,24 @@ def list_logs(site_id:, queries: nil, total: nil) # @param [String] log_id Log ID. # # @return [Execution] - def get_log(site_id:, log_id:) + def get_log( + site_id:, + log_id: + ) api_path = '/sites/{siteId}/logs/{logId}' .gsub('{siteId}', site_id) .gsub('{logId}', log_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if log_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "logId"') + raise Appwrite::Exception.new('Missing required parameter: "logId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -840,7 +931,6 @@ def get_log(site_id:, log_id:) params: api_params, response_type: Models::Execution ) - end # Delete a site log by its unique ID. @@ -849,22 +939,24 @@ def get_log(site_id:, log_id:) # @param [String] log_id Log ID. # # @return [] - def delete_log(site_id:, log_id:) + def delete_log( + site_id:, + log_id: + ) api_path = '/sites/{siteId}/logs/{logId}' .gsub('{siteId}', site_id) .gsub('{logId}', log_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if log_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "logId"') + raise Appwrite::Exception.new('Missing required parameter: "logId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -877,7 +969,6 @@ def delete_log(site_id:, log_id:) headers: api_headers, params: api_params, ) - end # Get a list of all variables of a specific site. @@ -887,19 +978,23 @@ def delete_log(site_id:, log_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(site_id:, queries: nil, total: nil) + def list_variables( + site_id:, + queries: nil, + total: nil + ) api_path = '/sites/{siteId}/variables' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -912,37 +1007,42 @@ def list_variables(site_id:, queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new site variable. These variables can be accessed during build # and runtime (server-side rendering) as environment variables. # # @param [String] site_id Site unique ID. - # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime. # # @return [Variable] - def create_variable(site_id:, variable_id:, key:, value:, secret: nil) + def create_variable( + site_id:, + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/sites/{siteId}/variables' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -951,7 +1051,7 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -965,7 +1065,6 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end # Get a variable by its unique ID. @@ -974,22 +1073,24 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(site_id:, variable_id:) + def get_variable( + site_id:, + variable_id: + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1002,29 +1103,34 @@ def get_variable(site_id:, variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] site_id Site unique ID. # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime. # # @return [Variable] - def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + site_id:, + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -1032,7 +1138,7 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1046,7 +1152,6 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) params: api_params, response_type: Models::Variable ) - end # Delete a variable by its unique ID. @@ -1055,22 +1160,24 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(site_id:, variable_id:) + def delete_variable( + site_id:, + variable_id: + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1082,8 +1189,6 @@ def delete_variable(site_id:, variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index 705617f1..18389d90 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Storage < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [BucketList] - def list_buckets(queries: nil, search: nil, total: nil) + def list_buckets( + queries: nil, + search: nil, + total: nil + ) api_path = '/storage/buckets' api_params = { @@ -23,7 +26,7 @@ def list_buckets(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,33 +39,44 @@ def list_buckets(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::BucketList ) - end # Create a new storage bucket. # - # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Bucket name # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 5GB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled # @param [] transformations Are image transformations enabled? # # @return [Bucket] - def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil, transformations: nil) + def create_bucket( + bucket_id:, + name:, + permissions: nil, + file_security: nil, + enabled: nil, + maximum_file_size: nil, + allowed_file_extensions: nil, + compression: nil, + encryption: nil, + antivirus: nil, + transformations: nil + ) api_path = '/storage/buckets' if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -78,7 +92,7 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl antivirus: antivirus, transformations: transformations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -92,7 +106,6 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl params: api_params, response_type: Models::Bucket ) - end # Get a storage bucket by its unique ID. This endpoint response returns a @@ -101,17 +114,18 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl # @param [String] bucket_id Bucket unique ID. # # @return [Bucket] - def get_bucket(bucket_id:) + def get_bucket( + bucket_id: + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -124,7 +138,6 @@ def get_bucket(bucket_id:) params: api_params, response_type: Models::Bucket ) - end # Update a storage bucket by its unique ID. @@ -133,25 +146,37 @@ def get_bucket(bucket_id:) # @param [String] name Bucket name # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 5GB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled # @param [] transformations Are image transformations enabled? # # @return [Bucket] - def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil, transformations: nil) + def update_bucket( + bucket_id:, + name:, + permissions: nil, + file_security: nil, + enabled: nil, + maximum_file_size: nil, + allowed_file_extensions: nil, + compression: nil, + encryption: nil, + antivirus: nil, + transformations: nil + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -166,7 +191,7 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl antivirus: antivirus, transformations: transformations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -180,7 +205,6 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl params: api_params, response_type: Models::Bucket ) - end # Delete a storage bucket by its unique ID. @@ -188,17 +212,18 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl # @param [String] bucket_id Bucket unique ID. # # @return [] - def delete_bucket(bucket_id:) + def delete_bucket( + bucket_id: + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -210,7 +235,6 @@ def delete_bucket(bucket_id:) headers: api_headers, params: api_params, ) - end # Get a list of all the user files. You can use the query params to filter @@ -222,12 +246,17 @@ def delete_bucket(bucket_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [FileList] - def list_files(bucket_id:, queries: nil, search: nil, total: nil) + def list_files( + bucket_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/storage/buckets/{bucketId}/files' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end api_params = { @@ -235,7 +264,7 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -248,49 +277,55 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::FileList ) - end # Create a new file. Before using this route, you should create a new bucket # resource using either a [server # integration](https://appwrite.io/docs/server/storage#storageCreateBucket) # API or directly from your Appwrite console. - # + # # Larger files should be uploaded using multiple requests with the # [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) # header to send a partial request with a maximum supported chunk of `5MB`. # The `content-range` header values should always be in bytes. - # + # # When the first request is sent, the server will return the **File** object, - # and the subsequent part request must include the file's **id** in + # and the subsequent part request must include the file's **id** in # `x-appwrite-id` header to allow the server to know that the partial upload # is for the existing file and not for a new one. - # - # If you're creating a new file using one of the Appwrite SDKs, all the + # + # If you're creating a new file using one of the Appwrite SDKs, all the # chunking logic will be managed by the SDK internally. - # + # # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. + # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. # # @return [File] - def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_progress: nil) + def create_file( + bucket_id:, + file_id:, + file:, + permissions: nil, + folder: nil, + on_progress: nil + ) api_path = '/storage/buckets/{bucketId}/files' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end if file.nil? - raise Appwrite::Exception.new('Missing required parameter: "file"') + raise Appwrite::Exception.new('Missing required parameter: "file"') end api_params = { @@ -299,7 +334,7 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p permissions: permissions, folder: folder, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -318,7 +353,6 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p on_progress: on_progress, response_type: Models::File ) - end # Get a file by its unique ID. This endpoint response returns a JSON object @@ -328,22 +362,24 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p # @param [String] file_id File ID. # # @return [File] - def get_file(bucket_id:, file_id:) + def get_file( + bucket_id:, + file_id: + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -356,7 +392,6 @@ def get_file(bucket_id:, file_id:) params: api_params, response_type: Models::File ) - end # Update a file by its unique ID. Only users with write permissions have @@ -368,24 +403,29 @@ def get_file(bucket_id:, file_id:) # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [File] - def update_file(bucket_id:, file_id:, name: nil, permissions: nil) + def update_file( + bucket_id:, + file_id:, + name: nil, + permissions: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { name: name, permissions: permissions, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -399,7 +439,6 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) params: api_params, response_type: Models::File ) - end # Delete a file by its unique ID. Only users with write permissions have @@ -409,22 +448,24 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) # @param [String] file_id File ID. # # @return [] - def delete_file(bucket_id:, file_id:) + def delete_file( + bucket_id:, + file_id: + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -436,11 +477,10 @@ def delete_file(bucket_id:, file_id:) headers: api_headers, params: api_params, ) - end # Get a file content by its unique ID. The endpoint response return with a - # 'Content-Disposition: attachment' header that tells the browser to start + # 'Content-Disposition: attachment' header that tells the browser to start # downloading the file to user downloads directory. # # @param [String] bucket_id Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). @@ -448,23 +488,27 @@ def delete_file(bucket_id:, file_id:) # @param [String] token File token for accessing this file. # # @return [] - def get_file_download(bucket_id:, file_id:, token: nil) + def get_file_download( + bucket_id:, + file_id:, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -476,7 +520,6 @@ def get_file_download(bucket_id:, file_id:, token: nil) headers: api_headers, params: api_params, ) - end # Get a file preview image. Currently, this method supports preview for image @@ -501,17 +544,32 @@ def get_file_download(bucket_id:, file_id:, token: nil) # @param [String] token File token for accessing this file. # # @return [] - def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil, token: nil) + def get_file_preview( + bucket_id:, + file_id:, + width: nil, + height: nil, + gravity: nil, + quality: nil, + border_width: nil, + border_color: nil, + border_radius: nil, + opacity: nil, + rotation: nil, + background: nil, + output: nil, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { @@ -528,7 +586,7 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil output: output, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -540,11 +598,10 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil headers: api_headers, params: api_params, ) - end # Get a file content by its unique ID. This endpoint is similar to the - # download method but returns with no 'Content-Disposition: attachment' + # download method but returns with no 'Content-Disposition: attachment' # header. # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). @@ -552,23 +609,27 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil # @param [String] token File token for accessing this file. # # @return [] - def get_file_view(bucket_id:, file_id:, token: nil) + def get_file_view( + bucket_id:, + file_id:, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -580,8 +641,6 @@ def get_file_view(bucket_id:, file_id:, token: nil) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index ed032867..ab1c72fa 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class TablesDB < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DatabaseList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/tablesdb' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,29 +39,35 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DatabaseList ) - end # Create a new Database. - # # - # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Database name. Max length: 128 chars. - # @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. + # @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. # @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. # @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. # @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. # # @return [Database] - def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) api_path = '/tablesdb' if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -69,7 +78,7 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, replicas: replicas, syncMode: sync_mode, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -83,7 +92,6 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, params: api_params, response_type: Models::Database ) - end # List the dedicated database specifications available on the current plan. @@ -95,9 +103,8 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, def list_specifications() api_path = '/tablesdb/specifications' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -110,7 +117,6 @@ def list_specifications() params: api_params, response_type: Models::DedicatedDatabaseSpecificationList ) - end # List transactions across all databases. @@ -118,13 +124,15 @@ def list_specifications() # @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). # # @return [TransactionList] - def list_transactions(queries: nil) + def list_transactions( + queries: nil + ) api_path = '/tablesdb/transactions' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -137,7 +145,6 @@ def list_transactions(queries: nil) params: api_params, response_type: Models::TransactionList ) - end # Create a new transaction. @@ -145,13 +152,15 @@ def list_transactions(queries: nil) # @param [Integer] ttl Seconds before the transaction expires. # # @return [Transaction] - def create_transaction(ttl: nil) + def create_transaction( + ttl: nil + ) api_path = '/tablesdb/transactions' api_params = { ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -165,7 +174,6 @@ def create_transaction(ttl: nil) params: api_params, response_type: Models::Transaction ) - end # Get a transaction by its unique ID. @@ -173,17 +181,18 @@ def create_transaction(ttl: nil) # @param [String] transaction_id Transaction ID. # # @return [Transaction] - def get_transaction(transaction_id:) + def get_transaction( + transaction_id: + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -196,7 +205,6 @@ def get_transaction(transaction_id:) params: api_params, response_type: Models::Transaction ) - end # Update a transaction, to either commit or roll back its operations. @@ -206,19 +214,23 @@ def get_transaction(transaction_id:) # @param [] rollback Rollback transaction? # # @return [Transaction] - def update_transaction(transaction_id:, commit: nil, rollback: nil) + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { commit: commit, rollback: rollback, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -232,7 +244,6 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) params: api_params, response_type: Models::Transaction ) - end # Delete a transaction by its unique ID. @@ -240,17 +251,18 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) # @param [String] transaction_id Transaction ID. # # @return [] - def delete_transaction(transaction_id:) + def delete_transaction( + transaction_id: + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -262,7 +274,6 @@ def delete_transaction(transaction_id:) headers: api_headers, params: api_params, ) - end # Create multiple operations in a single transaction. @@ -271,18 +282,21 @@ def delete_transaction(transaction_id:) # @param [Array] operations Array of staged operations. # # @return [Transaction] - def create_operations(transaction_id:, operations: nil) + def create_operations( + transaction_id:, + operations: nil + ) api_path = '/tablesdb/transactions/{transactionId}/operations' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { operations: operations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -296,7 +310,6 @@ def create_operations(transaction_id:, operations: nil) params: api_params, response_type: Models::Transaction ) - end # Get a database by its unique ID. This endpoint response returns a JSON @@ -305,17 +318,18 @@ def create_operations(transaction_id:, operations: nil) # @param [String] database_id Database ID. # # @return [Database] - def get(database_id:) + def get( + database_id: + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -328,25 +342,31 @@ def get(database_id:) params: api_params, response_type: Models::Database ) - end # Update a database by its unique ID. # # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. - # @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. + # @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. # @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. # @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. # @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. # # @return [Database] - def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) + def update( + database_id:, + name: nil, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -356,7 +376,7 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: replicas: replicas, syncMode: sync_mode, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -370,7 +390,6 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: params: api_params, response_type: Models::Database ) - end # Delete a database by its unique ID. Only API keys with with databases.write @@ -379,17 +398,18 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: # @param [String] database_id Database ID. # # @return [] - def delete(database_id:) + def delete( + database_id: + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -401,31 +421,37 @@ def delete(database_id:) headers: api_headers, params: api_params, ) - end # Trigger a manual failover for a dedicated database with high availability # enabled. Promotes a replica to primary. The failover runs asynchronously; # poll the database document for status updates. A database left - # mid-operation by a failover that did not finish also accepts this call as a - # repair, provided `targetReplicaId` names the member to promote. + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. # # @param [String] database_id Database ID. # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. # # @return [DedicatedDatabase] - def create_failover(database_id:, target_replica_id: nil) + def create_failover( + database_id:, + target_replica_id: nil + ) api_path = '/tablesdb/{databaseId}/failovers' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { targetReplicaId: target_replica_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -439,7 +465,6 @@ def create_failover(database_id:, target_replica_id: nil) params: api_params, response_type: Models::DedicatedDatabase ) - end # List the dedicated migrations for a TablesDB database. A database has at @@ -448,17 +473,18 @@ def create_failover(database_id:, target_replica_id: nil) # @param [String] database_id Database ID. # # @return [DatabaseMigrationList] - def list_migrations(database_id:) + def list_migrations( + database_id: + ) api_path = '/tablesdb/{databaseId}/migrations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -471,7 +497,6 @@ def list_migrations(database_id:) params: api_params, response_type: Models::DatabaseMigrationList ) - end # Start migrating a serverless TablesDB database onto a dedicated MySQL @@ -483,23 +508,27 @@ def list_migrations(database_id:) # @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. # # @return [DatabaseMigration] - def create_migration(database_id:, specification:, auto_cutover: nil) + def create_migration( + database_id:, + specification:, + auto_cutover: nil + ) api_path = '/tablesdb/{databaseId}/migrations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if specification.nil? - raise Appwrite::Exception.new('Missing required parameter: "specification"') + raise Appwrite::Exception.new('Missing required parameter: "specification"') end api_params = { specification: specification, autoCutover: auto_cutover, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -513,7 +542,6 @@ def create_migration(database_id:, specification:, auto_cutover: nil) params: api_params, response_type: Models::DatabaseMigration ) - end # Get a single dedicated migration for a TablesDB database by its ID. @@ -522,22 +550,24 @@ def create_migration(database_id:, specification:, auto_cutover: nil) # @param [String] migration_id Migration ID. # # @return [DatabaseMigration] - def get_migration(database_id:, migration_id:) + def get_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -550,7 +580,6 @@ def get_migration(database_id:, migration_id:) params: api_params, response_type: Models::DatabaseMigration ) - end # Abort an in-flight TablesDB dedicated migration. Only allowed before @@ -560,22 +589,24 @@ def get_migration(database_id:, migration_id:) # @param [String] migration_id Migration ID. # # @return [] - def delete_migration(database_id:, migration_id:) + def delete_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -588,7 +619,6 @@ def delete_migration(database_id:, migration_id:) headers: api_headers, params: api_params, ) - end # Cut a verified TablesDB migration over to its dedicated compute. Only @@ -602,22 +632,24 @@ def delete_migration(database_id:, migration_id:) # @param [String] migration_id Migration ID. # # @return [DatabaseMigration] - def cutover_migration(database_id:, migration_id:) + def cutover_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -631,7 +663,6 @@ def cutover_migration(database_id:, migration_id:) params: api_params, response_type: Models::DatabaseMigration ) - end # List the lifecycle operations recorded for a dedicated database, newest @@ -645,12 +676,17 @@ def cutover_migration(database_id:, migration_id:) # @param [Integer] offset Number of operations to skip. # # @return [DedicatedDatabaseOperationList] - def list_operations(database_id:, status: nil, limit: nil, offset: nil) + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) api_path = '/tablesdb/{databaseId}/operations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -658,7 +694,7 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) limit: limit, offset: offset, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -671,7 +707,6 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) params: api_params, response_type: Models::DedicatedDatabaseOperationList ) - end # Get high availability status for a dedicated database. Returns replica @@ -680,17 +715,18 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) # @param [String] database_id Database ID. # # @return [DedicatedDatabaseReplicas] - def get_replicas(database_id:) + def get_replicas( + database_id: + ) api_path = '/tablesdb/{databaseId}/replicas' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -703,7 +739,6 @@ def get_replicas(database_id:) params: api_params, response_type: Models::DedicatedDatabaseReplicas ) - end # Get real-time health and status information for a dedicated database. @@ -713,17 +748,18 @@ def get_replicas(database_id:) # @param [String] database_id Database ID. # # @return [DatabaseStatus] - def get_status(database_id:) + def get_status( + database_id: + ) api_path = '/tablesdb/{databaseId}/status' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -736,7 +772,6 @@ def get_status(database_id:) params: api_params, response_type: Models::DatabaseStatus ) - end # Get a list of all tables that belong to the provided databaseId. You can @@ -748,12 +783,17 @@ def get_status(database_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TableList] - def list_tables(database_id:, queries: nil, search: nil, total: nil) + def list_tables( + database_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -761,7 +801,7 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -774,7 +814,6 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TableList ) - end # Create a new Table. Before using this route, you should create a new @@ -783,29 +822,38 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) # API or directly from your database console. # # @param [String] database_id Database ID. - # @param [String] table_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] table_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Table name. Max length: 128 chars. # @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). # @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). - # @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. + # @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. # @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. # @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). # # @return [Table] - def create_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil, columns: nil, indexes: nil) + def create_table( + database_id:, + table_id:, + name:, + permissions: nil, + row_security: nil, + enabled: nil, + columns: nil, + indexes: nil + ) api_path = '/tablesdb/{databaseId}/tables' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -817,7 +865,7 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: columns: columns, indexes: indexes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -831,7 +879,6 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: params: api_params, response_type: Models::Table ) - end # Get a table by its unique ID. This endpoint response returns a JSON object @@ -841,22 +888,24 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: # @param [String] table_id Table ID. # # @return [Table] - def get_table(database_id:, table_id:) + def get_table( + database_id:, + table_id: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -869,7 +918,6 @@ def get_table(database_id:, table_id:) params: api_params, response_type: Models::Table ) - end # Update a table by its unique ID. @@ -879,21 +927,29 @@ def get_table(database_id:, table_id:) # @param [String] name Table name. Max length: 128 chars. # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @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). - # @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. + # @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. # @param [] purge When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. # # @return [Table] - def update_table(database_id:, table_id:, name: nil, permissions: nil, row_security: nil, enabled: nil, purge: nil) + def update_table( + database_id:, + table_id:, + name: nil, + permissions: nil, + row_security: nil, + enabled: nil, + purge: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -903,7 +959,7 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur enabled: enabled, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -917,7 +973,6 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur params: api_params, response_type: Models::Table ) - end # Delete a table by its unique ID. Only users with write permissions have @@ -927,22 +982,24 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur # @param [String] table_id Table ID. # # @return [] - def delete_table(database_id:, table_id:) + def delete_table( + database_id:, + table_id: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -954,7 +1011,6 @@ def delete_table(database_id:, table_id:) headers: api_headers, params: api_params, ) - end # List columns in the table. @@ -965,24 +1021,29 @@ def delete_table(database_id:, table_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ColumnList] - def list_columns(database_id:, table_id:, queries: nil, total: nil) + def list_columns( + database_id:, + table_id:, + queries: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -995,12 +1056,11 @@ def list_columns(database_id:, table_id:, queries: nil, total: nil) params: api_params, response_type: Models::ColumnList ) - end # Create a bigint column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1012,25 +1072,34 @@ def list_columns(database_id:, table_id:, queries: nil, total: nil) # @param [] array Is column an array? # # @return [ColumnBigint] - def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_big_int_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1041,7 +1110,7 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1055,12 +1124,11 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma params: api_params, response_type: Models::ColumnBigint ) - end # Update a bigint column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1072,30 +1140,39 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma # @param [String] new_key New Column Key. # # @return [ColumnBigint] - def update_big_int_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_big_int_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1105,7 +1182,7 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1119,11 +1196,10 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi params: api_params, response_type: Models::ColumnBigint ) - end # Create a boolean column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -1133,25 +1209,32 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi # @param [] array Is column an array? # # @return [ColumnBoolean] - def create_boolean_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_boolean_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1160,7 +1243,7 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1174,7 +1257,6 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnBoolean ) - end # Update a boolean column. Changing the `default` value will not update @@ -1188,30 +1270,37 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil # @param [String] new_key New Column Key. # # @return [ColumnBoolean] - def update_boolean_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_boolean_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1219,7 +1308,7 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1233,7 +1322,6 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne params: api_params, response_type: Models::ColumnBoolean ) - end # Create a date time column according to the ISO 8601 standard. @@ -1246,25 +1334,32 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne # @param [] array Is column an array? # # @return [ColumnDatetime] - def create_datetime_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_datetime_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1273,7 +1368,7 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1287,7 +1382,6 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni params: api_params, response_type: Models::ColumnDatetime ) - end # Update a date time column. Changing the `default` value will not update @@ -1301,30 +1395,37 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni # @param [String] new_key New Column Key. # # @return [ColumnDatetime] - def update_datetime_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_datetime_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1332,7 +1433,7 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1346,11 +1447,10 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n params: api_params, response_type: Models::ColumnDatetime ) - end # Create an email column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1360,25 +1460,32 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n # @param [] array Is column an array? # # @return [ColumnEmail] - def create_email_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_email_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/email' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1387,7 +1494,7 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1401,12 +1508,11 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, params: api_params, response_type: Models::ColumnEmail ) - end # Update an email column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1416,30 +1522,37 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, # @param [String] new_key New Column Key. # # @return [ColumnEmail] - def update_email_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_email_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1447,7 +1560,7 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1461,7 +1574,6 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ params: api_params, response_type: Models::ColumnEmail ) - end # Create an enumeration column. The `elements` param acts as a white-list of @@ -1476,29 +1588,37 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ # @param [] array Is column an array? # # @return [ColumnEnum] - def create_enum_column(database_id:, table_id:, key:, elements:, required:, default: nil, array: nil) + def create_enum_column( + database_id:, + table_id:, + key:, + elements:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1508,7 +1628,7 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1522,12 +1642,11 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa params: api_params, response_type: Models::ColumnEnum ) - end # Update an enum column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1538,34 +1657,42 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa # @param [String] new_key New Column Key. # # @return [ColumnEnum] - def update_enum_column(database_id:, table_id:, key:, elements:, required:, default:, new_key: nil) + def update_enum_column( + database_id:, + table_id:, + key:, + elements:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1574,7 +1701,7 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1588,12 +1715,11 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa params: api_params, response_type: Models::ColumnEnum ) - end # Create a float column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1605,25 +1731,34 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa # @param [] array Is column an array? # # @return [ColumnFloat] - def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_float_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/float' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1634,7 +1769,7 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1648,12 +1783,11 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: params: api_params, response_type: Models::ColumnFloat ) - end # Update a float column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1665,30 +1799,39 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: # @param [String] new_key New Column Key. # # @return [ColumnFloat] - def update_float_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_float_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1698,7 +1841,7 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1712,12 +1855,11 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: params: api_params, response_type: Models::ColumnFloat ) - end # Create an integer column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1729,25 +1871,34 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: # @param [] array Is column an array? # # @return [ColumnInteger] - def create_integer_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_integer_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1758,7 +1909,7 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1772,12 +1923,11 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma params: api_params, response_type: Models::ColumnInteger ) - end # Update an integer column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1789,30 +1939,39 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma # @param [String] new_key New Column Key. # # @return [ColumnInteger] - def update_integer_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_integer_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1822,7 +1981,7 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1836,11 +1995,10 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi params: api_params, response_type: Models::ColumnInteger ) - end # Create IP address column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1850,25 +2008,32 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi # @param [] array Is column an array? # # @return [ColumnIp] - def create_ip_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_ip_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1877,7 +2042,7 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1891,12 +2056,11 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr params: api_params, response_type: Models::ColumnIp ) - end # Update an ip column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1906,30 +2070,37 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr # @param [String] new_key New Column Key. # # @return [ColumnIp] - def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_ip_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1937,7 +2108,7 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1951,7 +2122,6 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key params: api_params, response_type: Models::ColumnIp ) - end # Create a geometric line column. @@ -1963,25 +2133,31 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key # @param [Array] default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. # # @return [ColumnLine] - def create_line_column(database_id:, table_id:, key:, required:, default: nil) + def create_line_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1989,7 +2165,7 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2003,7 +2179,6 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) params: api_params, response_type: Models::ColumnLine ) - end # Update a line column. Changing the `default` value will not update already @@ -2017,26 +2192,33 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] new_key New Column Key. # # @return [ColumnLine] - def update_line_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_line_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2044,7 +2226,7 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2058,11 +2240,10 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n params: api_params, response_type: Models::ColumnLine ) - end # Create a longtext column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2073,25 +2254,33 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnLongtext] - def create_longtext_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_longtext_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2101,7 +2290,7 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2115,12 +2304,11 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni params: api_params, response_type: Models::ColumnLongtext ) - end # Update a longtext column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2130,30 +2318,37 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni # @param [String] new_key New Column Key. # # @return [ColumnLongtext] - def update_longtext_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_longtext_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2161,7 +2356,7 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2175,11 +2370,10 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n params: api_params, response_type: Models::ColumnLongtext ) - end # Create a mediumtext column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2190,25 +2384,33 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnMediumtext] - def create_mediumtext_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_mediumtext_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2218,7 +2420,7 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2232,12 +2434,11 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: params: api_params, response_type: Models::ColumnMediumtext ) - end # Update a mediumtext column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2247,30 +2448,37 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: # @param [String] new_key New Column Key. # # @return [ColumnMediumtext] - def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_mediumtext_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2278,7 +2486,7 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2292,7 +2500,6 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, params: api_params, response_type: Models::ColumnMediumtext ) - end # Create a geometric point column. @@ -2304,25 +2511,31 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, # @param [Array] default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. # # @return [ColumnPoint] - def create_point_column(database_id:, table_id:, key:, required:, default: nil) + def create_point_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2330,7 +2543,7 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2344,7 +2557,6 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) params: api_params, response_type: Models::ColumnPoint ) - end # Update a point column. Changing the `default` value will not update already @@ -2358,26 +2570,33 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] new_key New Column Key. # # @return [ColumnPoint] - def update_point_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_point_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2385,7 +2604,7 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2399,7 +2618,6 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, params: api_params, response_type: Models::ColumnPoint ) - end # Create a geometric polygon column. @@ -2411,25 +2629,31 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, # @param [Array] default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. # # @return [ColumnPolygon] - def create_polygon_column(database_id:, table_id:, key:, required:, default: nil) + def create_polygon_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2437,7 +2661,7 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2451,7 +2675,6 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnPolygon ) - end # Update a polygon column. Changing the `default` value will not update @@ -2465,26 +2688,33 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [String] new_key New Column Key. # # @return [ColumnPolygon] - def update_polygon_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_polygon_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2492,7 +2722,7 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2506,12 +2736,11 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnPolygon ) - end # Create relationship column. [Learn more about relationship # columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2523,25 +2752,34 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [ColumnRelationship] - def create_relationship_column(database_id:, table_id:, related_table_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) + def create_relationship_column( + database_id:, + table_id:, + related_table_id:, + type:, + two_way: nil, + key: nil, + two_way_key: nil, + on_delete: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if related_table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "relatedTableId"') + raise Appwrite::Exception.new('Missing required parameter: "relatedTableId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -2552,7 +2790,7 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: twoWayKey: two_way_key, onDelete: on_delete, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2566,14 +2804,13 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: params: api_params, response_type: Models::ColumnRelationship ) - end # # @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. # # Create a string column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2585,29 +2822,38 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnString] - def create_string_column(database_id:, table_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_string_column( + database_id:, + table_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/string' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2618,7 +2864,7 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2632,7 +2878,6 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul params: api_params, response_type: Models::ColumnString ) - end # @@ -2640,7 +2885,7 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul # # Update a string column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2651,30 +2896,38 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul # @param [String] new_key New Column Key. # # @return [ColumnString] - def update_string_column(database_id:, table_id:, key:, required:, default:, size: nil, new_key: nil) + def update_string_column( + database_id:, + table_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2683,7 +2936,7 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2697,11 +2950,10 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz params: api_params, response_type: Models::ColumnString ) - end # Create a text column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2712,25 +2964,33 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnText] - def create_text_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_text_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/text' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2740,7 +3000,7 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2754,12 +3014,11 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a params: api_params, response_type: Models::ColumnText ) - end # Update a text column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2769,30 +3028,37 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a # @param [String] new_key New Column Key. # # @return [ColumnText] - def update_text_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_text_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2800,7 +3066,7 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2814,11 +3080,10 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k params: api_params, response_type: Models::ColumnText ) - end # Create a URL column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2828,25 +3093,32 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k # @param [] array Is column an array? # # @return [ColumnUrl] - def create_url_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_url_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/url' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2855,7 +3127,7 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2869,12 +3141,11 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar params: api_params, response_type: Models::ColumnUrl ) - end # Update an url column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2884,30 +3155,37 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar # @param [String] new_key New Column Key. # # @return [ColumnUrl] - def update_url_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_url_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2915,7 +3193,7 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2929,11 +3207,10 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke params: api_params, response_type: Models::ColumnUrl ) - end # Create a varchar column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2945,29 +3222,38 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnVarchar] - def create_varchar_column(database_id:, table_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_varchar_column( + database_id:, + table_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2978,7 +3264,7 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2992,12 +3278,11 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau params: api_params, response_type: Models::ColumnVarchar ) - end # Update a varchar column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -3008,30 +3293,38 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau # @param [String] new_key New Column Key. # # @return [ColumnVarchar] - def update_varchar_column(database_id:, table_id:, key:, required:, default:, size: nil, new_key: nil) + def update_varchar_column( + database_id:, + table_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -3040,7 +3333,7 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3054,7 +3347,6 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si params: api_params, response_type: Models::ColumnVarchar ) - end # Get column by ID. @@ -3064,27 +3356,30 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si # @param [String] key Column Key. # # @return [ColumnBoolean, ColumnInteger, ColumnFloat, ColumnEmail, ColumnEnum, ColumnUrl, ColumnIp, ColumnDatetime, ColumnRelationship, ColumnString] - def get_column(database_id:, table_id:, key:) + def get_column( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3152,7 +3447,6 @@ def get_column(database_id:, table_id:, key:) end raise Exception, "Unable to match response to any expected response model" - end # Deletes a column. @@ -3162,27 +3456,30 @@ def get_column(database_id:, table_id:, key:) # @param [String] key Column Key. # # @return [] - def delete_column(database_id:, table_id:, key:) + def delete_column( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3194,12 +3491,11 @@ def delete_column(database_id:, table_id:, key:) headers: api_headers, params: api_params, ) - end # Update relationship column. [Learn more about relationship # columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -3208,29 +3504,35 @@ def delete_column(database_id:, table_id:, key:) # @param [String] new_key New Column Key. # # @return [ColumnRelationship] - def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, new_key: nil) + def update_relationship_column( + database_id:, + table_id:, + key:, + on_delete: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { onDelete: on_delete, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3244,7 +3546,6 @@ def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, ne params: api_params, response_type: Models::ColumnRelationship ) - end # List indexes on the table. @@ -3255,24 +3556,29 @@ def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, ne # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ColumnIndexList] - def list_indexes(database_id:, table_id:, queries: nil, total: nil) + def list_indexes( + database_id:, + table_id:, + queries: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3285,7 +3591,6 @@ def list_indexes(database_id:, table_id:, queries: nil, total: nil) params: api_params, response_type: Models::ColumnIndexList ) - end # Creates an index on the columns listed. Your index should include all the @@ -3301,29 +3606,37 @@ def list_indexes(database_id:, table_id:, queries: nil, total: nil) # @param [Array] lengths Length of index. Maximum of 100 # # @return [ColumnIndex] - def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, lengths: nil) + def create_index( + database_id:, + table_id:, + key:, + type:, + columns:, + orders: nil, + lengths: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if columns.nil? - raise Appwrite::Exception.new('Missing required parameter: "columns"') + raise Appwrite::Exception.new('Missing required parameter: "columns"') end api_params = { @@ -3333,7 +3646,7 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le orders: orders, lengths: lengths, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3347,7 +3660,6 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le params: api_params, response_type: Models::ColumnIndex ) - end # Get index by ID. @@ -3357,27 +3669,30 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le # @param [String] key Index Key. # # @return [ColumnIndex] - def get_index(database_id:, table_id:, key:) + def get_index( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3390,7 +3705,6 @@ def get_index(database_id:, table_id:, key:) params: api_params, response_type: Models::ColumnIndex ) - end # Delete an index. @@ -3400,27 +3714,30 @@ def get_index(database_id:, table_id:, key:) # @param [String] key Index Key. # # @return [] - def delete_index(database_id:, table_id:, key:) + def delete_index( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3432,10 +3749,9 @@ def delete_index(database_id:, table_id:, key:) headers: api_headers, params: api_params, ) - end - # Get a list of all the user's rows in a given table. You can use the query + # Get a list of all the user's rows in a given table. You can use the query # params to filter your results. # # @param [String] database_id Database ID. @@ -3446,17 +3762,24 @@ def delete_index(database_id:, table_id:, key:) # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [RowList] - def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil) + def list_rows( + database_id:, + table_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -3465,7 +3788,7 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3478,7 +3801,6 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: params: api_params, response_type: Models::RowList ) - end # Create a new Row. Before using this route, you should create a new table @@ -3488,31 +3810,38 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - # @param [String] row_id Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] row_id Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Row data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transaction_id: nil) + def create_row( + database_id:, + table_id:, + row_id:, + data:, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if data.nil? - raise Appwrite::Exception.new('Missing required parameter: "data"') + raise Appwrite::Exception.new('Missing required parameter: "data"') end api_params = { @@ -3521,7 +3850,7 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3535,7 +3864,6 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa params: api_params, response_type: Models::Row ) - end # Create new Rows. Before using this route, you should create a new table @@ -3549,28 +3877,33 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def create_rows(database_id:, table_id:, rows:, transaction_id: nil) + def create_rows( + database_id:, + table_id:, + rows:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if rows.nil? - raise Appwrite::Exception.new('Missing required parameter: "rows"') + raise Appwrite::Exception.new('Missing required parameter: "rows"') end api_params = { rows: rows, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3584,14 +3917,13 @@ def create_rows(database_id:, table_id:, rows:, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Create or update Rows. Before using this route, you should create a new # table resource using either a [server # integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) # API or directly from your database console. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -3599,28 +3931,33 @@ def create_rows(database_id:, table_id:, rows:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) + def upsert_rows( + database_id:, + table_id:, + rows:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if rows.nil? - raise Appwrite::Exception.new('Missing required parameter: "rows"') + raise Appwrite::Exception.new('Missing required parameter: "rows"') end api_params = { rows: rows, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3634,7 +3971,6 @@ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Update all rows that match your queries, if no queries are submitted then @@ -3647,17 +3983,23 @@ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id: nil) + def update_rows( + database_id:, + table_id:, + data: nil, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -3665,7 +4007,7 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3679,7 +4021,6 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id params: api_params, response_type: Models::RowList ) - end # Bulk delete rows using queries, if no queries are passed then all rows are @@ -3691,24 +4032,29 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) + def delete_rows( + database_id:, + table_id:, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3722,7 +4068,6 @@ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Get a row by its unique ID. This endpoint response returns a JSON object @@ -3735,29 +4080,35 @@ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. # # @return [Row] - def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) + def get_row( + database_id:, + table_id:, + row_id:, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3770,7 +4121,6 @@ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) params: api_params, response_type: Models::Row ) - end # Create or update a Row. Before using this route, you should create a new @@ -3786,22 +4136,29 @@ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil) + def upsert_row( + database_id:, + table_id:, + row_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { @@ -3809,7 +4166,7 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3823,7 +4180,6 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr params: api_params, response_type: Models::Row ) - end # Update a row by its unique ID. Using the patch method you can pass only @@ -3837,22 +4193,29 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil) + def update_row( + database_id:, + table_id:, + row_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { @@ -3860,7 +4223,7 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3874,7 +4237,6 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr params: api_params, response_type: Models::Row ) - end # Delete a row by its unique ID. @@ -3885,28 +4247,33 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr # @param [String] transaction_id Transaction ID for staging the operation. # # @return [] - def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) + def delete_row( + database_id:, + table_id:, + row_id:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3918,7 +4285,6 @@ def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) headers: api_headers, params: api_params, ) - end # Decrement a specific column of a row by a given value. @@ -3932,7 +4298,15 @@ def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: nil, transaction_id: nil) + def decrement_row_column( + database_id:, + table_id:, + row_id:, + column:, + value: nil, + min: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) @@ -3940,19 +4314,19 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, .gsub('{column}', column) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if column.nil? - raise Appwrite::Exception.new('Missing required parameter: "column"') + raise Appwrite::Exception.new('Missing required parameter: "column"') end api_params = { @@ -3960,7 +4334,7 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: min, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3974,7 +4348,6 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, params: api_params, response_type: Models::Row ) - end # Increment a specific column of a row by a given value. @@ -3988,7 +4361,15 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: nil, transaction_id: nil) + def increment_row_column( + database_id:, + table_id:, + row_id:, + column:, + value: nil, + max: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) @@ -3996,19 +4377,19 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, .gsub('{column}', column) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if column.nil? - raise Appwrite::Exception.new('Missing required parameter: "column"') + raise Appwrite::Exception.new('Missing required parameter: "column"') end api_params = { @@ -4016,7 +4397,7 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: max, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -4030,8 +4411,6 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, params: api_params, response_type: Models::Row ) - end - - end + end end diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index 3ae89b4d..d6325633 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Teams < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TeamList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/teams' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,27 +39,30 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TeamList ) - end # Create a new team. The user who creates the team will automatically be # assigned as the owner of the team. Only the users with the owner role can # invite new members, add new owners and delete or update the team. # - # @param [String] team_id Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] team_id Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Team name. Max length: 128 chars. # @param [Array] roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. # # @return [Team] - def create(team_id:, name:, roles: nil) + def create( + team_id:, + name:, + roles: nil + ) api_path = '/teams' if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -64,7 +70,7 @@ def create(team_id:, name:, roles: nil) name: name, roles: roles, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -78,7 +84,6 @@ def create(team_id:, name:, roles: nil) params: api_params, response_type: Models::Team ) - end # Get a team by its ID. All team members have read access for this resource. @@ -86,17 +91,18 @@ def create(team_id:, name:, roles: nil) # @param [String] team_id Team ID. # # @return [Team] - def get(team_id:) + def get( + team_id: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -109,31 +115,33 @@ def get(team_id:) params: api_params, response_type: Models::Team ) - end - # Update the team's name by its unique ID. + # Update the team's name by its unique ID. # # @param [String] team_id Team ID. # @param [String] name New team name. Max length: 128 chars. # # @return [Team] - def update_name(team_id:, name:) + def update_name( + team_id:, + name: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + 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', @@ -147,7 +155,6 @@ def update_name(team_id:, name:) params: api_params, response_type: Models::Team ) - end # Delete a team using its ID. Only team members with the owner role can @@ -156,17 +163,18 @@ def update_name(team_id:, name:) # @param [String] team_id Team ID. # # @return [] - def delete(team_id:) + def delete( + team_id: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -178,7 +186,6 @@ def delete(team_id:) headers: api_headers, params: api_params, ) - end # List app installations on a team. Any team member can read installations. @@ -188,19 +195,23 @@ def delete(team_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(team_id:, queries: nil, total: nil) + def list_installations( + team_id:, + queries: nil, + total: nil + ) api_path = '/teams/{teamId}/installations' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -213,7 +224,6 @@ def list_installations(team_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Install an app on a team. When authenticated as a user, only team members @@ -226,23 +236,27 @@ def list_installations(team_id:, queries: nil, total: nil) # @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. # # @return [AppInstallation] - def create_installation(team_id:, app_id:, authorization_details: nil) + def create_installation( + team_id:, + app_id:, + authorization_details: nil + ) api_path = '/teams/{teamId}/installations' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { appId: app_id, authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -256,7 +270,6 @@ def create_installation(team_id:, app_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Get an app installation on a team by its unique ID. Any team member can @@ -266,22 +279,24 @@ def create_installation(team_id:, app_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(team_id:, installation_id:) + def get_installation( + team_id:, + installation_id: + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -294,11 +309,10 @@ def get_installation(team_id:, installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Update an app installation on a team. Only team members with the owner role - # can update installations. The installation's granted scopes are refreshed + # can update installations. The installation's granted scopes are refreshed # to the scopes the app currently requests; previously issued installation # access tokens are revoked. # @@ -307,23 +321,27 @@ def get_installation(team_id:, installation_id:) # @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. # # @return [AppInstallation] - def update_installation(team_id:, installation_id:, authorization_details: nil) + def update_installation( + team_id:, + installation_id:, + authorization_details: nil + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -337,7 +355,6 @@ def update_installation(team_id:, installation_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Uninstall an app from a team by its installation ID. Only team members with @@ -348,22 +365,24 @@ def update_installation(team_id:, installation_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(team_id:, installation_id:) + def delete_installation( + team_id:, + installation_id: + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -376,10 +395,9 @@ def delete_installation(team_id:, installation_id:) headers: api_headers, params: api_params, ) - end - # Use this endpoint to list a team's members using the team's ID. All team + # Use this endpoint to list a team's members using the team's ID. All team # members have read access to this endpoint. Hide sensitive attributes from # the response by toggling membership privacy in the Console. # @@ -389,12 +407,17 @@ def delete_installation(team_id:, installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(team_id:, queries: nil, search: nil, total: nil) + def list_memberships( + team_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/teams/{teamId}/memberships' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { @@ -402,7 +425,7 @@ def list_memberships(team_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -415,50 +438,57 @@ def list_memberships(team_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # Invite a new member to join your team. Provide an ID for existing users, or # invite unregistered users using an email or phone number. If initiated from # a Client SDK, Appwrite will send an email or sms with a link to join the # team to the invited user, and an account will be created for them if one - # doesn't exist. If initiated from a Server SDK, the new member will be added + # doesn't exist. If initiated from a Server SDK, the new member will be added # automatically to the team. - # + # # You only need to provide one of a user ID, email, or phone number. Appwrite - # will prioritize accepting the user ID > email > phone number if you provide + # will prioritize accepting the user ID > email > phone number if you provide # more than one of these parameters. - # + # # Use the `url` parameter to redirect the user from the invitation email to # your app. After the user is redirected, use the [Update Team Membership # Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) - # endpoint to allow the user to accept the invitation to the team. - # + # endpoint to allow the user to accept the invitation to the team. + # # Please note that to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) # Appwrite will accept the only redirect URLs under the domains you have # added as a platform on the Appwrite Console. - # + # # # @param [String] team_id Team ID. # @param [Array] roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # @param [String] email Email of the new team member. # @param [String] user_id ID of the user to be added to a team. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [String] name Name of the new team member. Max length: 128 chars. # # @return [Membership] - def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) + def create_membership( + team_id:, + roles:, + email: nil, + user_id: nil, + phone: nil, + url: nil, + name: nil + ) api_path = '/teams/{teamId}/memberships' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { @@ -469,7 +499,7 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur url: url, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -483,7 +513,6 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur params: api_params, response_type: Models::Membership ) - end # Get a team member by the membership unique id. All team members have read @@ -494,22 +523,24 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur # @param [String] membership_id Membership ID. # # @return [Membership] - def get_membership(team_id:, membership_id:) + def get_membership( + team_id:, + membership_id: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -522,40 +553,43 @@ def get_membership(team_id:, membership_id:) params: api_params, response_type: Models::Membership ) - end # Modify the roles of a team member. Only team members with the owner role # have access to this endpoint. Learn more about [roles and # permissions](https://appwrite.io/docs/permissions). - # + # # # @param [String] team_id Team ID. # @param [String] membership_id Membership ID. - # @param [Array] roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # @param [Array] roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # # @return [Membership] - def update_membership(team_id:, membership_id:, roles:) + def update_membership( + team_id:, + membership_id:, + roles: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + 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', @@ -569,7 +603,6 @@ def update_membership(team_id:, membership_id:, roles:) params: api_params, response_type: Models::Membership ) - end # This endpoint allows a user to leave a team or for a team owner to delete @@ -580,22 +613,24 @@ def update_membership(team_id:, membership_id:, roles:) # @param [String] membership_id Membership ID. # # @return [] - def delete_membership(team_id:, membership_id:) + def delete_membership( + team_id:, + membership_id: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -607,16 +642,15 @@ def delete_membership(team_id:, membership_id:) headers: api_headers, params: api_params, ) - end # Use this endpoint to allow a user to accept an invitation to join a team # after being redirected back to your app from the invitation email received # by the user. - # + # # If the request is successful, a session for the user is automatically # created. - # + # # # @param [String] team_id Team ID. # @param [String] membership_id Membership ID. @@ -624,32 +658,37 @@ def delete_membership(team_id:, membership_id:) # @param [String] secret Secret key. # # @return [Membership] - def update_membership_status(team_id:, membership_id:, user_id:, secret:) + def update_membership_status( + team_id:, + membership_id:, + user_id:, + secret: + ) api_path = '/teams/{teamId}/memberships/{membershipId}/status' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -663,27 +702,27 @@ def update_membership_status(team_id:, membership_id:, user_id:, secret:) params: api_params, response_type: Models::Membership ) - end - # Get the team's shared preferences by its unique ID. If a preference doesn't + # Get the team's shared preferences by its unique ID. If a preference doesn't # need to be shared by all team members, prefer storing them in [user # preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). # # @param [String] team_id Team ID. # # @return [Preferences] - def get_prefs(team_id:) + def get_prefs( + team_id: + ) api_path = '/teams/{teamId}/prefs' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -696,10 +735,9 @@ def get_prefs(team_id:) params: api_params, response_type: Models::Preferences ) - end - # Update the team's preferences by its unique ID. The object you pass is + # Update the team's preferences by its unique ID. The object you pass is # stored as is and replaces any previous value. The maximum allowed prefs # size is 64kB and throws an error if exceeded. # @@ -707,22 +745,25 @@ def get_prefs(team_id:) # @param [Hash] prefs Prefs key-value JSON object. # # @return [Preferences] - def update_prefs(team_id:, prefs:) + def update_prefs( + team_id:, + prefs: + ) api_path = '/teams/{teamId}/prefs' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -736,8 +777,6 @@ def update_prefs(team_id:, prefs:) params: api_params, response_type: Models::Preferences ) - end - - end + end end diff --git a/lib/appwrite/services/tokens.rb b/lib/appwrite/services/tokens.rb index 81abddf9..72ba9710 100644 --- a/lib/appwrite/services/tokens.rb +++ b/lib/appwrite/services/tokens.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Tokens < Service - def initialize(client) @client = client end @@ -16,24 +15,29 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ResourceTokenList] - def list(bucket_id:, file_id:, queries: nil, total: nil) + def list( + bucket_id:, + file_id:, + queries: nil, + total: nil + ) api_path = '/tokens/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -46,7 +50,6 @@ def list(bucket_id:, file_id:, queries: nil, total: nil) params: api_params, response_type: Models::ResourceTokenList ) - end # Create a new token. A token is linked to a file. Token can be passed as a @@ -57,23 +60,27 @@ def list(bucket_id:, file_id:, queries: nil, total: nil) # @param [String] expire Token expiry date # # @return [ResourceToken] - def create_file_token(bucket_id:, file_id:, expire: nil) + def create_file_token( + bucket_id:, + file_id:, + expire: nil + ) api_path = '/tokens/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -87,7 +94,6 @@ def create_file_token(bucket_id:, file_id:, expire: nil) params: api_params, response_type: Models::ResourceToken ) - end # Get a token by its unique ID. @@ -95,17 +101,18 @@ def create_file_token(bucket_id:, file_id:, expire: nil) # @param [String] token_id Token ID. # # @return [ResourceToken] - def get(token_id:) + def get( + token_id: + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -118,28 +125,30 @@ def get(token_id:) params: api_params, response_type: Models::ResourceToken ) - end - # Update a token by its unique ID. Use this endpoint to update a token's + # Update a token by its unique ID. Use this endpoint to update a token's # expiry date. # # @param [String] token_id Token unique ID. # @param [String] expire File token expiry date # # @return [ResourceToken] - def update(token_id:, expire: nil) + def update( + token_id:, + expire: nil + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end api_params = { expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -153,7 +162,6 @@ def update(token_id:, expire: nil) params: api_params, response_type: Models::ResourceToken ) - end # Delete a token by its unique ID. @@ -161,17 +169,18 @@ def update(token_id:, expire: nil) # @param [String] token_id Token ID. # # @return [] - def delete(token_id:) + def delete( + token_id: + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -183,8 +192,6 @@ def delete(token_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index a3c19251..86f54836 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Users < Service - def initialize(client) @client = client end - # Get a list of all the project's users. You can use the query params to + # Get a list of all the project's users. You can use the query params to # filter your results. # # @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. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator, accessedAt @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [UserList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/users' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,23 +39,28 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::UserList ) - end # Create a new user. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] password Plain text user password. Must be at least 8 chars. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create(user_id:, email: nil, phone: nil, password: nil, name: nil) + def create( + user_id:, + email: nil, + phone: nil, + password: nil, + name: nil + ) api_path = '/users' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -62,7 +70,7 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -76,7 +84,6 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -84,25 +91,30 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Argon2. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_argon2_user(user_id:, email:, password:, name: nil) + def create_argon2_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/argon2' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -111,7 +123,7 @@ def create_argon2_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -125,7 +137,6 @@ def create_argon2_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -133,25 +144,30 @@ def create_argon2_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Bcrypt. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_bcrypt_user(user_id:, email:, password:, name: nil) + def create_bcrypt_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/bcrypt' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -160,7 +176,7 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -174,7 +190,6 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Get identities for all users. @@ -184,7 +199,11 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IdentityList] - def list_identities(queries: nil, search: nil, total: nil) + def list_identities( + queries: nil, + search: nil, + total: nil + ) api_path = '/users/identities' api_params = { @@ -192,7 +211,7 @@ def list_identities(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -205,7 +224,6 @@ def list_identities(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::IdentityList ) - end # Delete an identity by its unique ID. @@ -213,17 +231,18 @@ def list_identities(queries: nil, search: nil, total: nil) # @param [String] identity_id Identity ID. # # @return [] - def delete_identity(identity_id:) + def delete_identity( + identity_id: + ) api_path = '/users/identities/{identityId}' .gsub('{identityId}', identity_id) if identity_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "identityId"') + raise Appwrite::Exception.new('Missing required parameter: "identityId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -235,7 +254,6 @@ def delete_identity(identity_id:) headers: api_headers, params: api_params, ) - end # Create a new user. Password provided must be hashed with the @@ -243,25 +261,30 @@ def delete_identity(identity_id:) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using MD5. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_md5_user(user_id:, email:, password:, name: nil) + def create_md5_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/md5' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -270,7 +293,7 @@ def create_md5_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -284,7 +307,6 @@ def create_md5_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -292,25 +314,30 @@ def create_md5_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using PHPass. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_ph_pass_user(user_id:, email:, password:, name: nil) + def create_ph_pass_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/phpass' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -319,7 +346,7 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -333,7 +360,6 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -341,7 +367,7 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Scrypt. # @param [String] password_salt Optional salt used to hash password. @@ -352,39 +378,49 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu:, password_memory:, password_parallel:, password_length:, name: nil) + def create_scrypt_user( + user_id:, + email:, + password:, + password_salt:, + password_cpu:, + password_memory:, + password_parallel:, + password_length:, + name: nil + ) api_path = '/users/scrypt' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end if password_salt.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') end if password_cpu.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordCpu"') + raise Appwrite::Exception.new('Missing required parameter: "passwordCpu"') end if password_memory.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordMemory"') + raise Appwrite::Exception.new('Missing required parameter: "passwordMemory"') end if password_parallel.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordParallel"') + raise Appwrite::Exception.new('Missing required parameter: "passwordParallel"') end if password_length.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordLength"') + raise Appwrite::Exception.new('Missing required parameter: "passwordLength"') end api_params = { @@ -398,7 +434,7 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu passwordLength: password_length, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -412,7 +448,6 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the [Scrypt @@ -421,7 +456,7 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Scrypt Modified. # @param [String] password_salt Salt used to hash password. @@ -430,31 +465,39 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, password_salt_separator:, password_signer_key:, name: nil) + def create_scrypt_modified_user( + user_id:, + email:, + password:, + password_salt:, + password_salt_separator:, + password_signer_key:, + name: nil + ) api_path = '/users/scrypt-modified' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end if password_salt.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') end if password_salt_separator.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSaltSeparator"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSaltSeparator"') end if password_signer_key.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSignerKey"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSignerKey"') end api_params = { @@ -466,7 +509,7 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas passwordSignerKey: password_signer_key, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -480,7 +523,6 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -488,26 +530,32 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas # the [POST /users](https://appwrite.io/docs/server/users#usersCreate) # endpoint to create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using SHA. - # @param [PasswordHash] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + # @param [PasswordHash] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_sha_user(user_id:, email:, password:, password_version: nil, name: nil) + def create_sha_user( + user_id:, + email:, + password:, + password_version: nil, + name: nil + ) api_path = '/users/sha' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -517,7 +565,7 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni passwordVersion: password_version, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -531,7 +579,6 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni params: api_params, response_type: Models::User ) - end # Get a user by its unique ID. @@ -539,17 +586,18 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni # @param [String] user_id User ID. # # @return [User] - def get(user_id:) + def get( + user_id: + ) api_path = '/users/{userId}' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -562,10 +610,9 @@ def get(user_id:) params: api_params, response_type: Models::User ) - end - # Delete a user by its unique ID, thereby releasing it's ID. Since ID is + # Delete a user by its unique ID, thereby releasing it's ID. Since ID is # released and can be reused, all user-related resources like documents or # storage files should be deleted before user deletion. If you want to keep # ID reserved, use the @@ -575,17 +622,18 @@ def get(user_id:) # @param [String] user_id User ID. # # @return [] - def delete(user_id:) + def delete( + user_id: + ) api_path = '/users/{userId}' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -597,7 +645,6 @@ def delete(user_id:) headers: api_headers, params: api_params, ) - end # Update the user email by its unique ID. @@ -606,22 +653,25 @@ def delete(user_id:) # @param [String] email User email. # # @return [User] - def update_email(user_id:, email:) + def update_email( + user_id:, + email: + ) api_path = '/users/{userId}/email' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { email: email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -635,7 +685,6 @@ def update_email(user_id:, email:) params: api_params, response_type: Models::User ) - end # Enable or disable whether a user can impersonate other users. When @@ -643,28 +692,31 @@ def update_email(user_id:, email:) # behavior, while internal audit logs still attribute the action to the # original impersonator and store the impersonated target details only in # internal audit payload data. - # + # # # @param [String] user_id User ID. # @param [] impersonator Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. # # @return [User] - def update_impersonator(user_id:, impersonator:) + def update_impersonator( + user_id:, + impersonator: + ) api_path = '/users/{userId}/impersonator' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if impersonator.nil? - raise Appwrite::Exception.new('Missing required parameter: "impersonator"') + raise Appwrite::Exception.new('Missing required parameter: "impersonator"') end api_params = { impersonator: impersonator, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -678,7 +730,6 @@ def update_impersonator(user_id:, impersonator:) params: api_params, response_type: Models::User ) - end # Use this endpoint to create a JSON Web Token for user by its unique ID. You @@ -686,23 +737,27 @@ def update_impersonator(user_id:, impersonator:) # secret will become invalid if the session it uses gets deleted. # # @param [String] user_id User ID. - # @param [String] session_id Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + # @param [String] session_id Session ID. Use the string 'recent()' to use the most recent session, which is also the default. # @param [Integer] duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. # # @return [Jwt] - def create_jwt(user_id:, session_id: nil, duration: nil) + def create_jwt( + user_id:, + session_id: nil, + duration: nil + ) api_path = '/users/{userId}/jwts' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { sessionId: session_id, duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -716,13 +771,12 @@ def create_jwt(user_id:, session_id: nil, duration: nil) params: api_params, response_type: Models::Jwt ) - end - # Update the user labels by its unique ID. - # + # Update the user labels by its unique ID. + # # Labels can be used to grant access to resources. While teams are a way for - # user's to share access to a resource, labels can be defined by the + # user's to share access to a resource, labels can be defined by the # developer to grant access without an invitation. See the [Permissions # docs](https://appwrite.io/docs/permissions) for more info. # @@ -730,22 +784,25 @@ def create_jwt(user_id:, session_id: nil, duration: nil) # @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [User] - def update_labels(user_id:, labels:) + def update_labels( + user_id:, + labels: + ) api_path = '/users/{userId}/labels' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -759,7 +816,6 @@ def update_labels(user_id:, labels:) params: api_params, response_type: Models::User ) - end # Get the user activity logs list by its unique ID. @@ -769,19 +825,23 @@ def update_labels(user_id:, labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [LogList] - def list_logs(user_id:, queries: nil, total: nil) + def list_logs( + user_id:, + queries: nil, + total: nil + ) api_path = '/users/{userId}/logs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -794,7 +854,6 @@ def list_logs(user_id:, queries: nil, total: nil) params: api_params, response_type: Models::LogList ) - end # Get the user membership list by its unique ID. @@ -805,12 +864,17 @@ def list_logs(user_id:, queries: nil, total: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(user_id:, queries: nil, search: nil, total: nil) + def list_memberships( + user_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/users/{userId}/memberships' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -818,7 +882,7 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -831,7 +895,6 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # Enable or disable MFA on a user account. @@ -840,22 +903,25 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) # @param [] mfa Enable or disable MFA. # # @return [User] - def update_mfa(user_id:, mfa:) + def update_mfa( + user_id:, + mfa: + ) api_path = '/users/{userId}/mfa' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if mfa.nil? - raise Appwrite::Exception.new('Missing required parameter: "mfa"') + raise Appwrite::Exception.new('Missing required parameter: "mfa"') end api_params = { mfa: mfa, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -869,7 +935,6 @@ def update_mfa(user_id:, mfa:) params: api_params, response_type: Models::User ) - end # Delete an authenticator app. @@ -878,22 +943,24 @@ def update_mfa(user_id:, mfa:) # @param [AuthenticatorType] type Type of authenticator. # # @return [] - def delete_mfa_authenticator(user_id:, type:) + def delete_mfa_authenticator( + user_id:, + type: + ) api_path = '/users/{userId}/mfa/authenticators/{type}' .gsub('{userId}', user_id) .gsub('{type}', type) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -905,7 +972,6 @@ def delete_mfa_authenticator(user_id:, type:) headers: api_headers, params: api_params, ) - end # Get a custom MFA challenge for a user, including the code to be delivered @@ -915,22 +981,24 @@ def delete_mfa_authenticator(user_id:, type:) # @param [String] challenge_id ID of the challenge. # # @return [MfaChallengeSecret] - def get_mfa_challenge(user_id:, challenge_id:) + def get_mfa_challenge( + user_id:, + challenge_id: + ) api_path = '/users/{userId}/mfa/challenges/{challengeId}' .gsub('{userId}', user_id) .gsub('{challengeId}', challenge_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if challenge_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "challengeId"') + raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -943,7 +1011,6 @@ def get_mfa_challenge(user_id:, challenge_id:) params: api_params, response_type: Models::MfaChallengeSecret ) - end # List the factors available on the account to be used as a MFA challange. @@ -951,17 +1018,18 @@ def get_mfa_challenge(user_id:, challenge_id:) # @param [String] user_id User ID. # # @return [MfaFactors] - def list_mfa_factors(user_id:) + def list_mfa_factors( + user_id: + ) api_path = '/users/{userId}/mfa/factors' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -974,7 +1042,6 @@ def list_mfa_factors(user_id:) params: api_params, response_type: Models::MfaFactors ) - end # Get recovery codes that can be used as backup for MFA flow by User ID. @@ -985,17 +1052,18 @@ def list_mfa_factors(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def get_mfa_recovery_codes(user_id:) + def get_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1008,7 +1076,6 @@ def get_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Regenerate recovery codes that can be used as backup for MFA flow by User @@ -1019,17 +1086,18 @@ def get_mfa_recovery_codes(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def update_mfa_recovery_codes(user_id:) + def update_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1043,7 +1111,6 @@ def update_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Generate recovery codes used as backup for MFA flow for User ID. Recovery @@ -1054,17 +1121,18 @@ def update_mfa_recovery_codes(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def create_mfa_recovery_codes(user_id:) + def create_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1078,7 +1146,6 @@ def create_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Update the user name by its unique ID. @@ -1087,22 +1154,25 @@ def create_mfa_recovery_codes(user_id:) # @param [String] name User name. Max length: 128 chars. # # @return [User] - def update_name(user_id:, name:) + def update_name( + user_id:, + name: + ) api_path = '/users/{userId}/name' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + 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', @@ -1116,7 +1186,6 @@ def update_name(user_id:, name:) params: api_params, response_type: Models::User ) - end # Update the user password by its unique ID. @@ -1125,22 +1194,25 @@ def update_name(user_id:, name:) # @param [String] password New user password. Must be at least 8 chars. # # @return [User] - def update_password(user_id:, password:) + def update_password( + user_id:, + password: + ) api_path = '/users/{userId}/password' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1154,7 +1226,6 @@ def update_password(user_id:, password:) params: api_params, response_type: Models::User ) - end # Update the user phone by its unique ID. @@ -1163,22 +1234,25 @@ def update_password(user_id:, password:) # @param [String] number User phone number. # # @return [User] - def update_phone(user_id:, number:) + def update_phone( + user_id:, + number: + ) api_path = '/users/{userId}/phone' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end api_params = { number: number, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1192,7 +1266,6 @@ def update_phone(user_id:, number:) params: api_params, response_type: Models::User ) - end # Get the user preferences by its unique ID. @@ -1200,17 +1273,18 @@ def update_phone(user_id:, number:) # @param [String] user_id User ID. # # @return [Preferences] - def get_prefs(user_id:) + def get_prefs( + user_id: + ) api_path = '/users/{userId}/prefs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1223,7 +1297,6 @@ def get_prefs(user_id:) params: api_params, response_type: Models::Preferences ) - end # Update the user preferences by its unique ID. The object you pass is stored @@ -1234,22 +1307,25 @@ def get_prefs(user_id:) # @param [Hash] prefs Prefs key-value JSON object. # # @return [Preferences] - def update_prefs(user_id:, prefs:) + def update_prefs( + user_id:, + prefs: + ) api_path = '/users/{userId}/prefs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1263,7 +1339,6 @@ def update_prefs(user_id:, prefs:) params: api_params, response_type: Models::Preferences ) - end # Get the user sessions list by its unique ID. @@ -1272,18 +1347,21 @@ def update_prefs(user_id:, prefs:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SessionList] - def list_sessions(user_id:, total: nil) + def list_sessions( + user_id:, + total: nil + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1296,30 +1374,30 @@ def list_sessions(user_id:, total: nil) params: api_params, response_type: Models::SessionList ) - end # Creates a session for a user. Returns an immediately usable session object. - # + # # If you want to generate a token for a custom authentication flow, use the # [POST # /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) # endpoint. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [Session] - def create_session(user_id:) + def create_session( + user_id: + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1333,25 +1411,25 @@ def create_session(user_id:) params: api_params, response_type: Models::Session ) - end - # Delete all user's sessions by using the user's unique ID. + # Delete all user's sessions by using the user's unique ID. # # @param [String] user_id User ID. # # @return [] - def delete_sessions(user_id:) + def delete_sessions( + user_id: + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1363,7 +1441,6 @@ def delete_sessions(user_id:) headers: api_headers, params: api_params, ) - end # Delete a user sessions by its unique ID. @@ -1372,22 +1449,24 @@ def delete_sessions(user_id:) # @param [String] session_id Session ID. # # @return [] - def delete_session(user_id:, session_id:) + def delete_session( + user_id:, + session_id: + ) api_path = '/users/{userId}/sessions/{sessionId}' .gsub('{userId}', user_id) .gsub('{sessionId}', session_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1399,32 +1478,34 @@ def delete_session(user_id:, session_id:) headers: api_headers, params: api_params, ) - end # Update the user status by its unique ID. Use this endpoint as an - # alternative to deleting a user if you want to keep user's ID reserved. + # alternative to deleting a user if you want to keep user's ID reserved. # # @param [String] user_id User ID. # @param [] status User Status. To activate the user pass `true` and to block the user pass `false`. # # @return [User] - def update_status(user_id:, status:) + def update_status( + user_id:, + status: + ) api_path = '/users/{userId}/status' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if status.nil? - raise Appwrite::Exception.new('Missing required parameter: "status"') + raise Appwrite::Exception.new('Missing required parameter: "status"') end api_params = { status: status, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1438,7 +1519,6 @@ def update_status(user_id:, status:) params: api_params, response_type: Models::User ) - end # List the messaging targets that are associated with a user. @@ -1448,19 +1528,23 @@ def update_status(user_id:, status:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TargetList] - def list_targets(user_id:, queries: nil, total: nil) + def list_targets( + user_id:, + queries: nil, + total: nil + ) api_path = '/users/{userId}/targets' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1473,37 +1557,43 @@ def list_targets(user_id:, queries: nil, total: nil) params: api_params, response_type: Models::TargetList ) - end # Create a messaging target. # # @param [String] user_id User ID. - # @param [String] target_id Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] target_id Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [MessagingProviderType] provider_type The target provider type. Can be one of the following: `email`, `sms` or `push`. # @param [String] identifier The target identifier (token, email, phone etc.) # @param [String] provider_id Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. # # @return [Target] - def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id: nil, name: nil) + def create_target( + user_id:, + target_id:, + provider_type:, + identifier:, + provider_id: nil, + name: nil + ) api_path = '/users/{userId}/targets' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end if provider_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerType"') + raise Appwrite::Exception.new('Missing required parameter: "providerType"') end if identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "identifier"') + raise Appwrite::Exception.new('Missing required parameter: "identifier"') end api_params = { @@ -1513,7 +1603,7 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id providerId: provider_id, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1527,31 +1617,32 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id params: api_params, response_type: Models::Target ) - end - # Get a user's push notification target by ID. + # Get a user's push notification target by ID. # # @param [String] user_id User ID. # @param [String] target_id Target ID. # # @return [Target] - def get_target(user_id:, target_id:) + def get_target( + user_id:, + target_id: + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1564,7 +1655,6 @@ def get_target(user_id:, target_id:) params: api_params, response_type: Models::Target ) - end # Update a messaging target. @@ -1576,17 +1666,23 @@ def get_target(user_id:, target_id:) # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. # # @return [Target] - def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: nil) + def update_target( + user_id:, + target_id:, + identifier: nil, + provider_id: nil, + name: nil + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end api_params = { @@ -1594,7 +1690,7 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: providerId: provider_id, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1608,7 +1704,6 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: params: api_params, response_type: Models::Target ) - end # Delete a messaging target. @@ -1617,22 +1712,24 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: # @param [String] target_id Target ID. # # @return [] - def delete_target(user_id:, target_id:) + def delete_target( + user_id:, + target_id: + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1644,33 +1741,36 @@ def delete_target(user_id:, target_id:) headers: api_headers, params: api_params, ) - end # Returns a token with a secret key for creating a session. Use the user ID # and secret and submit a request to the [PUT # /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) # endpoint to complete the login process. - # + # # # @param [String] user_id User ID. # @param [Integer] length Token length in characters. The default length is 6 characters # @param [Integer] expire Token expiration period in seconds. The default expiration is 15 minutes. # # @return [Token] - def create_token(user_id:, length: nil, expire: nil) + def create_token( + user_id:, + length: nil, + expire: nil + ) api_path = '/users/{userId}/tokens' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { length: length, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1684,7 +1784,6 @@ def create_token(user_id:, length: nil, expire: nil) params: api_params, response_type: Models::Token ) - end # Update the user email verification status by its unique ID. @@ -1693,22 +1792,25 @@ def create_token(user_id:, length: nil, expire: nil) # @param [] email_verification User email verification status. # # @return [User] - def update_email_verification(user_id:, email_verification:) + def update_email_verification( + user_id:, + email_verification: + ) api_path = '/users/{userId}/verification' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email_verification.nil? - raise Appwrite::Exception.new('Missing required parameter: "emailVerification"') + raise Appwrite::Exception.new('Missing required parameter: "emailVerification"') end api_params = { emailVerification: email_verification, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1722,7 +1824,6 @@ def update_email_verification(user_id:, email_verification:) params: api_params, response_type: Models::User ) - end # Update the user phone verification status by its unique ID. @@ -1731,22 +1832,25 @@ def update_email_verification(user_id:, email_verification:) # @param [] phone_verification User phone verification status. # # @return [User] - def update_phone_verification(user_id:, phone_verification:) + def update_phone_verification( + user_id:, + phone_verification: + ) api_path = '/users/{userId}/verification/phone' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if phone_verification.nil? - raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"') + raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"') end api_params = { phoneVerification: phone_verification, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1760,8 +1864,6 @@ def update_phone_verification(user_id:, phone_verification:) params: api_params, response_type: Models::User ) - end - - end + end end diff --git a/lib/appwrite/services/vectors_db.rb b/lib/appwrite/services/vectors_db.rb new file mode 100644 index 00000000..7f90e6db --- /dev/null +++ b/lib/appwrite/services/vectors_db.rb @@ -0,0 +1,1614 @@ +# frozen_string_literal: true + +module Appwrite + class VectorsDB < Service + def initialize(client) + @client = client + end + + # Get a list of all databases from the current Appwrite project. You can use + # the search parameter to filter your results. + # + # @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. You may filter on the following columns: name + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [DatabaseList] + def list( + queries: nil, + total: nil + ) + api_path = '/vectorsdb' + + 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::DatabaseList + ) + end + + # Create a new Database. + # + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database name. Max length: 128 chars. + # @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. + # @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. + # @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. + # @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. + # + # @return [Database] + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/vectorsdb' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + 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::Database + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/vectorsdb/specifications' + + 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::DedicatedDatabaseSpecificationList + ) + end + + # List transactions across all databases. + # + # @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). + # + # @return [TransactionList] + def list_transactions( + queries: nil + ) + api_path = '/vectorsdb/transactions' + + api_params = { + queries: queries, + } + + 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::TransactionList + ) + end + + # Create a new transaction. + # + # @param [Integer] ttl Seconds before the transaction expires. + # + # @return [Transaction] + def create_transaction( + ttl: nil + ) + api_path = '/vectorsdb/transactions' + + api_params = { + ttl: ttl, + } + + 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::Transaction + ) + end + + # Get a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [Transaction] + def get_transaction( + transaction_id: + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + 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::Transaction + ) + end + + # Update a transaction, to either commit or roll back its operations. + # + # @param [String] transaction_id Transaction ID. + # @param [] commit Commit transaction? + # @param [] rollback Rollback transaction? + # + # @return [Transaction] + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + commit: commit, + rollback: rollback, + } + + 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::Transaction + ) + end + + # Delete a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [] + def delete_transaction( + transaction_id: + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + 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 + + # Create multiple operations in a single transaction. + # + # @param [String] transaction_id Transaction ID. + # @param [Array] operations Array of staged operations. + # + # @return [Transaction] + def create_operations( + transaction_id:, + operations: nil + ) + api_path = '/vectorsdb/transactions/{transactionId}/operations' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + operations: operations, + } + + 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::Transaction + ) + end + + # Get a database by its unique ID. This endpoint response returns a JSON + # object with the database metadata. + # + # @param [String] database_id Database ID. + # + # @return [Database] + def get( + database_id: + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::Database + ) + end + + # Update a database by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] name Database name. Max length: 128 chars. + # @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. + # @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. + # @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. + # @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. + # + # @return [Database] + def update( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + 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::Database + ) + end + + # Delete a database by its unique ID. Only API keys with with databases.write + # scope can delete a database. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 a list of all collections that belong to the provided databaseId. You + # can use the search parameter to filter your results. + # + # @param [String] database_id Database ID. + # @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. You may filter on the following attributes: name, enabled, documentSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [VectorsdbCollectionList] + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) + api_path = '/vectorsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + 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::VectorsdbCollectionList + ) + end + + # Create a new Collection. Before using this route, you should create a new + # database resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Integer] dimension Embedding dimension. + # @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). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # + # @return [VectorsdbCollection] + def create_collection( + database_id:, + collection_id:, + name:, + dimension:, + permissions: nil, + document_security: nil, + enabled: nil + ) + api_path = '/vectorsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if dimension.nil? + raise Appwrite::Exception.new('Missing required parameter: "dimension"') + end + + api_params = { + collectionId: collection_id, + name: name, + dimension: dimension, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + } + + 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::VectorsdbCollection + ) + end + + # Get a collection by its unique ID. This endpoint response returns a JSON + # object with the collection metadata. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [VectorsdbCollection] + def get_collection( + database_id:, + collection_id: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + 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::VectorsdbCollection + ) + end + + # Update a collection by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Integer] dimension Embedding dimensions. + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # + # @return [VectorsdbCollection] + def update_collection( + database_id:, + collection_id:, + name:, + dimension: nil, + permissions: nil, + document_security: nil, + enabled: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + dimension: dimension, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + } + + 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::VectorsdbCollection + ) + end + + # Delete a collection by its unique ID. Only users with write permissions + # have access to delete this resource. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [] + def delete_collection( + database_id:, + collection_id: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + 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 a list of all the user's documents in a given collection. You can use + # the query params to filter your results. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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 524288 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + 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::DocumentList + ) + end + + # Create a new Document. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Hash] data Document data as JSON object. + # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # + # @return [Document] + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + documentId: document_id, + data: data, + permissions: permissions, + } + + 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::Document + ) + end + + # Create new Documents. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [Array] documents Array of documents data as JSON objects. + # + # @return [DocumentList] + def create_documents( + database_id:, + collection_id:, + documents: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + } + + 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::DocumentList + ) + end + + # Create or update Documents. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Array] documents Array of document data as JSON objects. May contain partial documents. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + transactionId: transaction_id, + } + + 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::DocumentList + ) + end + + # Update all documents that match your queries, if no queries are submitted + # then all documents are updated. You can pass only specific fields to be + # updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated. + # @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. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + data: data, + queries: queries, + transactionId: transaction_id, + } + + 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::DocumentList + ) + end + + # Bulk delete documents using queries, if no queries are passed then all + # documents are deleted. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + 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, + response_type: Models::DocumentList + ) + end + + # Get a list of all the user's documents in a given collection using a POST + # request. This behaves identically to the list documents endpoint but + # accepts the queries in the request body, allowing much larger `queries` + # arrays than can fit in a URL query string. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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 524288 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def create_query( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/query' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + 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::DocumentList + ) + end + + # Get a document by its unique ID. This endpoint response returns a JSON + # object with the document data. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @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. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # + # @return [Document] + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Create or update a Document. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Update a document by its unique ID. Using the patch method you can pass + # only specific fields that will get updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + 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::Document + ) + end + + # Delete a document by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [] + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + transactionId: transaction_id, + } + + 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 + + # List indexes in the collection. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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. You may filter on the following attributes: key, type, status, attributes, error + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [IndexList] + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + 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::IndexList + ) + end + + # Creates an index on the attributes listed. Your index should include all + # the attributes you will query in a single request. + # Attributes can be `key`, `fulltext`, and `unique`. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # @param [VectorsDBIndexType] type Index type. + # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed. + # @param [Array] lengths Length of index. Maximum of 100 + # + # @return [Index] + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + if attributes.nil? + raise Appwrite::Exception.new('Missing required parameter: "attributes"') + end + + api_params = { + key: key, + type: type, + attributes: attributes, + orders: orders, + lengths: lengths, + } + + 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::Index + ) + end + + # Get index by ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [Index] + def get_index( + database_id:, + collection_id:, + key: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + 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::Index + ) + end + + # Delete an index. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [] + def delete_index( + database_id:, + collection_id:, + key: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + 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 + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/vectorsdb/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + 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::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/vectorsdb/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + 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::DedicatedDatabaseOperationList + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/vectorsdb/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DedicatedDatabaseReplicas + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/vectorsdb/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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::DatabaseStatus + ) + end + end +end diff --git a/lib/appwrite/services/webhooks.rb b/lib/appwrite/services/webhooks.rb index c9886708..893cc08e 100644 --- a/lib/appwrite/services/webhooks.rb +++ b/lib/appwrite/services/webhooks.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Webhooks < Service - def initialize(client) @client = client end @@ -14,14 +13,17 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [WebhookList] - def list(queries: nil, total: nil) + def list( + queries: nil, + total: nil + ) api_path = '/webhooks' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -34,13 +36,12 @@ def list(queries: nil, total: nil) params: api_params, response_type: Models::WebhookList ) - end # Create a new webhook. Use this endpoint to configure a URL that will # receive events from Appwrite when specific events occur. # - # @param [String] webhook_id Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] webhook_id Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] url Webhook URL. # @param [String] name Webhook name. Max length: 128 chars. # @param [Array] events Events list. Maximum of 100 events are allowed. @@ -51,23 +52,33 @@ def list(queries: nil, total: nil) # @param [String] secret Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. # # @return [Webhook] - def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_username: nil, auth_password: nil, secret: nil) + def create( + webhook_id:, + url:, + name:, + events:, + enabled: nil, + tls: nil, + auth_username: nil, + auth_password: nil, + secret: nil + ) api_path = '/webhooks' if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if events.nil? - raise Appwrite::Exception.new('Missing required parameter: "events"') + raise Appwrite::Exception.new('Missing required parameter: "events"') end api_params = { @@ -81,7 +92,7 @@ def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_usern authPassword: auth_password, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -95,26 +106,26 @@ def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_usern params: api_params, response_type: Models::Webhook ) - end # Get a webhook by its unique ID. This endpoint returns details about a - # specific webhook configured for a project. + # specific webhook configured for a project. # # @param [String] webhook_id Webhook ID. # # @return [Webhook] - def get(webhook_id:) + def get( + webhook_id: + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -127,7 +138,6 @@ def get(webhook_id:) params: api_params, response_type: Models::Webhook ) - end # Update a webhook by its unique ID. Use this endpoint to update the URL, @@ -143,24 +153,33 @@ def get(webhook_id:) # @param [String] auth_password Webhook HTTP password. Max length: 256 chars. # # @return [Webhook] - def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_username: nil, auth_password: nil) + def update( + webhook_id:, + name:, + url:, + events:, + enabled: nil, + tls: nil, + auth_username: nil, + auth_password: nil + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if events.nil? - raise Appwrite::Exception.new('Missing required parameter: "events"') + raise Appwrite::Exception.new('Missing required parameter: "events"') end api_params = { @@ -172,7 +191,7 @@ def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_usern authUsername: auth_username, authPassword: auth_password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -186,26 +205,26 @@ def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_usern params: api_params, response_type: Models::Webhook ) - end # Delete a webhook by its unique ID. Once deleted, the webhook will no longer - # receive project events. + # receive project events. # # @param [String] webhook_id Webhook ID. # # @return [] - def delete(webhook_id:) + def delete( + webhook_id: + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -217,7 +236,6 @@ def delete(webhook_id:) headers: api_headers, params: api_params, ) - end # Update the webhook signing key. This endpoint can be used to regenerate the @@ -228,18 +246,21 @@ def delete(webhook_id:) # @param [String] secret Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. # # @return [Webhook] - def update_secret(webhook_id:, secret: nil) + def update_secret( + webhook_id:, + secret: nil + ) api_path = '/webhooks/{webhookId}/secret' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end api_params = { secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -253,8 +274,6 @@ def update_secret(webhook_id:, secret: nil) params: api_params, response_type: Models::Webhook ) - end - - end + end end From d6b26127a97d963e22206dd27e1d650f12a180a2 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 27 Aug 2026 18:28:17 +0530 Subject: [PATCH 10/10] chore: update Ruby SDK to 28.0.0.rc1 --- CHANGELOG.md | 5 ++++- appwrite.gemspec | 2 +- lib/appwrite/client.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a15fd1ba..b8f69527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Change Log -## 27.1.0.rc1 +## 28.0.0.rc1 +* Breaking: `Execution.functionId` is replaced by `resourceId` and `resourceType`, now that executions cover both functions and sites +* Breaking: removed `dedicatedDatabases.execute` from `ProjectKeyScopes` +* Breaking: `EmbeddingModel` no longer offers `embedding-gemma` or `bge-small` * Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs * Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums * Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions diff --git a/appwrite.gemspec b/appwrite.gemspec index e0d88aab..a6623af0 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '27.1.0.rc1' + spec.version = '28.0.0.rc1' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 0f7eb1bd..c5328a04 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -14,7 +14,7 @@ def initialize 'x-sdk-name' => 'Ruby', 'x-sdk-platform' => 'server', 'x-sdk-language' => 'ruby', - 'x-sdk-version' => '27.1.0.rc1', + 'x-sdk-version' => '28.0.0.rc1', 'X-Appwrite-Response-Format' => '1.9.6' } @endpoint = 'https://cloud.appwrite.io/v1'