From 11a8e82ad904a9d5f3bc0fd927d8d1672807d2d7 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Sep 2026 14:05:56 +0100 Subject: [PATCH] chore: update Ruby SDK to 28.0.0 --- CHANGELOG.md | 11 +++ README.md | 4 +- appwrite.gemspec | 2 +- docs/examples/documentsdb/create-document.md | 3 +- docs/examples/documentsdb/create-documents.md | 3 +- .../project/update-o-auth-2-cloudflare.md | 18 ++++ .../project/update-o-auth-2-resend.md | 18 ++++ ...cutover-migration.md => create-cutover.md} | 2 +- docs/examples/vectorsdb/create-document.md | 3 +- docs/examples/vectorsdb/create-documents.md | 3 +- lib/appwrite.rb | 2 + lib/appwrite/client.rb | 4 +- lib/appwrite/enums/o_auth_provider.rb | 2 + lib/appwrite/enums/project_key_scopes.rb | 4 + .../enums/project_o_auth_provider_id.rb | 2 + lib/appwrite/models/billing_plan.rb | 5 ++ lib/appwrite/models/dedicated_database.rb | 5 ++ lib/appwrite/models/o_auth2_cloudflare.rb | 42 ++++++++++ lib/appwrite/models/o_auth2_resend.rb | 42 ++++++++++ lib/appwrite/services/account.rb | 2 +- lib/appwrite/services/avatars.rb | 23 +++--- lib/appwrite/services/documents_db.rb | 10 ++- lib/appwrite/services/mongo.rb | 12 +-- lib/appwrite/services/mysql.rb | 12 +-- lib/appwrite/services/postgresql.rb | 12 +-- lib/appwrite/services/project.rb | 82 ++++++++++++++++++- lib/appwrite/services/tables_db.rb | 4 +- lib/appwrite/services/vectors_db.rb | 10 ++- 28 files changed, 296 insertions(+), 46 deletions(-) create mode 100644 docs/examples/project/update-o-auth-2-cloudflare.md create mode 100644 docs/examples/project/update-o-auth-2-resend.md rename docs/examples/tablesdb/{cutover-migration.md => create-cutover.md} (90%) create mode 100644 lib/appwrite/models/o_auth2_cloudflare.rb create mode 100644 lib/appwrite/models/o_auth2_resend.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index b8f69527..8a2ae6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 28.0.0 + +* Stable release of the dedicated database APIs: `mysql`, `postgresql`, `mongo`, `documentsDB`, and `vectorsDB` services, previously released as release candidates +* Breaking: `tablesDB.cutoverMigration` is renamed to `tablesDB.createCutover` +* Breaking: `Execution.functionId` is replaced by `resourceId` and `resourceType`, covering function and site executions +* Added: Cloudflare, Resend, and Hugging Face OAuth providers +* Added: `usageAggregateOnlyMetrics` on the `BillingPlan` model +* Fixed: `transactionId` is accepted again by `documentsDB` and `vectorsDB` `createDocument` and `createDocuments` +* Updated: `X-Appwrite-Response-Format` is now `2.0.0` +* Updated: `FrameworkAdapter.fallbackFile` is now optional + ## 28.0.0.rc1 * Breaking: `Execution.functionId` is replaced by `resourceId` and `resourceType`, now that executions cover both functions and sites diff --git a/README.md b/README.md index 5f92ccbc..ebd62348 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Ruby SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.6-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-2.0.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).** +**This SDK targets Appwrite server version 1.9.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-ruby/releases) when APIs differ. Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite.gemspec b/appwrite.gemspec index a6623af0..a453cd63 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '28.0.0.rc1' + spec.version = '28.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/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md index 074b9b7f..94b68b35 100644 --- a/docs/examples/documentsdb/create-document.md +++ b/docs/examples/documentsdb/create-document.md @@ -23,6 +23,7 @@ result = documents_db.create_document( "age" => 30, "isAdmin" => false }, - permissions: [Permission.read(Role.any())] # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional ) ``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md index feb10f30..1277f4ac 100644 --- a/docs/examples/documentsdb/create-documents.md +++ b/docs/examples/documentsdb/create-documents.md @@ -13,6 +13,7 @@ documents_db = DocumentsDB.new(client) result = documents_db.create_documents( database_id: '', collection_id: '', - documents: [] + documents: [], + transaction_id: '' # optional ) ``` diff --git a/docs/examples/project/update-o-auth-2-cloudflare.md b/docs/examples/project/update-o-auth-2-cloudflare.md new file mode 100644 index 00000000..7b143a7e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-cloudflare.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_o_auth2_cloudflare( + client_id: '', # optional + client_secret: '', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-resend.md b/docs/examples/project/update-o-auth-2-resend.md new file mode 100644 index 00000000..c88eb5a8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-resend.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_o_auth2_resend( + client_id: '', # optional + client_secret: '', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/tablesdb/cutover-migration.md b/docs/examples/tablesdb/create-cutover.md similarity index 90% rename from docs/examples/tablesdb/cutover-migration.md rename to docs/examples/tablesdb/create-cutover.md index 62879a07..a566a147 100644 --- a/docs/examples/tablesdb/cutover-migration.md +++ b/docs/examples/tablesdb/create-cutover.md @@ -10,7 +10,7 @@ client = Client.new tables_db = TablesDB.new(client) -result = tables_db.cutover_migration( +result = tables_db.create_cutover( database_id: '', migration_id: '' ) diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md index 4ad9aa46..648d9b2c 100644 --- a/docs/examples/vectorsdb/create-document.md +++ b/docs/examples/vectorsdb/create-document.md @@ -27,6 +27,7 @@ result = vectors_db.create_document( "key" => "value" } }, - permissions: [Permission.read(Role.any())] # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional ) ``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md index 0fcac72b..9f3a4d4d 100644 --- a/docs/examples/vectorsdb/create-documents.md +++ b/docs/examples/vectorsdb/create-documents.md @@ -13,6 +13,7 @@ vectors_db = VectorsDB.new(client) result = vectors_db.create_documents( database_id: '', collection_id: '', - documents: [] + documents: [], + transaction_id: '' # optional ) ``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 80c58ed1..6e6c992f 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -171,6 +171,7 @@ require_relative 'appwrite/models/o_auth2_notion' require_relative 'appwrite/models/o_auth2_salesforce' require_relative 'appwrite/models/o_auth2_yahoo' +require_relative 'appwrite/models/o_auth2_cloudflare' require_relative 'appwrite/models/o_auth2_hugging_face' require_relative 'appwrite/models/o_auth2_linkedin' require_relative 'appwrite/models/o_auth2_disqus' @@ -190,6 +191,7 @@ require_relative 'appwrite/models/o_auth2_kick' require_relative 'appwrite/models/o_auth2_apple' require_relative 'appwrite/models/o_auth2_microsoft' +require_relative 'appwrite/models/o_auth2_resend' require_relative 'appwrite/models/o_auth2_provider_list' require_relative 'appwrite/models/policy_password_dictionary' require_relative 'appwrite/models/policy_password_history' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index c5328a04..b93d1028 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -14,8 +14,8 @@ def initialize 'x-sdk-name' => 'Ruby', 'x-sdk-platform' => 'server', 'x-sdk-language' => 'ruby', - 'x-sdk-version' => '28.0.0.rc1', - 'X-Appwrite-Response-Format' => '1.9.6' + 'x-sdk-version' => '28.0.0', + 'X-Appwrite-Response-Format' => '2.0.0' } @endpoint = 'https://cloud.appwrite.io/v1' @config = {} diff --git a/lib/appwrite/enums/o_auth_provider.rb b/lib/appwrite/enums/o_auth_provider.rb index 8cb20b5a..13025937 100644 --- a/lib/appwrite/enums/o_auth_provider.rb +++ b/lib/appwrite/enums/o_auth_provider.rb @@ -10,6 +10,7 @@ module OAuthProvider BITBUCKET = 'bitbucket' BITLY = 'bitly' BOX = 'box' + CLOUDFLARE = 'cloudflare' DAILYMOTION = 'dailymotion' DISCORD = 'discord' DISQUS = 'disqus' @@ -32,6 +33,7 @@ module OAuthProvider PAYPAL = 'paypal' PAYPALSANDBOX = 'paypalSandbox' PODIO = 'podio' + RESEND = 'resend' SALESFORCE = 'salesforce' SLACK = 'slack' SPOTIFY = 'spotify' diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index 4052d94d..388f0004 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -49,12 +49,16 @@ module ProjectKeyScopes DOCUMENTSDB_COLLECTIONS_WRITE = 'documentsdb.collections.write' DOCUMENTSDB_DOCUMENTS_READ = 'documentsdb.documents.read' DOCUMENTSDB_DOCUMENTS_WRITE = 'documentsdb.documents.write' + DOCUMENTSDB_INDEXES_READ = 'documentsdb.indexes.read' + DOCUMENTSDB_INDEXES_WRITE = 'documentsdb.indexes.write' VECTORSDB_READ = 'vectorsdb.read' VECTORSDB_WRITE = 'vectorsdb.write' VECTORSDB_COLLECTIONS_READ = 'vectorsdb.collections.read' VECTORSDB_COLLECTIONS_WRITE = 'vectorsdb.collections.write' VECTORSDB_DOCUMENTS_READ = 'vectorsdb.documents.read' VECTORSDB_DOCUMENTS_WRITE = 'vectorsdb.documents.write' + VECTORSDB_INDEXES_READ = 'vectorsdb.indexes.read' + VECTORSDB_INDEXES_WRITE = 'vectorsdb.indexes.write' BUCKETS_READ = 'buckets.read' BUCKETS_WRITE = 'buckets.write' FILES_READ = 'files.read' diff --git a/lib/appwrite/enums/project_o_auth_provider_id.rb b/lib/appwrite/enums/project_o_auth_provider_id.rb index ae433e08..f6b4c97c 100644 --- a/lib/appwrite/enums/project_o_auth_provider_id.rb +++ b/lib/appwrite/enums/project_o_auth_provider_id.rb @@ -10,6 +10,7 @@ module ProjectOAuthProviderId BITBUCKET = 'bitbucket' BITLY = 'bitly' BOX = 'box' + CLOUDFLARE = 'cloudflare' DAILYMOTION = 'dailymotion' DISCORD = 'discord' DISQUS = 'disqus' @@ -32,6 +33,7 @@ module ProjectOAuthProviderId PAYPAL = 'paypal' PAYPALSANDBOX = 'paypalSandbox' PODIO = 'podio' + RESEND = 'resend' SALESFORCE = 'salesforce' SLACK = 'slack' SPOTIFY = 'spotify' diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index b56d1473..4f8c18a4 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -40,6 +40,7 @@ class BillingPlan attr_reader :activity_logs attr_reader :usage_logs attr_reader :usage_logs_intervals + attr_reader :usage_aggregate_only_metrics attr_reader :project_inactivity_days attr_reader :alert_limit attr_reader :usage @@ -113,6 +114,7 @@ def initialize( activity_logs:, usage_logs:, usage_logs_intervals:, + usage_aggregate_only_metrics:, project_inactivity_days:, alert_limit:, usage:, @@ -185,6 +187,7 @@ def initialize( @activity_logs = activity_logs @usage_logs = usage_logs @usage_logs_intervals = usage_logs_intervals + @usage_aggregate_only_metrics = usage_aggregate_only_metrics @project_inactivity_days = project_inactivity_days @alert_limit = alert_limit @usage = usage @@ -260,6 +263,7 @@ def self.from(map:) activity_logs: map["activityLogs"], usage_logs: map["usageLogs"], usage_logs_intervals: map["usageLogsIntervals"], + usage_aggregate_only_metrics: map["usageAggregateOnlyMetrics"], project_inactivity_days: map["projectInactivityDays"], alert_limit: map["alertLimit"], usage: UsageBillingPlan.from(map: map["usage"]), @@ -336,6 +340,7 @@ def to_map "activityLogs": @activity_logs, "usageLogs": @usage_logs, "usageLogsIntervals": @usage_logs_intervals, + "usageAggregateOnlyMetrics": @usage_aggregate_only_metrics, "projectInactivityDays": @project_inactivity_days, "alertLimit": @alert_limit, "usage": @usage.to_map, diff --git a/lib/appwrite/models/dedicated_database.rb b/lib/appwrite/models/dedicated_database.rb index 9b21a355..fd4b0b04 100644 --- a/lib/appwrite/models/dedicated_database.rb +++ b/lib/appwrite/models/dedicated_database.rb @@ -17,6 +17,7 @@ class DedicatedDatabase attr_reader :connection_port attr_reader :connection_user attr_reader :connection_password + attr_reader :credential_generation attr_reader :connection_string attr_reader :ssl attr_reader :status @@ -67,6 +68,7 @@ def initialize( connection_port:, connection_user:, connection_password:, + credential_generation:, connection_string:, ssl:, status:, @@ -116,6 +118,7 @@ def initialize( @connection_port = connection_port @connection_user = connection_user @connection_password = connection_password + @credential_generation = credential_generation @connection_string = connection_string @ssl = ssl @status = status @@ -168,6 +171,7 @@ def self.from(map:) connection_port: map["connectionPort"], connection_user: map["connectionUser"], connection_password: map["connectionPassword"], + credential_generation: map["credentialGeneration"], connection_string: map["connectionString"], ssl: map["ssl"], status: map["status"], @@ -221,6 +225,7 @@ def to_map "connectionPort": @connection_port, "connectionUser": @connection_user, "connectionPassword": @connection_password, + "credentialGeneration": @credential_generation, "connectionString": @connection_string, "ssl": @ssl, "status": @status, diff --git a/lib/appwrite/models/o_auth2_cloudflare.rb b/lib/appwrite/models/o_auth2_cloudflare.rb new file mode 100644 index 00000000..7f3e65bf --- /dev/null +++ b/lib/appwrite/models/o_auth2_cloudflare.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class OAuth2Cloudflare + 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:) + OAuth2Cloudflare.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_resend.rb b/lib/appwrite/models/o_auth2_resend.rb new file mode 100644 index 00000000..9a64087d --- /dev/null +++ b/lib/appwrite/models/o_auth2_resend.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class OAuth2Resend + 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:) + OAuth2Resend.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/services/account.rb b/lib/appwrite/services/account.rb index e32c1309..ab71eebf 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -1550,7 +1550,7 @@ def create_magic_url_token( # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, 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. diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index fb6cafec..42f27720 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -289,22 +289,25 @@ def get_initials( # OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in # static fallback. # - # The photo resolves for the currently authenticated user unless `userId` - # points at another user. Passing `emailHash` and/or `name` resolves the - # avatar from those values alone: the hash is looked up on Gravatar and - # Libravatar, the name is rendered as initials, and the user's own identity - # photos, email, and name leave the chain so they never shadow the avatar - # being asked for. Emails are only ever accepted pre-hashed, so no address - # ends up in a URL. + # Passing `userId` — `current()` for the authenticated user — resolves + # the photo from everything known about that user: identity photos, email, + # and name. An explicit `emailHash` or `name` then overrides just that value, + # and the user's remaining sources stay in the chain. Without `userId`, + # passing `emailHash` and/or `name` resolves the avatar from those values + # alone: the hash is looked up on Gravatar and Libravatar, the name is + # rendered as initials, and the session user stays out of the chain so their + # own photo never shadows the avatar being asked for. When nothing is passed, + # the photo resolves for the currently authenticated user. Emails are only + # ever accepted pre-hashed, so no address ends up in a URL. # # @param [Integer] width Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. # @param [Integer] height Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. # @param [Integer] quality Output image quality between 0 and 100. Defaults to 100. # @param [String] output Output image format. Defaults to 'png'. # @param [String] rating Maximum image rating to fetch from Gravatar/Libravatar. Defaults to 'g'. - # @param [String] user_id User ID to resolve the photo for. Defaults to 'current()' for the currently authenticated user. - # @param [String] email_hash SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own photo sources. Pass the hash, never the address itself. - # @param [String] name Name to render initials from instead of the user's own photo sources. Max length: 128 chars. + # @param [String] user_id User ID to resolve the photo for. Pass 'current()' for the currently authenticated user. When omitted, the session user is used only if no emailHash and no name is passed. + # @param [String] email_hash SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own email. Pass the hash, never the address itself. + # @param [String] name Name to render initials from instead of the user's own name. Max length: 128 chars. # # @return [] def get_photo( diff --git a/lib/appwrite/services/documents_db.rb b/lib/appwrite/services/documents_db.rb index 4869c1f4..09237e92 100644 --- a/lib/appwrite/services/documents_db.rb +++ b/lib/appwrite/services/documents_db.rb @@ -729,6 +729,7 @@ def list_documents( # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Document data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] def create_document( @@ -736,7 +737,8 @@ def create_document( collection_id:, document_id:, data:, - permissions: nil + permissions: nil, + transaction_id: nil ) api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) @@ -762,6 +764,7 @@ def create_document( documentId: document_id, data: data, permissions: permissions, + transactionId: transaction_id, } api_headers = { @@ -787,12 +790,14 @@ def create_document( # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. # @param [Array] documents Array of documents data as JSON objects. + # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] def create_documents( database_id:, collection_id:, - documents: + documents:, + transaction_id: nil ) api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) @@ -812,6 +817,7 @@ def create_documents( api_params = { documents: documents, + transactionId: transaction_id, } api_headers = { diff --git a/lib/appwrite/services/mongo.rb b/lib/appwrite/services/mongo.rb index b745310b..0c95972a 100644 --- a/lib/appwrite/services/mongo.rb +++ b/lib/appwrite/services/mongo.rb @@ -868,14 +868,14 @@ def delete_branch( ) end - # Rotate the primary connection credentials for a dedicated database. - # Generates a new password and updates the database atomically. Previous - # credentials stop working immediately. Returns the database with a refreshed - # connection string carrying the new password. + # Queue a rotation of the primary connection credentials for a dedicated + # database. A hibernated database is woken by the worker before rotation. + # List database operations until the returned operation reaches a terminal + # status, then fetch the database again for the refreshed connection string. # # @param [String] database_id Database ID. # - # @return [DedicatedDatabase] + # @return [DedicatedDatabaseOperation] def update_credentials( database_id: ) @@ -899,7 +899,7 @@ def update_credentials( path: api_path, headers: api_headers, params: api_params, - response_type: Models::DedicatedDatabase + response_type: Models::DedicatedDatabaseOperation ) end diff --git a/lib/appwrite/services/mysql.rb b/lib/appwrite/services/mysql.rb index 1a9cf257..2e21c83c 100644 --- a/lib/appwrite/services/mysql.rb +++ b/lib/appwrite/services/mysql.rb @@ -868,14 +868,14 @@ def delete_branch( ) end - # Rotate the primary connection credentials for a dedicated database. - # Generates a new password and updates the database atomically. Previous - # credentials stop working immediately. Returns the database with a refreshed - # connection string carrying the new password. + # Queue a rotation of the primary connection credentials for a dedicated + # database. A hibernated database is woken by the worker before rotation. + # List database operations until the returned operation reaches a terminal + # status, then fetch the database again for the refreshed connection string. # # @param [String] database_id Database ID. # - # @return [DedicatedDatabase] + # @return [DedicatedDatabaseOperation] def update_credentials( database_id: ) @@ -899,7 +899,7 @@ def update_credentials( path: api_path, headers: api_headers, params: api_params, - response_type: Models::DedicatedDatabase + response_type: Models::DedicatedDatabaseOperation ) end diff --git a/lib/appwrite/services/postgresql.rb b/lib/appwrite/services/postgresql.rb index 24c1ceb5..cd67e74e 100644 --- a/lib/appwrite/services/postgresql.rb +++ b/lib/appwrite/services/postgresql.rb @@ -868,14 +868,14 @@ def delete_branch( ) end - # Rotate the primary connection credentials for a dedicated database. - # Generates a new password and updates the database atomically. Previous - # credentials stop working immediately. Returns the database with a refreshed - # connection string carrying the new password. + # Queue a rotation of the primary connection credentials for a dedicated + # database. A hibernated database is woken by the worker before rotation. + # List database operations until the returned operation reaches a terminal + # status, then fetch the database again for the refreshed connection string. # # @param [String] database_id Database ID. # - # @return [DedicatedDatabase] + # @return [DedicatedDatabaseOperation] def update_credentials( database_id: ) @@ -899,7 +899,7 @@ def update_credentials( path: api_path, headers: api_headers, params: api_params, - response_type: Models::DedicatedDatabase + response_type: Models::DedicatedDatabaseOperation ) end diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index fa543cf4..6235af24 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -932,6 +932,41 @@ def update_o_auth2_box( ) end + # Update the project OAuth2 Cloudflare configuration. + # + # @param [String] client_id 'Client ID' of Cloudflare OAuth2 app. For example: 4b866000000000000000000000c9e4e2 + # @param [String] client_secret 'Client Secret' of Cloudflare OAuth2 app. For example: cfoc_5Q6YRl0000000000000000000000000000000000003d214f + # @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 [OAuth2Cloudflare] + def update_o_auth2_cloudflare( + client_id: nil, + client_secret: nil, + enabled: nil + ) + api_path = '/project/oauth2/cloudflare' + + 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::OAuth2Cloudflare + ) + end + # Update the project OAuth2 Dailymotion configuration. # # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f @@ -1744,6 +1779,41 @@ def update_o_auth2_podio( ) end + # Update the project OAuth2 Resend configuration. + # + # @param [String] client_id 'Client ID' of Resend OAuth2 app. For example: f47ac10b-58cc-4372-a567-0e02b2c3d479 + # @param [String] client_secret 'Client Secret' of Resend OAuth2 app. For example: 9c1e4b00000000000000000000000000000000000000000000000000a72d5f4 + # @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 [OAuth2Resend] + def update_o_auth2_resend( + client_id: nil, + client_secret: nil, + enabled: nil + ) + api_path = '/project/oauth2/resend' + + 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::OAuth2Resend + ) + end + # Update the project OAuth2 Salesforce configuration. # # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq @@ -2204,7 +2274,7 @@ def update_o_auth2_zoom( # # @param [ProjectOAuthProviderId] provider_id OAuth2 provider key. For example: github, google, apple. # - # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] + # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] def get_o_auth2_provider( provider_id: ) @@ -2353,6 +2423,16 @@ def get_o_auth2_provider( return Models::OAuth2HuggingFace.from(map: response) end + if response['$id'] == 'resend' + + return Models::OAuth2Resend.from(map: response) + end + + if response['$id'] == 'cloudflare' + + return Models::OAuth2Cloudflare.from(map: response) + end + if response['$id'] == 'linkedin' return Models::OAuth2Linkedin.from(map: response) diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index ab1c72fa..c1ee72b5 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -632,11 +632,11 @@ def delete_migration( # @param [String] migration_id Migration ID. # # @return [DatabaseMigration] - def cutover_migration( + def create_cutover( database_id:, migration_id: ) - api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover' + api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutovers' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) diff --git a/lib/appwrite/services/vectors_db.rb b/lib/appwrite/services/vectors_db.rb index 7f90e6db..c0b1fa6e 100644 --- a/lib/appwrite/services/vectors_db.rb +++ b/lib/appwrite/services/vectors_db.rb @@ -730,6 +730,7 @@ def list_documents( # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Document data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] def create_document( @@ -737,7 +738,8 @@ def create_document( collection_id:, document_id:, data:, - permissions: nil + permissions: nil, + transaction_id: nil ) api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) @@ -763,6 +765,7 @@ def create_document( documentId: document_id, data: data, permissions: permissions, + transactionId: transaction_id, } api_headers = { @@ -788,12 +791,14 @@ def create_document( # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. # @param [Array] documents Array of documents data as JSON objects. + # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] def create_documents( database_id:, collection_id:, - documents: + documents:, + transaction_id: nil ) api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) @@ -813,6 +818,7 @@ def create_documents( api_params = { documents: documents, + transactionId: transaction_id, } api_headers = {