diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e4fa59..37d2172a 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, 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 +* 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..94eb7fb0 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', "Bearer #{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..ad31ce7f --- /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: map["limits"].nil? ? nil : BillingPlanLimits.from(map: map["limits"]), + group: map["group"], + program: map["program"].nil? ? nil : Program.from(map: map["program"]), + dedicated_databases: map["dedicatedDatabases"].nil? ? nil : 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..2cdbe8e0 --- /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: map["billingLimits"].nil? ? nil : 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..15d5056a 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,20 +160,27 @@ 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) }, 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"], + 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,20 +208,27 @@ 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 }, "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, + "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(