From 7e8b444373a4310556468150de74a207d16586c8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 10:47:45 +0530 Subject: [PATCH 1/8] 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 2/8] 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 3/8] 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 4/8] 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 5/8] 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 6/8] 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 7/8] 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 8/8] 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