diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..60ec903 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,26 @@ +# RuboCop layout for the generated Ruby SDK. +# IndentationWidth 4 matches the published sdk-for-ruby house style. +# Only Layout cops are enabled: this is a formatter check, not a full linter. +AllCops: + NewCops: enable + TargetRubyVersion: 2.7 + SuggestExtensions: false + DisabledByDefault: true + Exclude: + - '.github/**/*' + - 'vendor/**/*' + - '.bundle/**/*' + +Layout: + Enabled: true + +Layout/IndentationWidth: + Width: 4 + +Layout/LineLength: + Max: 200 + AllowedPatterns: + - '^\s*#' + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: indented diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e27c2..b8f6952 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Change Log +## 28.0.0.rc1 + +* Breaking: `Execution.functionId` is replaced by `resourceId` and `resourceType`, now that executions cover both functions and sites +* Breaking: removed `dedicatedDatabases.execute` from `ProjectKeyScopes` +* Breaking: `EmbeddingModel` no longer offers `embedding-gemma` or `bge-small` +* Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs +* Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums +* Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions +* Added: `PostgresExtension`, `VectorsdbCollection`, `AttributeObject`, and `AttributeVector` models +* Added: `ExecutionResourceType` enum and `resourceType` on the `Execution` model +* Added: `OAuth2HuggingFace` model and the `huggingface` OAuth provider +* Added: `userId`, `emailHash`, and `name` parameters to `avatars.getPhoto` +* Added: `error`, `containerStatus`, and `lifecycleState` on the `Database` model +* Added: `changelogWatermark` on the `DatabaseMigration` model +* Added: `total` on the `DedicatedDatabaseBranchList` model +* Updated: `DedicatedDatabaseOperation.status` documents the new `queued` state + ## 27.0.0 * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either diff --git a/Gemfile b/Gemfile index cd8aa9e..fa75df1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gemspec \ No newline at end of file +gemspec diff --git a/appwrite.gemspec b/appwrite.gemspec index 477ba72..a6623af 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,13 +1,12 @@ Gem::Specification.new do |spec| + spec.name = 'appwrite' + spec.version = '28.0.0.rc1' + spec.license = 'BSD-3-Clause' + spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' + spec.author = 'Appwrite Team' + spec.homepage = 'https://appwrite.io/support' + spec.email = 'team@appwrite.io' + spec.files = Dir['lib/**/*.rb'] - spec.name = 'appwrite' - spec.version = '27.0.0' - spec.license = 'BSD-3-Clause' - spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' - spec.author = 'Appwrite Team' - spec.homepage = 'https://appwrite.io/support' - spec.email = 'team@appwrite.io' - spec.files = Dir['lib/**/*.rb'] - - spec.add_dependency 'mime-types', '~> 3.4.1' -end \ No newline at end of file + spec.add_dependency 'mime-types', '~> 3.4.1' +end diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 695ccf7..728777d 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -14,6 +14,6 @@ result = avatars.get_initials( name: '', # optional width: 0, # optional height: 0, # optional - background: '' # optional + background: 'FFFFFF' # optional ) ``` diff --git a/docs/examples/avatars/get-photo.md b/docs/examples/avatars/get-photo.md new file mode 100644 index 0000000..37659bc --- /dev/null +++ b/docs/examples/avatars/get-photo.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_photo( + width: 0, # optional + height: 0, # optional + quality: 0, # optional + output: 'png', # optional + rating: 'g', # optional + user_id: 'current()', # optional + email_hash: '', # optional + name: '' # optional +) +``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md index 38013d1..b808068 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_big_int_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 1000000, # optional + default: 0, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index a02b607..95879a9 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_boolean_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: false, # optional array: false # optional diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 603230e..8cc00ea 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_datetime_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', # optional array: false # optional diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 7059274..29d0224 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_email_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'email@example.com', # optional array: false # optional diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index c7737fc..e5975c0 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_enum_attribute( database_id: '', collection_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', # optional + default: 'active', # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 3c0a5f0..62eeecd 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_float_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10.5, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 454ba82..e3e9238 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -14,7 +14,7 @@ databases = Databases.new(client) result = databases.create_index( database_id: '', collection_id: '', - key: '', + key: '', type: DatabasesIndexType::KEY, attributes: [], orders: [OrderBy::ASC], # optional diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 7691bf0..6b6d3a8 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.create_integer_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10, # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 9e783e3..a64553f 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_ip_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: '192.0.2.0', # optional array: false # optional ) ``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 1ade2aa..8c2845f 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_line_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] # optional ) diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index b7a8f4d..a7cc06f 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_longtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 5806ff6..84b609c 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_mediumtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 12a0010..cb61a86 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_point_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [1, 2] # optional ) diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index 181c5e7..2a3e433 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_polygon_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] # optional ) diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index bc6f32f..fca5aad 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -17,8 +17,8 @@ result = databases.create_relationship_attribute( related_collection_id: '', type: RelationshipType::ONETOONE, two_way: false, # optional - key: '', # optional - two_way_key: '', # optional + key: '', # optional + two_way_key: '', # optional on_delete: RelationMutate::CASCADE # optional ) ``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 2aefa55..0145780 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_string_attribute( database_id: '', collection_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index bc3f4fb..b231a0a 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.create_text_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index f20c77c..4078fb1 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -13,7 +13,7 @@ databases = Databases.new(client) result = databases.create_url_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'https://example.com', # optional array: false # optional diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index fe56f85..5d965bd 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.create_varchar_attribute( database_id: '', collection_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index fd97e5f..a91aafc 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -14,9 +14,9 @@ result = databases.decrement_document_attribute( database_id: '', collection_id: '', document_id: '', - attribute: '', - value: null, # optional - min: null, # optional + attribute: '', + value: 1, # optional + min: 0, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 089fdab..56269a2 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.delete_attribute( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 5b80525..404bc9b 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.delete_index( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 5b1c53e..7753ac4 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.get_attribute( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 0e1892a..fb6557c 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -13,6 +13,6 @@ databases = Databases.new(client) result = databases.get_index( database_id: '', collection_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index ced8cc9..d3992e6 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -14,9 +14,9 @@ result = databases.increment_document_attribute( database_id: '', collection_id: '', document_id: '', - attribute: '', - value: null, # optional - max: null, # optional + attribute: '', + value: 1, # optional + max: 100, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md index ed0194b..33d5b1f 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_big_int_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 0, + min: 0, # optional + max: 1000000, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 36d16af..086ffb2 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_boolean_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: false, - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 342314a..b56c180 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_datetime_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 9b8f027..2079408 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_email_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'email@example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index a5d253f..a3f66c4 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_enum_attribute( database_id: '', collection_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - new_key: '' # optional + default: 'active', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 8c03c9a..5a652c7 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_float_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10.5, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 3a44c26..47d7eb4 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -13,11 +13,11 @@ databases = Databases.new(client) result = databases.update_integer_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index d65ebec..3f78828 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_ip_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: '192.0.2.0', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 93831f3..27754f2 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_line_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index bcab8ed..ceca43a 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_longtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index faab3a3..d82768e 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_mediumtext_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index df0ee60..95ffce6 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_point_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [1, 2], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 9424c3c..7558212 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_polygon_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 766f30f..22541f0 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -14,8 +14,8 @@ databases = Databases.new(client) result = databases.update_relationship_attribute( database_id: '', collection_id: '', - key: '', + key: '', on_delete: RelationMutate::CASCADE, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 8ab4e7f..d6e3a76 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_string_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index ec21c97..c4b46f5 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_text_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index defe01c..9a31764 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -13,9 +13,9 @@ databases = Databases.new(client) result = databases.update_url_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, default: 'https://example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 501d57d..07f2160 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -13,10 +13,10 @@ databases = Databases.new(client) result = databases.update_varchar_attribute( database_id: '', collection_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 0000000..60b4570 --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,25 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_collection( + database_id: '', + collection_id: '', + name: '', + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false, # optional + attributes: [], # optional + indexes: [] # optional +) +``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 0000000..074b9b7 --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,28 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_document( + database_id: '', + collection_id: '', + document_id: '', + data: { + "username" => "walter.obrien", + "email" => "walter.obrien@example.com", + "fullName" => "Walter O'Brien", + "age" => 30, + "isAdmin" => false + }, + permissions: [Permission.read(Role.any())] # optional +) +``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 0000000..feb10f3 --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_documents( + database_id: '', + collection_id: '', + documents: [] +) +``` diff --git a/docs/examples/documentsdb/create-failover.md b/docs/examples/documentsdb/create-failover.md new file mode 100644 index 0000000..eade786 --- /dev/null +++ b/docs/examples/documentsdb/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 0000000..d1891f9 --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_index( + database_id: '', + collection_id: '', + key: '', + type: DocumentsDBIndexType::KEY, + attributes: [], + orders: [OrderBy::ASC], # optional + lengths: [] # optional +) +``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md new file mode 100644 index 0000000..8f96a15 --- /dev/null +++ b/docs/examples/documentsdb/create-operations.md @@ -0,0 +1,27 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_operations( + transaction_id: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] # optional +) +``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 0000000..5f56cb2 --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create_transaction( + ttl: 60 # optional +) +``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 0000000..8eb4704 --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.create( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 0000000..926c406 --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.decrement_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: 1, # optional + min: 0, # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 0000000..886b2d6 --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 0000000..d448276 --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_document( + database_id: '', + collection_id: '', + document_id: '', + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 0000000..cd628c7 --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 0000000..cf25af0 --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 0000000..017d541 --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 0000000..668637d --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.delete( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 0000000..d92c810 --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 0000000..8f5b5c6 --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_document( + database_id: '', + collection_id: '', + document_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 0000000..e6ba531 --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/documentsdb/get-replicas.md b/docs/examples/documentsdb/get-replicas.md new file mode 100644 index 0000000..fd3541a --- /dev/null +++ b/docs/examples/documentsdb/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-status.md b/docs/examples/documentsdb/get-status.md new file mode 100644 index 0000000..7334071 --- /dev/null +++ b/docs/examples/documentsdb/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_status( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 0000000..3b586e3 --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 0000000..ad7d06a --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.get( + database_id: '' +) +``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 0000000..abf9a58 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.increment_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: 1, # optional + max: 100, # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 0000000..6a784fb --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_collections( + database_id: '', + queries: [], # optional + search: '', # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 0000000..a256267 --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 0000000..b23b149 --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_indexes( + database_id: '', + collection_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/list-operations.md b/docs/examples/documentsdb/list-operations.md new file mode 100644 index 0000000..267e346 --- /dev/null +++ b/docs/examples/documentsdb/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/documentsdb/list-specifications.md b/docs/examples/documentsdb/list-specifications.md new file mode 100644 index 0000000..f9bea5b --- /dev/null +++ b/docs/examples/documentsdb/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_specifications() +``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 0000000..82d368e --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list_transactions( + queries: [] # optional +) +``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 0000000..f4bb9f8 --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.list( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 0000000..2be8dca --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_collection( + database_id: '', + collection_id: '', + name: '', + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false, # optional + purge: false # optional +) +``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 0000000..90e51e0 --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 0000000..4f3bb64 --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_documents( + database_id: '', + collection_id: '', + data: {}, # optional + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 0000000..37a638e --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update_transaction( + transaction_id: '', + commit: false, # optional + rollback: false # optional +) +``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 0000000..d5e5d57 --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.update( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 0000000..ca6bace --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +documents_db = DocumentsDB.new(client) + +result = documents_db.upsert_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 0000000..f7f0597 --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +documents_db = DocumentsDB.new(client) + +result = documents_db.upsert_documents( + database_id: '', + collection_id: '', + documents: [], + transaction_id: '' # optional +) +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index b51c2f2..49c3726 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -17,7 +17,7 @@ result = functions.create( runtime: Runtime::NODE_14_5, execute: ["any"], # optional events: [], # optional - schedule: '', # optional + schedule: '0 0 * * *', # optional timeout: 1, # optional enabled: false, # optional logging: false, # optional @@ -31,8 +31,8 @@ result = functions.create( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional deployment_retention: 0 # optional ) ``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 458be60..d0bb4c8 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -17,7 +17,7 @@ result = functions.update( runtime: Runtime::NODE_14_5, # optional execute: ["any"], # optional events: [], # optional - schedule: '', # optional + schedule: '0 0 * * *', # optional timeout: 1, # optional enabled: false, # optional logging: false, # optional @@ -31,8 +31,8 @@ result = functions.update( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional deployment_retention: 0 # optional ) ``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 3e6261d..eaa15ec 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -14,7 +14,7 @@ result = messaging.create_mailgun_provider( provider_id: '', name: '', api_key: '', # optional - domain: '', # optional + domain: 'example.com', # optional is_eu_region: false, # optional from_name: '', # optional from_email: 'email@example.com', # optional diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index beff763..e94015e 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -25,7 +25,7 @@ result = messaging.create_push( sound: '', # optional color: '', # optional tag: '', # optional - badge: null, # optional + badge: 1, # optional draft: false, # optional scheduled_at: '2020-10-15T06:38:00.000+00:00', # optional content_available: false, # optional diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 85c1abd..25e5dd7 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -15,7 +15,7 @@ result = messaging.create_smtp_provider( provider_id: '', name: '', host: '', - port: 1, # optional + port: 587, # optional username: '', # optional password: 'password', # optional encryption: SmtpEncryption::NONE, # optional diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index d09607a..4c3f901 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -14,7 +14,7 @@ result = messaging.update_mailgun_provider( provider_id: '', name: '', # optional api_key: '', # optional - domain: '', # optional + domain: 'example.com', # optional is_eu_region: false, # optional enabled: false, # optional from_name: '', # optional diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index e00176b..9aa0e8b 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -25,7 +25,7 @@ result = messaging.update_push( sound: '', # optional color: '', # optional tag: '', # optional - badge: null, # optional + badge: 1, # optional draft: false, # optional scheduled_at: '2020-10-15T06:38:00.000+00:00', # optional content_available: false, # optional diff --git a/docs/examples/mongo/create-backup-policy.md b/docs/examples/mongo/create-backup-policy.md new file mode 100644 index 0000000..cee35bb --- /dev/null +++ b/docs/examples/mongo/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mongo/create-backup.md b/docs/examples/mongo/create-backup.md new file mode 100644 index 0000000..d17f7de --- /dev/null +++ b/docs/examples/mongo/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/mongo/create-branch.md b/docs/examples/mongo/create-branch.md new file mode 100644 index 0000000..1299c3a --- /dev/null +++ b/docs/examples/mongo/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/mongo/create-failover.md b/docs/examples/mongo/create-failover.md new file mode 100644 index 0000000..b07c504 --- /dev/null +++ b/docs/examples/mongo/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/mongo/create-migration.md b/docs/examples/mongo/create-migration.md new file mode 100644 index 0000000..7243c1c --- /dev/null +++ b/docs/examples/mongo/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/mongo/create-restoration.md b/docs/examples/mongo/create-restoration.md new file mode 100644 index 0000000..43f91be --- /dev/null +++ b/docs/examples/mongo/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/mongo/create-upgrade.md b/docs/examples/mongo/create-upgrade.md new file mode 100644 index 0000000..050a237 --- /dev/null +++ b/docs/examples/mongo/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/mongo/create.md b/docs/examples/mongo/create.md new file mode 100644 index 0000000..5854e4c --- /dev/null +++ b/docs/examples/mongo/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/mongo/delete-backup-policy.md b/docs/examples/mongo/delete-backup-policy.md new file mode 100644 index 0000000..b5c27d7 --- /dev/null +++ b/docs/examples/mongo/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mongo/delete-backup.md b/docs/examples/mongo/delete-backup.md new file mode 100644 index 0000000..22f427e --- /dev/null +++ b/docs/examples/mongo/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mongo/delete-branch.md b/docs/examples/mongo/delete-branch.md new file mode 100644 index 0000000..2cb5dda --- /dev/null +++ b/docs/examples/mongo/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/mongo/delete.md b/docs/examples/mongo/delete.md new file mode 100644 index 0000000..7d903e4 --- /dev/null +++ b/docs/examples/mongo/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.delete( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-backup-policy.md b/docs/examples/mongo/get-backup-policy.md new file mode 100644 index 0000000..fe964f8 --- /dev/null +++ b/docs/examples/mongo/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mongo/get-backup.md b/docs/examples/mongo/get-backup.md new file mode 100644 index 0000000..93dfa00 --- /dev/null +++ b/docs/examples/mongo/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mongo/get-pitr.md b/docs/examples/mongo/get-pitr.md new file mode 100644 index 0000000..6dead66 --- /dev/null +++ b/docs/examples/mongo/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-replicas.md b/docs/examples/mongo/get-replicas.md new file mode 100644 index 0000000..62f5af8 --- /dev/null +++ b/docs/examples/mongo/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get-restoration.md b/docs/examples/mongo/get-restoration.md new file mode 100644 index 0000000..0364a68 --- /dev/null +++ b/docs/examples/mongo/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/mongo/get-status.md b/docs/examples/mongo/get-status.md new file mode 100644 index 0000000..d8aa927 --- /dev/null +++ b/docs/examples/mongo/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get_status( + database_id: '' +) +``` diff --git a/docs/examples/mongo/get.md b/docs/examples/mongo/get.md new file mode 100644 index 0000000..ad7d1ad --- /dev/null +++ b/docs/examples/mongo/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.get( + database_id: '' +) +``` diff --git a/docs/examples/mongo/list-backup-policies.md b/docs/examples/mongo/list-backup-policies.md new file mode 100644 index 0000000..a78fea8 --- /dev/null +++ b/docs/examples/mongo/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/list-backups.md b/docs/examples/mongo/list-backups.md new file mode 100644 index 0000000..dff1d39 --- /dev/null +++ b/docs/examples/mongo/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/list-branches.md b/docs/examples/mongo/list-branches.md new file mode 100644 index 0000000..9ab6cc5 --- /dev/null +++ b/docs/examples/mongo/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/mongo/list-operations.md b/docs/examples/mongo/list-operations.md new file mode 100644 index 0000000..9349997 --- /dev/null +++ b/docs/examples/mongo/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mongo/list-restorations.md b/docs/examples/mongo/list-restorations.md new file mode 100644 index 0000000..dc9be39 --- /dev/null +++ b/docs/examples/mongo/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mongo/list-specifications.md b/docs/examples/mongo/list-specifications.md new file mode 100644 index 0000000..dbd3d31 --- /dev/null +++ b/docs/examples/mongo/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list_specifications() +``` diff --git a/docs/examples/mongo/list.md b/docs/examples/mongo/list.md new file mode 100644 index 0000000..72066bd --- /dev/null +++ b/docs/examples/mongo/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.list( + queries: [] # optional +) +``` diff --git a/docs/examples/mongo/update-backup-policy.md b/docs/examples/mongo/update-backup-policy.md new file mode 100644 index 0000000..6da9fe2 --- /dev/null +++ b/docs/examples/mongo/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mongo/update-backup-storage.md b/docs/examples/mongo/update-backup-storage.md new file mode 100644 index 0000000..2893e7e --- /dev/null +++ b/docs/examples/mongo/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/mongo/update-credentials.md b/docs/examples/mongo/update-credentials.md new file mode 100644 index 0000000..389f54a --- /dev/null +++ b/docs/examples/mongo/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/mongo/update-maintenance.md b/docs/examples/mongo/update-maintenance.md new file mode 100644 index 0000000..075d5cc --- /dev/null +++ b/docs/examples/mongo/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/mongo/update.md b/docs/examples/mongo/update.md new file mode 100644 index 0000000..55f02ac --- /dev/null +++ b/docs/examples/mongo/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mongo = Mongo.new(client) + +result = mongo.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/mysql/create-backup-policy.md b/docs/examples/mysql/create-backup-policy.md new file mode 100644 index 0000000..c898944 --- /dev/null +++ b/docs/examples/mysql/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mysql/create-backup.md b/docs/examples/mysql/create-backup.md new file mode 100644 index 0000000..ec1168d --- /dev/null +++ b/docs/examples/mysql/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/mysql/create-branch.md b/docs/examples/mysql/create-branch.md new file mode 100644 index 0000000..b0d48db --- /dev/null +++ b/docs/examples/mysql/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/mysql/create-execution.md b/docs/examples/mysql/create-execution.md new file mode 100644 index 0000000..1384a50 --- /dev/null +++ b/docs/examples/mysql/create-execution.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_execution( + database_id: '', + sql: '', + bindings: {}, # optional + timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/mysql/create-failover.md b/docs/examples/mysql/create-failover.md new file mode 100644 index 0000000..d3b0bcf --- /dev/null +++ b/docs/examples/mysql/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/mysql/create-migration.md b/docs/examples/mysql/create-migration.md new file mode 100644 index 0000000..3d5e5c3 --- /dev/null +++ b/docs/examples/mysql/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/mysql/create-restoration.md b/docs/examples/mysql/create-restoration.md new file mode 100644 index 0000000..ad5aa05 --- /dev/null +++ b/docs/examples/mysql/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/mysql/create-upgrade.md b/docs/examples/mysql/create-upgrade.md new file mode 100644 index 0000000..b209723 --- /dev/null +++ b/docs/examples/mysql/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/mysql/create.md b/docs/examples/mysql/create.md new file mode 100644 index 0000000..a0dcdce --- /dev/null +++ b/docs/examples/mysql/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/mysql/delete-backup-policy.md b/docs/examples/mysql/delete-backup-policy.md new file mode 100644 index 0000000..b2f35a0 --- /dev/null +++ b/docs/examples/mysql/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mysql/delete-backup.md b/docs/examples/mysql/delete-backup.md new file mode 100644 index 0000000..b4e2676 --- /dev/null +++ b/docs/examples/mysql/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mysql/delete-branch.md b/docs/examples/mysql/delete-branch.md new file mode 100644 index 0000000..959b629 --- /dev/null +++ b/docs/examples/mysql/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/mysql/delete.md b/docs/examples/mysql/delete.md new file mode 100644 index 0000000..aedde62 --- /dev/null +++ b/docs/examples/mysql/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.delete( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-backup-policy.md b/docs/examples/mysql/get-backup-policy.md new file mode 100644 index 0000000..bec9f39 --- /dev/null +++ b/docs/examples/mysql/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/mysql/get-backup.md b/docs/examples/mysql/get-backup.md new file mode 100644 index 0000000..286dfda --- /dev/null +++ b/docs/examples/mysql/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/mysql/get-pitr.md b/docs/examples/mysql/get-pitr.md new file mode 100644 index 0000000..a5c48f6 --- /dev/null +++ b/docs/examples/mysql/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-pooler.md b/docs/examples/mysql/get-pooler.md new file mode 100644 index 0000000..5117f05 --- /dev/null +++ b/docs/examples/mysql/get-pooler.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_pooler( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-replicas.md b/docs/examples/mysql/get-replicas.md new file mode 100644 index 0000000..aa04c55 --- /dev/null +++ b/docs/examples/mysql/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get-restoration.md b/docs/examples/mysql/get-restoration.md new file mode 100644 index 0000000..8794092 --- /dev/null +++ b/docs/examples/mysql/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/mysql/get-status.md b/docs/examples/mysql/get-status.md new file mode 100644 index 0000000..0031fa2 --- /dev/null +++ b/docs/examples/mysql/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get_status( + database_id: '' +) +``` diff --git a/docs/examples/mysql/get.md b/docs/examples/mysql/get.md new file mode 100644 index 0000000..2c41277 --- /dev/null +++ b/docs/examples/mysql/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.get( + database_id: '' +) +``` diff --git a/docs/examples/mysql/list-backup-policies.md b/docs/examples/mysql/list-backup-policies.md new file mode 100644 index 0000000..1b2a50d --- /dev/null +++ b/docs/examples/mysql/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/list-backups.md b/docs/examples/mysql/list-backups.md new file mode 100644 index 0000000..bdc3455 --- /dev/null +++ b/docs/examples/mysql/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/list-branches.md b/docs/examples/mysql/list-branches.md new file mode 100644 index 0000000..92dcda4 --- /dev/null +++ b/docs/examples/mysql/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/mysql/list-operations.md b/docs/examples/mysql/list-operations.md new file mode 100644 index 0000000..afb542e --- /dev/null +++ b/docs/examples/mysql/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mysql/list-restorations.md b/docs/examples/mysql/list-restorations.md new file mode 100644 index 0000000..c242d76 --- /dev/null +++ b/docs/examples/mysql/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/mysql/list-specifications.md b/docs/examples/mysql/list-specifications.md new file mode 100644 index 0000000..d0c56c6 --- /dev/null +++ b/docs/examples/mysql/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list_specifications() +``` diff --git a/docs/examples/mysql/list.md b/docs/examples/mysql/list.md new file mode 100644 index 0000000..82de078 --- /dev/null +++ b/docs/examples/mysql/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.list( + queries: [] # optional +) +``` diff --git a/docs/examples/mysql/update-backup-policy.md b/docs/examples/mysql/update-backup-policy.md new file mode 100644 index 0000000..54bc9f6 --- /dev/null +++ b/docs/examples/mysql/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/mysql/update-backup-storage.md b/docs/examples/mysql/update-backup-storage.md new file mode 100644 index 0000000..3545e39 --- /dev/null +++ b/docs/examples/mysql/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/mysql/update-credentials.md b/docs/examples/mysql/update-credentials.md new file mode 100644 index 0000000..6e4775e --- /dev/null +++ b/docs/examples/mysql/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/mysql/update-maintenance.md b/docs/examples/mysql/update-maintenance.md new file mode 100644 index 0000000..026a0c6 --- /dev/null +++ b/docs/examples/mysql/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/mysql/update-pooler.md b/docs/examples/mysql/update-pooler.md new file mode 100644 index 0000000..7a4a1f0 --- /dev/null +++ b/docs/examples/mysql/update-pooler.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update_pooler( + database_id: '', + mode: 'transaction', # optional + max_connections: 10, # optional + default_pool_size: 1, # optional + read_write_splitting: false, # optional + pooler_cpu_request: '', # optional + pooler_cpu_limit: '', # optional + pooler_memory_request: '', # optional + pooler_memory_limit: '' # optional +) +``` diff --git a/docs/examples/mysql/update.md b/docs/examples/mysql/update.md new file mode 100644 index 0000000..2ba792e --- /dev/null +++ b/docs/examples/mysql/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +mysql = Mysql.new(client) + +result = mysql.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/organization/create-project.md b/docs/examples/organization/create-project.md index ccc49ff..95afd80 100644 --- a/docs/examples/organization/create-project.md +++ b/docs/examples/organization/create-project.md @@ -12,7 +12,7 @@ client = Client.new organization = Organization.new(client) result = organization.create_project( - project_id: '', + project_id: '', name: '', region: Region::FRA # optional ) diff --git a/docs/examples/postgresql/create-backup-policy.md b/docs/examples/postgresql/create-backup-policy.md new file mode 100644 index 0000000..871212e --- /dev/null +++ b/docs/examples/postgresql/create-backup-policy.md @@ -0,0 +1,22 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_backup_policy( + database_id: '', + policy_id: '', + name: '', + schedule: '', + retention: 1, + type: 'full', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/postgresql/create-backup.md b/docs/examples/postgresql/create-backup.md new file mode 100644 index 0000000..5439d2b --- /dev/null +++ b/docs/examples/postgresql/create-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_backup( + database_id: '', + type: 'full' # optional +) +``` diff --git a/docs/examples/postgresql/create-branch.md b/docs/examples/postgresql/create-branch.md new file mode 100644 index 0000000..1ff35c7 --- /dev/null +++ b/docs/examples/postgresql/create-branch.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_branch( + database_id: '', + branch_id: '', # optional + ttl: 300 # optional +) +``` diff --git a/docs/examples/postgresql/create-execution.md b/docs/examples/postgresql/create-execution.md new file mode 100644 index 0000000..7359465 --- /dev/null +++ b/docs/examples/postgresql/create-execution.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_execution( + database_id: '', + sql: '', + bindings: {}, # optional + timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/postgresql/create-extension.md b/docs/examples/postgresql/create-extension.md new file mode 100644 index 0000000..c60554c --- /dev/null +++ b/docs/examples/postgresql/create-extension.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_extension( + database_id: '', + name: '' +) +``` diff --git a/docs/examples/postgresql/create-failover.md b/docs/examples/postgresql/create-failover.md new file mode 100644 index 0000000..17642ce --- /dev/null +++ b/docs/examples/postgresql/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/postgresql/create-migration.md b/docs/examples/postgresql/create-migration.md new file mode 100644 index 0000000..a8acf34 --- /dev/null +++ b/docs/examples/postgresql/create-migration.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_migration( + database_id: '', + target_type: 'shared', + specification: '' # optional +) +``` diff --git a/docs/examples/postgresql/create-restoration.md b/docs/examples/postgresql/create-restoration.md new file mode 100644 index 0000000..b4a8e98 --- /dev/null +++ b/docs/examples/postgresql/create-restoration.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_restoration( + database_id: '', + type: 'backup', # optional + backup_id: '', # optional + target_database_id: '', # optional + target_time: '2020-10-15T06:38:00.000+00:00' # optional +) +``` diff --git a/docs/examples/postgresql/create-upgrade.md b/docs/examples/postgresql/create-upgrade.md new file mode 100644 index 0000000..0eeebbc --- /dev/null +++ b/docs/examples/postgresql/create-upgrade.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create_upgrade( + database_id: '', + target_version: '' +) +``` diff --git a/docs/examples/postgresql/create.md b/docs/examples/postgresql/create.md new file mode 100644 index 0000000..69a6033 --- /dev/null +++ b/docs/examples/postgresql/create.md @@ -0,0 +1,29 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.create( + database_id: '', + name: '', + version: '17', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0 # optional +) +``` diff --git a/docs/examples/postgresql/delete-backup-policy.md b/docs/examples/postgresql/delete-backup-policy.md new file mode 100644 index 0000000..824f6a5 --- /dev/null +++ b/docs/examples/postgresql/delete-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-backup.md b/docs/examples/postgresql/delete-backup.md new file mode 100644 index 0000000..d86c46e --- /dev/null +++ b/docs/examples/postgresql/delete-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-branch.md b/docs/examples/postgresql/delete-branch.md new file mode 100644 index 0000000..4ff43f2 --- /dev/null +++ b/docs/examples/postgresql/delete-branch.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_branch( + database_id: '', + branch_id: '' +) +``` diff --git a/docs/examples/postgresql/delete-extension.md b/docs/examples/postgresql/delete-extension.md new file mode 100644 index 0000000..46873c5 --- /dev/null +++ b/docs/examples/postgresql/delete-extension.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete_extension( + database_id: '', + extension_name: '' +) +``` diff --git a/docs/examples/postgresql/delete.md b/docs/examples/postgresql/delete.md new file mode 100644 index 0000000..b692ba5 --- /dev/null +++ b/docs/examples/postgresql/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.delete( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-backup-policy.md b/docs/examples/postgresql/get-backup-policy.md new file mode 100644 index 0000000..674ed65 --- /dev/null +++ b/docs/examples/postgresql/get-backup-policy.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_backup_policy( + database_id: '', + policy_id: '' +) +``` diff --git a/docs/examples/postgresql/get-backup.md b/docs/examples/postgresql/get-backup.md new file mode 100644 index 0000000..19a4d6c --- /dev/null +++ b/docs/examples/postgresql/get-backup.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_backup( + database_id: '', + backup_id: '' +) +``` diff --git a/docs/examples/postgresql/get-pitr.md b/docs/examples/postgresql/get-pitr.md new file mode 100644 index 0000000..9701c38 --- /dev/null +++ b/docs/examples/postgresql/get-pitr.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_pitr( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-pooler.md b/docs/examples/postgresql/get-pooler.md new file mode 100644 index 0000000..9bf12dd --- /dev/null +++ b/docs/examples/postgresql/get-pooler.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_pooler( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-replicas.md b/docs/examples/postgresql/get-replicas.md new file mode 100644 index 0000000..710a963 --- /dev/null +++ b/docs/examples/postgresql/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get-restoration.md b/docs/examples/postgresql/get-restoration.md new file mode 100644 index 0000000..075587a --- /dev/null +++ b/docs/examples/postgresql/get-restoration.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_restoration( + database_id: '', + restoration_id: '' +) +``` diff --git a/docs/examples/postgresql/get-status.md b/docs/examples/postgresql/get-status.md new file mode 100644 index 0000000..0040a9c --- /dev/null +++ b/docs/examples/postgresql/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get_status( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/get.md b/docs/examples/postgresql/get.md new file mode 100644 index 0000000..9c44154 --- /dev/null +++ b/docs/examples/postgresql/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.get( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-backup-policies.md b/docs/examples/postgresql/list-backup-policies.md new file mode 100644 index 0000000..2120ce9 --- /dev/null +++ b/docs/examples/postgresql/list-backup-policies.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_backup_policies( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/list-backups.md b/docs/examples/postgresql/list-backups.md new file mode 100644 index 0000000..28d47c9 --- /dev/null +++ b/docs/examples/postgresql/list-backups.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_backups( + database_id: '', + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/list-branches.md b/docs/examples/postgresql/list-branches.md new file mode 100644 index 0000000..6540056 --- /dev/null +++ b/docs/examples/postgresql/list-branches.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_branches( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-extensions.md b/docs/examples/postgresql/list-extensions.md new file mode 100644 index 0000000..e75a398 --- /dev/null +++ b/docs/examples/postgresql/list-extensions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_extensions( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/list-operations.md b/docs/examples/postgresql/list-operations.md new file mode 100644 index 0000000..b9629cf --- /dev/null +++ b/docs/examples/postgresql/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/postgresql/list-restorations.md b/docs/examples/postgresql/list-restorations.md new file mode 100644 index 0000000..0ee5ece --- /dev/null +++ b/docs/examples/postgresql/list-restorations.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_restorations( + database_id: '', + status: 'pending', # optional + type: 'backup', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/postgresql/list-specifications.md b/docs/examples/postgresql/list-specifications.md new file mode 100644 index 0000000..90a473d --- /dev/null +++ b/docs/examples/postgresql/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list_specifications() +``` diff --git a/docs/examples/postgresql/list.md b/docs/examples/postgresql/list.md new file mode 100644 index 0000000..729f2fe --- /dev/null +++ b/docs/examples/postgresql/list.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.list( + queries: [] # optional +) +``` diff --git a/docs/examples/postgresql/update-backup-policy.md b/docs/examples/postgresql/update-backup-policy.md new file mode 100644 index 0000000..d1b4047 --- /dev/null +++ b/docs/examples/postgresql/update-backup-policy.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_backup_policy( + database_id: '', + policy_id: '', + name: '', # optional + schedule: '', # optional + retention: 1, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/postgresql/update-backup-storage.md b/docs/examples/postgresql/update-backup-storage.md new file mode 100644 index 0000000..546e1e7 --- /dev/null +++ b/docs/examples/postgresql/update-backup-storage.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_backup_storage( + database_id: '', + provider: 's3', + bucket: '', + access_key: '', + secret_key: '', + region: '', # optional + prefix: '', # optional + endpoint: '' # optional +) +``` diff --git a/docs/examples/postgresql/update-credentials.md b/docs/examples/postgresql/update-credentials.md new file mode 100644 index 0000000..cab98e9 --- /dev/null +++ b/docs/examples/postgresql/update-credentials.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_credentials( + database_id: '' +) +``` diff --git a/docs/examples/postgresql/update-maintenance.md b/docs/examples/postgresql/update-maintenance.md new file mode 100644 index 0000000..a8d5f79 --- /dev/null +++ b/docs/examples/postgresql/update-maintenance.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_maintenance( + database_id: '', + day: 'sun', + hour_utc: 0 +) +``` diff --git a/docs/examples/postgresql/update-pooler.md b/docs/examples/postgresql/update-pooler.md new file mode 100644 index 0000000..f6421f7 --- /dev/null +++ b/docs/examples/postgresql/update-pooler.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update_pooler( + database_id: '', + mode: 'transaction', # optional + max_connections: 10, # optional + default_pool_size: 1, # optional + read_write_splitting: false, # optional + pooler_cpu_request: '', # optional + pooler_cpu_limit: '', # optional + pooler_memory_request: '', # optional + pooler_memory_limit: '' # optional +) +``` diff --git a/docs/examples/postgresql/update.md b/docs/examples/postgresql/update.md new file mode 100644 index 0000000..f43a9e8 --- /dev/null +++ b/docs/examples/postgresql/update.md @@ -0,0 +1,36 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +postgresql = Postgresql.new(client) + +result = postgresql.update( + database_id: '', + name: '', # optional + status: 'ready', # optional + specification: '', # optional + replicas: 0, # optional + sync_mode: 'async', # optional + network_idle_timeout_seconds: 60, # optional + network_ip_allowlist: [], # optional + idle_timeout_minutes: 5, # optional + pitr: false, # optional + pitr_retention_days: 1, # optional + storage_autoscaling: false, # optional + storage_autoscaling_threshold_percent: 50, # optional + storage_autoscaling_max_gb: 0, # optional + metrics_trace_sample_rate: null, # optional + metrics_slow_query_log_threshold_ms: 0, # optional + sql_api_enabled: false, # optional + sql_api_allowed_statements: [], # optional + sql_api_max_rows: 1, # optional + sql_api_max_bytes: 1024, # optional + sql_api_timeout_seconds: 1 # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-hugging-face.md b/docs/examples/project/update-o-auth-2-hugging-face.md new file mode 100644 index 0000000..a8d2adc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-hugging-face.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_o_auth2_hugging_face( + client_id: '', # optional + client_secret: '', # optional + enabled: false # optional +) +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index a020227..4471655 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -13,7 +13,7 @@ project = Project.new(client) result = project.update_o_auth2_okta( client_id: '', # optional client_secret: '', # optional - domain: '', # optional + domain: 'example.com', # optional authorization_server_id: '', # optional enabled: false # optional ) diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index 7dda771..0af3b32 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -12,8 +12,8 @@ client = Client.new project = Project.new(client) result = project.update_smtp( - host: '', # optional - port: null, # optional + host: 'example.com', # optional + port: 587, # optional username: '', # optional password: 'password', # optional sender_email: 'email@example.com', # optional diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md index 8fe085a..a69c1ec 100644 --- a/docs/examples/proxy/create-api-rule.md +++ b/docs/examples/proxy/create-api-rule.md @@ -11,6 +11,6 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_api_rule( - domain: '' + domain: 'example.com' ) ``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md index b8202a0..2f65090 100644 --- a/docs/examples/proxy/create-function-rule.md +++ b/docs/examples/proxy/create-function-rule.md @@ -11,7 +11,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_function_rule( - domain: '', + domain: 'example.com', function_id: '', branch: '' # optional ) diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md index 3b2858f..e3e43f7 100644 --- a/docs/examples/proxy/create-invalidation.md +++ b/docs/examples/proxy/create-invalidation.md @@ -12,7 +12,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_invalidation( - domain: '', + domain: 'example.com', type: InvalidationType::TAG, reference: '' # optional ) diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index b07fb4a..40a1ea4 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -12,7 +12,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_redirect_rule( - domain: '', + domain: 'example.com', url: 'https://example.com', status_code: StatusCode::MOVEDPERMANENTLY, resource_id: '', diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md index 098ca4e..c2570cb 100644 --- a/docs/examples/proxy/create-site-rule.md +++ b/docs/examples/proxy/create-site-rule.md @@ -11,7 +11,7 @@ client = Client.new proxy = Proxy.new(client) result = proxy.create_site_rule( - domain: '', + domain: 'example.com', site_id: '', branch: '' # optional ) diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 8eccf03..9f8d7f7 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -32,8 +32,9 @@ result = sites.create( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional - deployment_retention: 0 # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional + deployment_retention: 0, # optional + scopes: [ProjectKeyScopes::PROJECT_READ] # optional ) ``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 663dadc..56031c0 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -32,8 +32,9 @@ result = sites.update( provider_root_directory: '', # optional provider_branches: [], # optional provider_paths: [], # optional - build_specification: '', # optional - runtime_specification: '', # optional - deployment_retention: 0 # optional + build_specification: 's-1vcpu-512mb', # optional + runtime_specification: 's-1vcpu-512mb', # optional + deployment_retention: 0, # optional + scopes: [ProjectKeyScopes::PROJECT_READ] # optional ) ``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index cef3464..8176563 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -17,6 +17,6 @@ result = storage.create_file( file_id: '', file: InputFile.from_path('dir/file.png'), permissions: [Permission.read(Role.any())], # optional - folder: '' # optional + folder: 'photos/2026' # optional ) ``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 8db54e0..3b4ce03 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -19,11 +19,11 @@ result = storage.get_file_preview( gravity: ImageGravity::CENTER, # optional quality: -1, # optional border_width: 0, # optional - border_color: '', # optional + border_color: 'FFFFFF', # optional border_radius: 0, # optional opacity: 0, # optional rotation: -360, # optional - background: '', # optional + background: 'FFFFFF', # optional output: ImageFormat::JPG, # optional token: '' # optional ) diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index 76c9529..8af0444 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_big_int_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 1000000, # optional + default: 0, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 4b7f65f..f4bdf1b 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_boolean_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: false, # optional array: false # optional diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 6599526..e21b99b 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_datetime_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index cd63c78..c7ed0fd 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_email_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'email@example.com', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index e04eb0d..6a2dafb 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_enum_column( database_id: '', table_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', # optional + default: 'active', # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index cc3bf78..65fe004 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_float_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10.5, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 7756a16..a045381 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -14,7 +14,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_index( database_id: '', table_id: '', - key: '', + key: '', type: TablesDBIndexType::KEY, columns: [], orders: [OrderBy::ASC], # optional diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 347c1e0..8abb17a 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.create_integer_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - min: null, # optional - max: null, # optional - default: null, # optional + min: 0, # optional + max: 100, # optional + default: 10, # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 5b0608c..546f781 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_ip_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: '192.0.2.0', # optional array: false # optional ) ``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 96e4d47..aaf75a3 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_line_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] # optional ) diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 0dac5eb..f5a9318 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_longtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index d7fdd04..e2bf27b 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_mediumtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 8eeec98..1e52d6e 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_point_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [1, 2] # optional ) diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index ab659f5..c471938 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_polygon_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] # optional ) diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index d2ca56f..9b08203 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -17,8 +17,8 @@ result = tables_db.create_relationship_column( related_table_id: '', type: RelationshipType::ONETOONE, two_way: false, # optional - key: '', # optional - two_way_key: '', # optional + key: '', # optional + two_way_key: '', # optional on_delete: RelationMutate::CASCADE # optional ) ``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 11782e0..9f45868 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_string_column( database_id: '', table_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index e1133b1..aa7e59e 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.create_text_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 385a830..4967176 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -13,7 +13,7 @@ tables_db = TablesDB.new(client) result = tables_db.create_url_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'https://example.com', # optional array: false # optional diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index 04fc6c6..a03b5b7 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.create_varchar_column( database_id: '', table_id: '', - key: '', + key: '', size: 1, required: false, - default: '', # optional + default: 'Hello World', # optional array: false, # optional encrypt: false # optional ) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index ff19610..7dfeb83 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -14,9 +14,9 @@ result = tables_db.decrement_row_column( database_id: '', table_id: '', row_id: '', - column: '', - value: null, # optional - min: null, # optional + column: '', + value: 1, # optional + min: 0, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 0d056da..697305a 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.delete_column( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index cb46c80..78edab9 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.delete_index( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 65360e1..21865dd 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.get_column( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 4404234..78a49d3 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -13,6 +13,6 @@ tables_db = TablesDB.new(client) result = tables_db.get_index( database_id: '', table_id: '', - key: '' + key: '' ) ``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 20af30a..c3295fd 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -14,9 +14,9 @@ result = tables_db.increment_row_column( database_id: '', table_id: '', row_id: '', - column: '', - value: null, # optional - max: null, # optional + column: '', + value: 1, # optional + max: 100, # optional transaction_id: '' # optional ) ``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md index ac41c17..e8a531f 100644 --- a/docs/examples/tablesdb/list-operations.md +++ b/docs/examples/tablesdb/list-operations.md @@ -12,7 +12,7 @@ tables_db = TablesDB.new(client) result = tables_db.list_operations( database_id: '', - status: 'running', # optional + status: 'queued', # optional limit: 1, # optional offset: 0 # optional ) diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md index 2ce0077..fea7bfd 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_big_int_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 0, + min: 0, # optional + max: 1000000, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index ef93584..c55d1f2 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_boolean_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: false, - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 295139b..d50571d 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_datetime_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 1eda71c..24b5ef6 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_email_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'email@example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 0a25c96..6204ac2 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_enum_column( database_id: '', table_id: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - new_key: '' # optional + default: 'active', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 588ad1d..cd98ae9 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_float_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10.5, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 28d1439..1fd1e31 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -13,11 +13,11 @@ tables_db = TablesDB.new(client) result = tables_db.update_integer_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: null, - min: null, # optional - max: null, # optional - new_key: '' # optional + default: 10, + min: 0, # optional + max: 100, # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 097a3a2..9948c6f 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_ip_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: '192.0.2.0', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index f6ca84c..8b32b97 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_line_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index 1e7e027..342ba99 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_longtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 507e4bc..70c7bca 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_mediumtext_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 1abaabc..50ef529 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_point_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [1, 2], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 47d452b..e6bb0bc 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_polygon_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 289d675..1bdbf61 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -14,8 +14,8 @@ tables_db = TablesDB.new(client) result = tables_db.update_relationship_column( database_id: '', table_id: '', - key: '', + key: '', on_delete: RelationMutate::CASCADE, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index ae5edad..1a356d1 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_string_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index b3d21cb..9e40c65 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_text_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', - new_key: '' # optional + default: 'Hello World', + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index dfe2bd5..9319738 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -13,9 +13,9 @@ tables_db = TablesDB.new(client) result = tables_db.update_url_column( database_id: '', table_id: '', - key: '', + key: '', required: false, default: 'https://example.com', - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index 223a681..99804b0 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -13,10 +13,10 @@ tables_db = TablesDB.new(client) result = tables_db.update_varchar_column( database_id: '', table_id: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, # optional - new_key: '' # optional + new_key: '' # optional ) ``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 7df95fb..bb940ab 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -12,7 +12,7 @@ users = Users.new(client) result = users.create_jwt( user_id: '', - session_id: '', # optional + session_id: 'recent()', # optional duration: 0 # optional ) ``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 91a200c..14d85cf 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -15,10 +15,10 @@ result = users.create_scrypt_user( email: 'email@example.com', password: 'password', password_salt: '', - password_cpu: null, - password_memory: null, - password_parallel: null, - password_length: null, + password_cpu: 8, + password_memory: 65536, + password_parallel: 1, + password_length: 64, name: '' # optional ) ``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 0000000..b449f54 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_collection( + database_id: '', + collection_id: '', + name: '', + dimension: 1, + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 0000000..4ad9aa4 --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,32 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_document( + database_id: '', + collection_id: '', + document_id: '', + data: { + "embeddings" => { + "0" => 0.12, + "1" => -0.55, + "2" => 0.88, + "3" => 1.02 + }, + "metadata" => { + "key" => "value" + } + }, + permissions: [Permission.read(Role.any())] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 0000000..0fcac72 --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_documents( + database_id: '', + collection_id: '', + documents: [] +) +``` diff --git a/docs/examples/vectorsdb/create-failover.md b/docs/examples/vectorsdb/create-failover.md new file mode 100644 index 0000000..479cbfa --- /dev/null +++ b/docs/examples/vectorsdb/create-failover.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_failover( + database_id: '', + target_replica_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 0000000..d7880ab --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_index( + database_id: '', + collection_id: '', + key: '', + type: VectorsDBIndexType::HNSW_EUCLIDEAN, + attributes: [], + orders: [OrderBy::ASC], # optional + lengths: [] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 0000000..6817930 --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,27 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_operations( + transaction_id: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] # optional +) +``` diff --git a/docs/examples/vectorsdb/create-query.md b/docs/examples/vectorsdb/create-query.md new file mode 100644 index 0000000..917cdac --- /dev/null +++ b/docs/examples/vectorsdb/create-query.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_query( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 0000000..5092553 --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create_transaction( + ttl: 60 # optional +) +``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 0000000..9166fc4 --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.create( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 0000000..fc3bd76 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 0000000..40718f3 --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_document( + database_id: '', + collection_id: '', + document_id: '', + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 0000000..bb1173a --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 0000000..b968f68 --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 0000000..4124aac --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 0000000..6be5631 --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.delete( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 0000000..dae8e53 --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_collection( + database_id: '', + collection_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 0000000..49bfc86 --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_document( + database_id: '', + collection_id: '', + document_id: '', + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 0000000..af72230 --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_index( + database_id: '', + collection_id: '', + key: '' +) +``` diff --git a/docs/examples/vectorsdb/get-replicas.md b/docs/examples/vectorsdb/get-replicas.md new file mode 100644 index 0000000..d3d5d6f --- /dev/null +++ b/docs/examples/vectorsdb/get-replicas.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_replicas( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-status.md b/docs/examples/vectorsdb/get-status.md new file mode 100644 index 0000000..15f2ca3 --- /dev/null +++ b/docs/examples/vectorsdb/get-status.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_status( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 0000000..584134d --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get_transaction( + transaction_id: '' +) +``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 0000000..cea4329 --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.get( + database_id: '' +) +``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 0000000..dc85e4a --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_collections( + database_id: '', + queries: [], # optional + search: '', # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 0000000..c60da65 --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_documents( + database_id: '', + collection_id: '', + queries: [], # optional + transaction_id: '', # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 0000000..2df5e68 --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_indexes( + database_id: '', + collection_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/list-operations.md b/docs/examples/vectorsdb/list-operations.md new file mode 100644 index 0000000..a6ec3a2 --- /dev/null +++ b/docs/examples/vectorsdb/list-operations.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_operations( + database_id: '', + status: 'queued', # optional + limit: 1, # optional + offset: 0 # optional +) +``` diff --git a/docs/examples/vectorsdb/list-specifications.md b/docs/examples/vectorsdb/list-specifications.md new file mode 100644 index 0000000..3338078 --- /dev/null +++ b/docs/examples/vectorsdb/list-specifications.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_specifications() +``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 0000000..9c2182d --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list_transactions( + queries: [] # optional +) +``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 0000000..9f16285 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.list( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 0000000..0dfdac1 --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_collection( + database_id: '', + collection_id: '', + name: '', + dimension: 1, # optional + permissions: [Permission.read(Role.any())], # optional + document_security: false, # optional + enabled: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 0000000..b4fdb37 --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 0000000..2f4d27a --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,20 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_documents( + database_id: '', + collection_id: '', + data: {}, # optional + queries: [], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 0000000..96fbc93 --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update_transaction( + transaction_id: '', + commit: false, # optional + rollback: false # optional +) +``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 0000000..dc8ccb0 --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,21 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.update( + database_id: '', + name: '', + enabled: false, # optional + specification: 'serverless', # optional + replicas: 0, # optional + sync_mode: 'async' # optional +) +``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 0000000..7888903 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +vectors_db = VectorsDB.new(client) + +result = vectors_db.upsert_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, # optional + permissions: [Permission.read(Role.any())], # optional + transaction_id: '' # optional +) +``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 0000000..d737f10 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +vectors_db = VectorsDB.new(client) + +result = vectors_db.upsert_documents( + database_id: '', + collection_id: '', + documents: [], + transaction_id: '' # optional +) +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 58177d5..9f231f7 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -12,7 +12,7 @@ webhooks = Webhooks.new(client) result = webhooks.create( webhook_id: '', - url: '', + url: 'https://example.com/webhook', name: '', events: [], enabled: false, # optional diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index d5d9542..ad3fa89 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -13,7 +13,7 @@ webhooks = Webhooks.new(client) result = webhooks.update( webhook_id: '', name: '', - url: '', + url: 'https://example.com/webhook', events: [], enabled: false, # optional tls: false, # optional diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 64a08f3..80c58ed 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -57,6 +57,7 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' +require_relative 'appwrite/models/vectorsdb_collection_list' require_relative 'appwrite/models/embedding_list' require_relative 'appwrite/models/insight_list' require_relative 'appwrite/models/report_list' @@ -82,6 +83,9 @@ require_relative 'appwrite/models/attribute_text' require_relative 'appwrite/models/attribute_mediumtext' require_relative 'appwrite/models/attribute_longtext' +require_relative 'appwrite/models/vectorsdb_collection' +require_relative 'appwrite/models/attribute_object' +require_relative 'appwrite/models/attribute_vector' require_relative 'appwrite/models/table' require_relative 'appwrite/models/column_list' require_relative 'appwrite/models/column_string' @@ -167,6 +171,7 @@ require_relative 'appwrite/models/o_auth2_notion' require_relative 'appwrite/models/o_auth2_salesforce' require_relative 'appwrite/models/o_auth2_yahoo' +require_relative 'appwrite/models/o_auth2_hugging_face' require_relative 'appwrite/models/o_auth2_linkedin' require_relative 'appwrite/models/o_auth2_disqus' require_relative 'appwrite/models/o_auth2_amazon' @@ -230,6 +235,9 @@ require_relative 'appwrite/models/activity_event' require_relative 'appwrite/models/additional_resource' require_relative 'appwrite/models/backup_archive' +require_relative 'appwrite/models/dedicated_database_backup' +require_relative 'appwrite/models/dedicated_database_backup_list' +require_relative 'appwrite/models/dedicated_database_backup_storage' require_relative 'appwrite/models/billing_limits' require_relative 'appwrite/models/billing_plan' require_relative 'appwrite/models/billing_plan_addon' @@ -238,22 +246,32 @@ require_relative 'appwrite/models/billing_plan_dedicated_database_limits' require_relative 'appwrite/models/billing_plan_supported_addons' require_relative 'appwrite/models/block' +require_relative 'appwrite/models/dedicated_database_branch' +require_relative 'appwrite/models/dedicated_database_branch_list' require_relative 'appwrite/models/database_migration' require_relative 'appwrite/models/dedicated_database' +require_relative 'appwrite/models/dedicated_database_execution' +require_relative 'appwrite/models/dedicated_database_execution_column' +require_relative 'appwrite/models/dedicated_database_restoration' require_relative 'appwrite/models/database_status' +require_relative 'appwrite/models/dedicated_database_extensions' require_relative 'appwrite/models/dedicated_database_member' require_relative 'appwrite/models/dedicated_database_operation' require_relative 'appwrite/models/dedicated_database_operation_list' require_relative 'appwrite/models/dedicated_database_replicas' require_relative 'appwrite/models/proxy_invalidation' require_relative 'appwrite/models/organization' +require_relative 'appwrite/models/dedicated_database_pitr_windows' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/policy_deny_aliased_email' require_relative 'appwrite/models/policy_deny_disposable_email' require_relative 'appwrite/models/policy_deny_free_email' require_relative 'appwrite/models/policy_deny_corporate_email' +require_relative 'appwrite/models/dedicated_database_pooler' +require_relative 'appwrite/models/postgres_extension' require_relative 'appwrite/models/program' require_relative 'appwrite/models/backup_restoration' +require_relative 'appwrite/models/dedicated_database_restoration_list' require_relative 'appwrite/models/dedicated_database_specification' require_relative 'appwrite/models/dedicated_database_specification_list' require_relative 'appwrite/models/dedicated_database_specification_pricing' @@ -287,6 +305,7 @@ require_relative 'appwrite/models/backup_policy_list' require_relative 'appwrite/models/backup_restoration_list' require_relative 'appwrite/models/database_migration_list' +require_relative 'appwrite/models/dedicated_database_list' require_relative 'appwrite/models/apps_list' require_relative 'appwrite/models/app_secret_list' require_relative 'appwrite/models/app_scope_list' @@ -308,6 +327,7 @@ require_relative 'appwrite/enums/relation_mutate' require_relative 'appwrite/enums/databases_index_type' require_relative 'appwrite/enums/order_by' +require_relative 'appwrite/enums/documents_db_index_type' require_relative 'appwrite/enums/embedding_model' require_relative 'appwrite/enums/runtime' require_relative 'appwrite/enums/project_key_scopes' @@ -340,12 +360,14 @@ require_relative 'appwrite/enums/tables_db_index_type' require_relative 'appwrite/enums/password_hash' require_relative 'appwrite/enums/messaging_provider_type' +require_relative 'appwrite/enums/vectors_db_index_type' require_relative 'appwrite/enums/database_type' require_relative 'appwrite/enums/database_status' require_relative 'appwrite/enums/attribute_status' require_relative 'appwrite/enums/column_status' require_relative 'appwrite/enums/index_status' require_relative 'appwrite/enums/deployment_status' +require_relative 'appwrite/enums/execution_resource_type' require_relative 'appwrite/enums/execution_trigger' require_relative 'appwrite/enums/execution_status' require_relative 'appwrite/enums/o_auth2_google_prompt' @@ -362,13 +384,17 @@ require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/backups' require_relative 'appwrite/services/databases' +require_relative 'appwrite/services/documents_db' require_relative 'appwrite/services/embeddings' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/messaging' +require_relative 'appwrite/services/mongo' +require_relative 'appwrite/services/mysql' require_relative 'appwrite/services/oauth2' require_relative 'appwrite/services/organization' +require_relative 'appwrite/services/postgresql' require_relative 'appwrite/services/presences' require_relative 'appwrite/services/project' require_relative 'appwrite/services/proxy' @@ -379,4 +405,5 @@ require_relative 'appwrite/services/teams' require_relative 'appwrite/services/tokens' require_relative 'appwrite/services/users' +require_relative 'appwrite/services/vectors_db' require_relative 'appwrite/services/webhooks' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index dfaae3a..c5328a0 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true require 'net/http' require 'uri' @@ -7,15 +7,14 @@ module Appwrite class Client - def initialize - @chunk_size = 5*1024*1024 + @chunk_size = 5 * 1024 * 1024 @headers = { 'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION, - 'x-sdk-name'=> 'Ruby', - 'x-sdk-platform'=> 'server', - 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '27.0.0', + 'x-sdk-name' => 'Ruby', + 'x-sdk-platform' => 'server', + 'x-sdk-language' => 'ruby', + 'x-sdk-version' => '28.0.0.rc1', 'X-Appwrite-Response-Format' => '1.9.6' } @endpoint = 'https://cloud.appwrite.io/v1' @@ -310,6 +309,8 @@ def chunked_upload( chunks_uploaded = 0 if id_param_name&.empty? == false upload_id = params[id_param_name] + end + if upload_id && !upload_id.empty? # Make a request to check if a file already exists begin current = call( @@ -378,13 +379,14 @@ def chunked_upload( chunks_uploaded.to_i >= chunks_total.to_i end - on_progress.call({ + progress = { id: result['$id'], - progress: uploaded_size.to_f/size.to_f * 100.0, + progress: uploaded_size.to_f / size.to_f * 100.0, size_uploaded: uploaded_size, chunks_total: result['chunksTotal'] || total_chunks, chunks_uploaded: result['chunksUploaded'] || completed_count - }) unless on_progress.nil? + } + on_progress.call(progress) unless on_progress.nil? mutex = Mutex.new queue = Queue.new @@ -416,13 +418,14 @@ def chunked_upload( uploaded_size += chunk[:ending] - chunk[:start] last_result = chunk_result completed_result = chunk_result if upload_complete.call(chunk_result) - on_progress.call({ + progress = { id: upload_id, - progress: uploaded_size.to_f/size.to_f * 100.0, + progress: uploaded_size.to_f / size.to_f * 100.0, size_uploaded: uploaded_size, chunks_total: chunk_result['chunksTotal'] || total_chunks, chunks_uploaded: chunk_result['chunksUploaded'] || completed_count - }) unless on_progress.nil? + } + on_progress.call(progress) unless on_progress.nil? end end end @@ -461,13 +464,13 @@ def fetch( @boundary = "----A30#3ad1" if method != "GET" case headers[:'content-type'] - when 'application/json' - payload = params.to_json - when 'multipart/form-data' - payload = encode_form_data(params) + "--#{@boundary}--\r\n" - headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}" - else - payload = encode(params) + when 'application/json' + payload = params.to_json + when 'multipart/form-data' + payload = encode_form_data(params) + "--#{@boundary}--\r\n" + headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}" + else + payload = encode(params) end end @@ -524,10 +527,10 @@ def fetch( return response end - def encode_form_data(value, key=nil) + def encode_form_data(value, key = nil) case value when Hash - value.map { |k,v| encode_form_data(v,k) }.join + value.map { |k, v| encode_form_data(v, k) }.join when Array value.map { |v| encode_form_data(v, "#{key}[]") }.join when nil @@ -552,11 +555,11 @@ def encode_form_data(value, key=nil) def encode(value, key = nil) case value - when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&') + when Hash then value.map { |k, v| encode(v, append_key(key, k)) }.join('&') when Array then value.map { |v| encode(v, "#{key}[]") }.join('&') when nil then '' else - "#{key}=#{CGI.escape(value.to_s)}" + "#{key}=#{CGI.escape(value.to_s)}" end end diff --git a/lib/appwrite/enums/adapter.rb b/lib/appwrite/enums/adapter.rb index 3d66017..5dbb572 100644 --- a/lib/appwrite/enums/adapter.rb +++ b/lib/appwrite/enums/adapter.rb @@ -5,4 +5,4 @@ module Adapter SSR = 'ssr' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/attribute_status.rb b/lib/appwrite/enums/attribute_status.rb index 62f3512..698150c 100644 --- a/lib/appwrite/enums/attribute_status.rb +++ b/lib/appwrite/enums/attribute_status.rb @@ -8,4 +8,4 @@ module AttributeStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/authentication_factor.rb b/lib/appwrite/enums/authentication_factor.rb index 4866978..d596928 100644 --- a/lib/appwrite/enums/authentication_factor.rb +++ b/lib/appwrite/enums/authentication_factor.rb @@ -8,4 +8,4 @@ module AuthenticationFactor CUSTOM = 'custom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/authenticator_type.rb b/lib/appwrite/enums/authenticator_type.rb index 3126e48..fc5bd1a 100644 --- a/lib/appwrite/enums/authenticator_type.rb +++ b/lib/appwrite/enums/authenticator_type.rb @@ -4,4 +4,4 @@ module AuthenticatorType TOTP = 'totp' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/backup_services.rb b/lib/appwrite/enums/backup_services.rb index 443e1e3..4d7969b 100644 --- a/lib/appwrite/enums/backup_services.rb +++ b/lib/appwrite/enums/backup_services.rb @@ -10,4 +10,4 @@ module BackupServices STORAGE = 'storage' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/billing_plan_group.rb b/lib/appwrite/enums/billing_plan_group.rb index 053feaf..343b49a 100644 --- a/lib/appwrite/enums/billing_plan_group.rb +++ b/lib/appwrite/enums/billing_plan_group.rb @@ -6,4 +6,4 @@ module BillingPlanGroup SCALE = 'scale' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser.rb b/lib/appwrite/enums/browser.rb index 37b52ca..24ba417 100644 --- a/lib/appwrite/enums/browser.rb +++ b/lib/appwrite/enums/browser.rb @@ -17,4 +17,4 @@ module Browser OPERA_NEXT = 'on' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser_permission.rb b/lib/appwrite/enums/browser_permission.rb index e8dabec..751fbbc 100644 --- a/lib/appwrite/enums/browser_permission.rb +++ b/lib/appwrite/enums/browser_permission.rb @@ -23,4 +23,4 @@ module BrowserPermission XR_SPATIAL_TRACKING = 'xr-spatial-tracking' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/browser_theme.rb b/lib/appwrite/enums/browser_theme.rb index 323fdac..09d0e41 100644 --- a/lib/appwrite/enums/browser_theme.rb +++ b/lib/appwrite/enums/browser_theme.rb @@ -5,4 +5,4 @@ module BrowserTheme DARK = 'dark' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/build_runtime.rb b/lib/appwrite/enums/build_runtime.rb index ae67f36..0f1a880 100644 --- a/lib/appwrite/enums/build_runtime.rb +++ b/lib/appwrite/enums/build_runtime.rb @@ -79,6 +79,7 @@ module BuildRuntime BUN_1_1 = 'bun-1.1' BUN_1_2 = 'bun-1.2' BUN_1_3 = 'bun-1.3' + BUN_1_4 = 'bun-1.4' GO_1_23 = 'go-1.23' GO_1_24 = 'go-1.24' GO_1_25 = 'go-1.25' @@ -95,4 +96,4 @@ module BuildRuntime FLUTTER_3_44 = 'flutter-3.44' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/column_status.rb b/lib/appwrite/enums/column_status.rb index 12f870e..2588a2a 100644 --- a/lib/appwrite/enums/column_status.rb +++ b/lib/appwrite/enums/column_status.rb @@ -8,4 +8,4 @@ module ColumnStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/compression.rb b/lib/appwrite/enums/compression.rb index c15493f..d3000cf 100644 --- a/lib/appwrite/enums/compression.rb +++ b/lib/appwrite/enums/compression.rb @@ -6,4 +6,4 @@ module Compression ZSTD = 'zstd' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/credit_card.rb b/lib/appwrite/enums/credit_card.rb index 137bbfc..e86637f 100644 --- a/lib/appwrite/enums/credit_card.rb +++ b/lib/appwrite/enums/credit_card.rb @@ -20,4 +20,4 @@ module CreditCard RUPAY = 'rupay' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/database_status.rb b/lib/appwrite/enums/database_status.rb index a35fbbc..f0e5a01 100644 --- a/lib/appwrite/enums/database_status.rb +++ b/lib/appwrite/enums/database_status.rb @@ -17,4 +17,4 @@ module DatabaseStatus FAILING_OVER = 'failing-over' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/database_type.rb b/lib/appwrite/enums/database_type.rb index 1803082..645ce2c 100644 --- a/lib/appwrite/enums/database_type.rb +++ b/lib/appwrite/enums/database_type.rb @@ -10,4 +10,4 @@ module DatabaseType MONGODB = 'mongodb' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/databases_index_type.rb b/lib/appwrite/enums/databases_index_type.rb index ff4b7ff..0dd80ac 100644 --- a/lib/appwrite/enums/databases_index_type.rb +++ b/lib/appwrite/enums/databases_index_type.rb @@ -7,4 +7,4 @@ module DatabasesIndexType SPATIAL = 'spatial' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/deployment_download_type.rb b/lib/appwrite/enums/deployment_download_type.rb index 4c8a60b..359e6fd 100644 --- a/lib/appwrite/enums/deployment_download_type.rb +++ b/lib/appwrite/enums/deployment_download_type.rb @@ -5,4 +5,4 @@ module DeploymentDownloadType OUTPUT = 'output' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/deployment_status.rb b/lib/appwrite/enums/deployment_status.rb index 92442c0..8511130 100644 --- a/lib/appwrite/enums/deployment_status.rb +++ b/lib/appwrite/enums/deployment_status.rb @@ -9,4 +9,4 @@ module DeploymentStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/documents_db_index_type.rb b/lib/appwrite/enums/documents_db_index_type.rb new file mode 100644 index 0000000..2436d80 --- /dev/null +++ b/lib/appwrite/enums/documents_db_index_type.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module DocumentsDBIndexType + KEY = 'key' + FULLTEXT = 'fulltext' + UNIQUE = 'unique' + end + end +end diff --git a/lib/appwrite/enums/embedding_model.rb b/lib/appwrite/enums/embedding_model.rb index 7fce0ea..9a3ffc0 100644 --- a/lib/appwrite/enums/embedding_model.rb +++ b/lib/appwrite/enums/embedding_model.rb @@ -2,9 +2,7 @@ module Appwrite module Enums module EmbeddingModel NOMIC_EMBED_TEXT = 'nomic-embed-text' - EMBEDDING_GEMMA = 'embedding-gemma' ALL_MINILM = 'all-minilm' - BGE_SMALL = 'bge-small' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_method.rb b/lib/appwrite/enums/execution_method.rb index 2e81029..5b22dfc 100644 --- a/lib/appwrite/enums/execution_method.rb +++ b/lib/appwrite/enums/execution_method.rb @@ -10,4 +10,4 @@ module ExecutionMethod HEAD = 'HEAD' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_resource_type.rb b/lib/appwrite/enums/execution_resource_type.rb new file mode 100644 index 0000000..9cd68f0 --- /dev/null +++ b/lib/appwrite/enums/execution_resource_type.rb @@ -0,0 +1,8 @@ +module Appwrite + module Enums + module ExecutionResourceType + FUNCTIONS = 'functions' + SITES = 'sites' + end + end +end diff --git a/lib/appwrite/enums/execution_status.rb b/lib/appwrite/enums/execution_status.rb index 301a6ae..793f848 100644 --- a/lib/appwrite/enums/execution_status.rb +++ b/lib/appwrite/enums/execution_status.rb @@ -8,4 +8,4 @@ module ExecutionStatus SCHEDULED = 'scheduled' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/execution_trigger.rb b/lib/appwrite/enums/execution_trigger.rb index e7cec9c..59428c6 100644 --- a/lib/appwrite/enums/execution_trigger.rb +++ b/lib/appwrite/enums/execution_trigger.rb @@ -6,4 +6,4 @@ module ExecutionTrigger EVENT = 'event' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/flag.rb b/lib/appwrite/enums/flag.rb index 8a92a40..89a53e4 100644 --- a/lib/appwrite/enums/flag.rb +++ b/lib/appwrite/enums/flag.rb @@ -198,4 +198,4 @@ module Flag ZIMBABWE = 'zw' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/framework.rb b/lib/appwrite/enums/framework.rb index b58f8cf..6beab64 100644 --- a/lib/appwrite/enums/framework.rb +++ b/lib/appwrite/enums/framework.rb @@ -18,4 +18,4 @@ module Framework OTHER = 'other' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/image_format.rb b/lib/appwrite/enums/image_format.rb index 3cd22ed..e0bc9c6 100644 --- a/lib/appwrite/enums/image_format.rb +++ b/lib/appwrite/enums/image_format.rb @@ -10,4 +10,4 @@ module ImageFormat GIF = 'gif' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/image_gravity.rb b/lib/appwrite/enums/image_gravity.rb index e30c882..6eb0b5b 100644 --- a/lib/appwrite/enums/image_gravity.rb +++ b/lib/appwrite/enums/image_gravity.rb @@ -12,4 +12,4 @@ module ImageGravity BOTTOM_RIGHT = 'bottom-right' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/index_status.rb b/lib/appwrite/enums/index_status.rb index 42819bd..c276414 100644 --- a/lib/appwrite/enums/index_status.rb +++ b/lib/appwrite/enums/index_status.rb @@ -8,4 +8,4 @@ module IndexStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/invalidation_type.rb b/lib/appwrite/enums/invalidation_type.rb index d8fca7c..4b3d316 100644 --- a/lib/appwrite/enums/invalidation_type.rb +++ b/lib/appwrite/enums/invalidation_type.rb @@ -6,4 +6,4 @@ module InvalidationType ALL = 'all' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/message_priority.rb b/lib/appwrite/enums/message_priority.rb index f0745ca..42893cc 100644 --- a/lib/appwrite/enums/message_priority.rb +++ b/lib/appwrite/enums/message_priority.rb @@ -5,4 +5,4 @@ module MessagePriority HIGH = 'high' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/message_status.rb b/lib/appwrite/enums/message_status.rb index 0821f5a..341dbde 100644 --- a/lib/appwrite/enums/message_status.rb +++ b/lib/appwrite/enums/message_status.rb @@ -8,4 +8,4 @@ module MessageStatus FAILED = 'failed' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/messaging_provider_type.rb b/lib/appwrite/enums/messaging_provider_type.rb index 4fc6d1f..f4bc899 100644 --- a/lib/appwrite/enums/messaging_provider_type.rb +++ b/lib/appwrite/enums/messaging_provider_type.rb @@ -6,4 +6,4 @@ module MessagingProviderType PUSH = 'push' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth2_google_prompt.rb b/lib/appwrite/enums/o_auth2_google_prompt.rb index 700ce95..5dcefdd 100644 --- a/lib/appwrite/enums/o_auth2_google_prompt.rb +++ b/lib/appwrite/enums/o_auth2_google_prompt.rb @@ -6,4 +6,4 @@ module OAuth2GooglePrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth2_oidc_prompt.rb b/lib/appwrite/enums/o_auth2_oidc_prompt.rb index f07d527..404bf39 100644 --- a/lib/appwrite/enums/o_auth2_oidc_prompt.rb +++ b/lib/appwrite/enums/o_auth2_oidc_prompt.rb @@ -7,4 +7,4 @@ module OAuth2OidcPrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/o_auth_provider.rb b/lib/appwrite/enums/o_auth_provider.rb index e2e27fa..8cb20b5 100644 --- a/lib/appwrite/enums/o_auth_provider.rb +++ b/lib/appwrite/enums/o_auth_provider.rb @@ -21,6 +21,7 @@ module OAuthProvider GITHUB = 'github' GITLAB = 'gitlab' GOOGLE = 'google' + HUGGINGFACE = 'huggingface' KEYCLOAK = 'keycloak' KICK = 'kick' LINKEDIN = 'linkedin' @@ -47,4 +48,4 @@ module OAuthProvider ZOOM = 'zoom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/order_by.rb b/lib/appwrite/enums/order_by.rb index 053de36..767684c 100644 --- a/lib/appwrite/enums/order_by.rb +++ b/lib/appwrite/enums/order_by.rb @@ -5,4 +5,4 @@ module OrderBy DESC = 'desc' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/organization_key_scopes.rb b/lib/appwrite/enums/organization_key_scopes.rb index 92b7da2..9a8c7aa 100644 --- a/lib/appwrite/enums/organization_key_scopes.rb +++ b/lib/appwrite/enums/organization_key_scopes.rb @@ -19,4 +19,4 @@ module OrganizationKeyScopes KEYS_WRITE = 'keys.write' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/password_hash.rb b/lib/appwrite/enums/password_hash.rb index 89e5d8b..732fac0 100644 --- a/lib/appwrite/enums/password_hash.rb +++ b/lib/appwrite/enums/password_hash.rb @@ -14,4 +14,4 @@ module PasswordHash SHA3_512 = 'sha3-512' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/platform_type.rb b/lib/appwrite/enums/platform_type.rb index 49d8b12..df856ce 100644 --- a/lib/appwrite/enums/platform_type.rb +++ b/lib/appwrite/enums/platform_type.rb @@ -8,4 +8,4 @@ module PlatformType WEB = 'web' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_auth_method_id.rb b/lib/appwrite/enums/project_auth_method_id.rb index a442f73..da27cbb 100644 --- a/lib/appwrite/enums/project_auth_method_id.rb +++ b/lib/appwrite/enums/project_auth_method_id.rb @@ -10,4 +10,4 @@ module ProjectAuthMethodId PHONE = 'phone' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_email_template_id.rb b/lib/appwrite/enums/project_email_template_id.rb index 39773c0..bfe2197 100644 --- a/lib/appwrite/enums/project_email_template_id.rb +++ b/lib/appwrite/enums/project_email_template_id.rb @@ -10,4 +10,4 @@ module ProjectEmailTemplateId OTPSESSION = 'otpSession' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_email_template_locale.rb b/lib/appwrite/enums/project_email_template_locale.rb index 6427f6c..2355a3e 100644 --- a/lib/appwrite/enums/project_email_template_locale.rb +++ b/lib/appwrite/enums/project_email_template_locale.rb @@ -134,4 +134,4 @@ module ProjectEmailTemplateLocale ZU = 'zu' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb index 7a7670c..4052d94 100644 --- a/lib/appwrite/enums/project_key_scopes.rb +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -3,6 +3,7 @@ module Enums module ProjectKeyScopes PROJECT_READ = 'project.read' PROJECT_WRITE = 'project.write' + USAGE_READ = 'usage.read' KEYS_READ = 'keys.read' KEYS_WRITE = 'keys.write' PLATFORMS_READ = 'platforms.read' @@ -42,6 +43,18 @@ module ProjectKeyScopes ATTRIBUTES_WRITE = 'attributes.write' DOCUMENTS_READ = 'documents.read' DOCUMENTS_WRITE = 'documents.write' + DOCUMENTSDB_READ = 'documentsdb.read' + DOCUMENTSDB_WRITE = 'documentsdb.write' + DOCUMENTSDB_COLLECTIONS_READ = 'documentsdb.collections.read' + DOCUMENTSDB_COLLECTIONS_WRITE = 'documentsdb.collections.write' + DOCUMENTSDB_DOCUMENTS_READ = 'documentsdb.documents.read' + DOCUMENTSDB_DOCUMENTS_WRITE = 'documentsdb.documents.write' + VECTORSDB_READ = 'vectorsdb.read' + VECTORSDB_WRITE = 'vectorsdb.write' + VECTORSDB_COLLECTIONS_READ = 'vectorsdb.collections.read' + VECTORSDB_COLLECTIONS_WRITE = 'vectorsdb.collections.write' + VECTORSDB_DOCUMENTS_READ = 'vectorsdb.documents.read' + VECTORSDB_DOCUMENTS_WRITE = 'vectorsdb.documents.write' BUCKETS_READ = 'buckets.read' BUCKETS_WRITE = 'buckets.write' FILES_READ = 'files.read' @@ -94,7 +107,6 @@ module ProjectKeyScopes ARCHIVES_WRITE = 'archives.write' RESTORATIONS_READ = 'restorations.read' RESTORATIONS_WRITE = 'restorations.write' - DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute' DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' WAFRULES_READ = 'wafRules.read' @@ -106,7 +118,6 @@ module ProjectKeyScopes OAUTH2_READ = 'oauth2.read' OAUTH2_WRITE = 'oauth2.write' OAUTH2_INTROSPECT = 'oauth2.introspect' - USAGE_READ = 'usage.read' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth2_google_prompt.rb b/lib/appwrite/enums/project_o_auth2_google_prompt.rb index 4effa04..0c4ac3b 100644 --- a/lib/appwrite/enums/project_o_auth2_google_prompt.rb +++ b/lib/appwrite/enums/project_o_auth2_google_prompt.rb @@ -6,4 +6,4 @@ module ProjectOAuth2GooglePrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb index 268b2b9..6689d1b 100644 --- a/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb +++ b/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb @@ -7,4 +7,4 @@ module ProjectOAuth2OidcPrompt SELECT_ACCOUNT = 'select_account' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_o_auth_provider_id.rb b/lib/appwrite/enums/project_o_auth_provider_id.rb index 44adb56..ae433e0 100644 --- a/lib/appwrite/enums/project_o_auth_provider_id.rb +++ b/lib/appwrite/enums/project_o_auth_provider_id.rb @@ -21,6 +21,7 @@ module ProjectOAuthProviderId GITHUB = 'github' GITLAB = 'gitlab' GOOGLE = 'google' + HUGGINGFACE = 'huggingface' KEYCLOAK = 'keycloak' KICK = 'kick' LINKEDIN = 'linkedin' @@ -47,4 +48,4 @@ module ProjectOAuthProviderId ZOOM = 'zoom' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_policy_id.rb b/lib/appwrite/enums/project_policy_id.rb index d305218..a844aaf 100644 --- a/lib/appwrite/enums/project_policy_id.rb +++ b/lib/appwrite/enums/project_policy_id.rb @@ -18,4 +18,4 @@ module ProjectPolicyId DENY_CORPORATE_EMAIL = 'deny-corporate-email' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_protocol_id.rb b/lib/appwrite/enums/project_protocol_id.rb index f3948b6..fbfaba8 100644 --- a/lib/appwrite/enums/project_protocol_id.rb +++ b/lib/appwrite/enums/project_protocol_id.rb @@ -6,4 +6,4 @@ module ProjectProtocolId WEBSOCKET = 'websocket' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_service_id.rb b/lib/appwrite/enums/project_service_id.rb index 871e924..c7c4029 100644 --- a/lib/appwrite/enums/project_service_id.rb +++ b/lib/appwrite/enums/project_service_id.rb @@ -22,4 +22,4 @@ module ProjectServiceId OAUTH2 = 'oauth2' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/project_smtp_secure.rb b/lib/appwrite/enums/project_smtp_secure.rb index 0166b21..5a083d0 100644 --- a/lib/appwrite/enums/project_smtp_secure.rb +++ b/lib/appwrite/enums/project_smtp_secure.rb @@ -5,4 +5,4 @@ module ProjectSMTPSecure SSL = 'ssl' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_resource_type.rb b/lib/appwrite/enums/proxy_resource_type.rb index 9518515..a1ed461 100644 --- a/lib/appwrite/enums/proxy_resource_type.rb +++ b/lib/appwrite/enums/proxy_resource_type.rb @@ -5,4 +5,4 @@ module ProxyResourceType FUNCTION = 'function' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb b/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb index a532af8..89a76ba 100644 --- a/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +++ b/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb @@ -5,4 +5,4 @@ module ProxyRuleDeploymentResourceType SITE = 'site' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/proxy_rule_status.rb b/lib/appwrite/enums/proxy_rule_status.rb index 50ee0fa..83cc420 100644 --- a/lib/appwrite/enums/proxy_rule_status.rb +++ b/lib/appwrite/enums/proxy_rule_status.rb @@ -6,4 +6,4 @@ module ProxyRuleStatus VERIFIED = 'verified' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/region.rb b/lib/appwrite/enums/region.rb index a17d0ad..9ae0aad 100644 --- a/lib/appwrite/enums/region.rb +++ b/lib/appwrite/enums/region.rb @@ -9,4 +9,4 @@ module Region TOR = 'tor' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/relation_mutate.rb b/lib/appwrite/enums/relation_mutate.rb index 3f9ab22..68bebf4 100644 --- a/lib/appwrite/enums/relation_mutate.rb +++ b/lib/appwrite/enums/relation_mutate.rb @@ -6,4 +6,4 @@ module RelationMutate SETNULL = 'setNull' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/relationship_type.rb b/lib/appwrite/enums/relationship_type.rb index 642ff38..330eba3 100644 --- a/lib/appwrite/enums/relationship_type.rb +++ b/lib/appwrite/enums/relationship_type.rb @@ -7,4 +7,4 @@ module RelationshipType ONETOMANY = 'oneToMany' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/runtime.rb b/lib/appwrite/enums/runtime.rb index bf2c4e2..ed615ec 100644 --- a/lib/appwrite/enums/runtime.rb +++ b/lib/appwrite/enums/runtime.rb @@ -79,6 +79,7 @@ module Runtime BUN_1_1 = 'bun-1.1' BUN_1_2 = 'bun-1.2' BUN_1_3 = 'bun-1.3' + BUN_1_4 = 'bun-1.4' GO_1_23 = 'go-1.23' GO_1_24 = 'go-1.24' GO_1_25 = 'go-1.25' @@ -95,4 +96,4 @@ module Runtime FLUTTER_3_44 = 'flutter-3.44' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/smtp_encryption.rb b/lib/appwrite/enums/smtp_encryption.rb index bc162b4..f1d9855 100644 --- a/lib/appwrite/enums/smtp_encryption.rb +++ b/lib/appwrite/enums/smtp_encryption.rb @@ -6,4 +6,4 @@ module SmtpEncryption TLS = 'tls' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/status_code.rb b/lib/appwrite/enums/status_code.rb index 14f5902..c7e5067 100644 --- a/lib/appwrite/enums/status_code.rb +++ b/lib/appwrite/enums/status_code.rb @@ -7,4 +7,4 @@ module StatusCode PERMANENTREDIRECT = '308' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/tables_db_index_type.rb b/lib/appwrite/enums/tables_db_index_type.rb index b8ccea6..6be77a5 100644 --- a/lib/appwrite/enums/tables_db_index_type.rb +++ b/lib/appwrite/enums/tables_db_index_type.rb @@ -7,4 +7,4 @@ module TablesDBIndexType SPATIAL = 'spatial' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/template_reference_type.rb b/lib/appwrite/enums/template_reference_type.rb index 4fe8a4c..76d6aec 100644 --- a/lib/appwrite/enums/template_reference_type.rb +++ b/lib/appwrite/enums/template_reference_type.rb @@ -6,4 +6,4 @@ module TemplateReferenceType TAG = 'tag' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/timezone.rb b/lib/appwrite/enums/timezone.rb index be558b6..03bcb8a 100644 --- a/lib/appwrite/enums/timezone.rb +++ b/lib/appwrite/enums/timezone.rb @@ -422,4 +422,4 @@ module Timezone UTC = 'utc' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/vcs_reference_type.rb b/lib/appwrite/enums/vcs_reference_type.rb index d34529a..0e2a81f 100644 --- a/lib/appwrite/enums/vcs_reference_type.rb +++ b/lib/appwrite/enums/vcs_reference_type.rb @@ -6,4 +6,4 @@ module VCSReferenceType TAG = 'tag' end end -end \ No newline at end of file +end diff --git a/lib/appwrite/enums/vectors_db_index_type.rb b/lib/appwrite/enums/vectors_db_index_type.rb new file mode 100644 index 0000000..ae63eaf --- /dev/null +++ b/lib/appwrite/enums/vectors_db_index_type.rb @@ -0,0 +1,12 @@ +module Appwrite + module Enums + module VectorsDBIndexType + HNSW_EUCLIDEAN = 'hnsw_euclidean' + HNSW_DOT = 'hnsw_dot' + HNSW_COSINE = 'hnsw_cosine' + OBJECT = 'object' + KEY = 'key' + UNIQUE = 'unique' + end + end +end diff --git a/lib/appwrite/exception.rb b/lib/appwrite/exception.rb index d6d8683..ed8bb1e 100644 --- a/lib/appwrite/exception.rb +++ b/lib/appwrite/exception.rb @@ -3,7 +3,7 @@ class Exception < StandardError attr_reader :code attr_reader :response attr_reader :type - + def initialize(message, code = 0, type = nil, response = nil) super(message) @code = code diff --git a/lib/appwrite/id.rb b/lib/appwrite/id.rb index f98ea1d..eb95084 100644 --- a/lib/appwrite/id.rb +++ b/lib/appwrite/id.rb @@ -7,15 +7,15 @@ def self.custom(id) end # Generate a unique ID with padding to have a longer ID - def self.unique(padding=7) + def self.unique(padding = 7) base_id = self.hex_timestamp random_padding = SecureRandom.hex(padding) random_padding = random_padding[0...padding] base_id + random_padding end - #Generate an hex ID based on timestamp - #Recreated from https://www.php.net/manual/en/function.uniqid.php + # Generate an hex ID based on timestamp + # Recreated from https://www.php.net/manual/en/function.uniqid.php private_class_method def self.hex_timestamp now = Time.now sec = now.to_i diff --git a/lib/appwrite/input_file.rb b/lib/appwrite/input_file.rb index a704353..d70df5d 100644 --- a/lib/appwrite/input_file.rb +++ b/lib/appwrite/input_file.rb @@ -30,4 +30,4 @@ def self.from_bytes(bytes, filename: nil, mime_type: nil) self.from_string(bytes.pack('C*'), filename: filename, mime_type: mime_type) end end -end \ No newline at end of file +end diff --git a/lib/appwrite/models/activity_event.rb b/lib/appwrite/models/activity_event.rb index 3a000a2..34699a2 100644 --- a/lib/appwrite/models/activity_event.rb +++ b/lib/appwrite/models/activity_event.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/activity_event_list.rb b/lib/appwrite/models/activity_event_list.rb index 2465bac..6c8ebfe 100644 --- a/lib/appwrite/models/activity_event_list.rb +++ b/lib/appwrite/models/activity_event_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/additional_resource.rb b/lib/appwrite/models/additional_resource.rb index 23e5402..54d3ad4 100644 --- a/lib/appwrite/models/additional_resource.rb +++ b/lib/appwrite/models/additional_resource.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_argon2.rb b/lib/appwrite/models/algo_argon2.rb index c4f6b80..d2413e7 100644 --- a/lib/appwrite/models/algo_argon2.rb +++ b/lib/appwrite/models/algo_argon2.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_bcrypt.rb b/lib/appwrite/models/algo_bcrypt.rb index 78f1732..0407c81 100644 --- a/lib/appwrite/models/algo_bcrypt.rb +++ b/lib/appwrite/models/algo_bcrypt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_md5.rb b/lib/appwrite/models/algo_md5.rb index 64f3505..d7f315c 100644 --- a/lib/appwrite/models/algo_md5.rb +++ b/lib/appwrite/models/algo_md5.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_phpass.rb b/lib/appwrite/models/algo_phpass.rb index 45ccc1e..496d206 100644 --- a/lib/appwrite/models/algo_phpass.rb +++ b/lib/appwrite/models/algo_phpass.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_scrypt.rb b/lib/appwrite/models/algo_scrypt.rb index 48419d2..7128bb2 100644 --- a/lib/appwrite/models/algo_scrypt.rb +++ b/lib/appwrite/models/algo_scrypt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_scrypt_modified.rb b/lib/appwrite/models/algo_scrypt_modified.rb index 33b31da..8862154 100644 --- a/lib/appwrite/models/algo_scrypt_modified.rb +++ b/lib/appwrite/models/algo_scrypt_modified.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/algo_sha.rb b/lib/appwrite/models/algo_sha.rb index e63ac76..bd227d5 100644 --- a/lib/appwrite/models/algo_sha.rb +++ b/lib/appwrite/models/algo_sha.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app.rb b/lib/appwrite/models/app.rb index e033764..5123fbd 100644 --- a/lib/appwrite/models/app.rb +++ b/lib/appwrite/models/app.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_installation.rb b/lib/appwrite/models/app_installation.rb index e369d23..32a12a3 100644 --- a/lib/appwrite/models/app_installation.rb +++ b/lib/appwrite/models/app_installation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( authorization_details:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_installation_list.rb b/lib/appwrite/models/app_installation_list.rb index 1c0f16f..d59981c 100644 --- a/lib/appwrite/models/app_installation_list.rb +++ b/lib/appwrite/models/app_installation_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_key.rb b/lib/appwrite/models/app_key.rb index a9f1c28..f1a457f 100644 --- a/lib/appwrite/models/app_key.rb +++ b/lib/appwrite/models/app_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_key_list.rb b/lib/appwrite/models/app_key_list.rb index 6d3198f..3ec9ecd 100644 --- a/lib/appwrite/models/app_key_list.rb +++ b/lib/appwrite/models/app_key_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_scope.rb b/lib/appwrite/models/app_scope.rb index 5044bb6..c12c0cc 100644 --- a/lib/appwrite/models/app_scope.rb +++ b/lib/appwrite/models/app_scope.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_scope_list.rb b/lib/appwrite/models/app_scope_list.rb index 21d13fb..8a7b772 100644 --- a/lib/appwrite/models/app_scope_list.rb +++ b/lib/appwrite/models/app_scope_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_secret.rb b/lib/appwrite/models/app_secret.rb index 7f5aa95..4170d66 100644 --- a/lib/appwrite/models/app_secret.rb +++ b/lib/appwrite/models/app_secret.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/app_secret_list.rb b/lib/appwrite/models/app_secret_list.rb index 09a3302..d4da1d5 100644 --- a/lib/appwrite/models/app_secret_list.rb +++ b/lib/appwrite/models/app_secret_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/app_secret_plaintext.rb b/lib/appwrite/models/app_secret_plaintext.rb index 9060824..d36c260 100644 --- a/lib/appwrite/models/app_secret_plaintext.rb +++ b/lib/appwrite/models/app_secret_plaintext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( hint:, created_by_id:, created_by_name:, - last_accessed_at: + last_accessed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/apps_list.rb b/lib/appwrite/models/apps_list.rb index cf91168..354957b 100644 --- a/lib/appwrite/models/apps_list.rb +++ b/lib/appwrite/models/apps_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/attribute_bigint.rb b/lib/appwrite/models/attribute_bigint.rb index b564ca6..b2286d7 100644 --- a/lib/appwrite/models/attribute_bigint.rb +++ b/lib/appwrite/models/attribute_bigint.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_boolean.rb b/lib/appwrite/models/attribute_boolean.rb index a2ddaa1..145da45 100644 --- a/lib/appwrite/models/attribute_boolean.rb +++ b/lib/appwrite/models/attribute_boolean.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_datetime.rb b/lib/appwrite/models/attribute_datetime.rb index af298fe..2cd2387 100644 --- a/lib/appwrite/models/attribute_datetime.rb +++ b/lib/appwrite/models/attribute_datetime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_email.rb b/lib/appwrite/models/attribute_email.rb index 701a48c..d3dc958 100644 --- a/lib/appwrite/models/attribute_email.rb +++ b/lib/appwrite/models/attribute_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_enum.rb b/lib/appwrite/models/attribute_enum.rb index 4659cb8..758db16 100644 --- a/lib/appwrite/models/attribute_enum.rb +++ b/lib/appwrite/models/attribute_enum.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, elements:, format:, - default: + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_float.rb b/lib/appwrite/models/attribute_float.rb index da0155f..fd4c258 100644 --- a/lib/appwrite/models/attribute_float.rb +++ b/lib/appwrite/models/attribute_float.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_integer.rb b/lib/appwrite/models/attribute_integer.rb index 984c337..0707b34 100644 --- a/lib/appwrite/models/attribute_integer.rb +++ b/lib/appwrite/models/attribute_integer.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_ip.rb b/lib/appwrite/models/attribute_ip.rb index e5a56fb..4ac5e3b 100644 --- a/lib/appwrite/models/attribute_ip.rb +++ b/lib/appwrite/models/attribute_ip.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_line.rb b/lib/appwrite/models/attribute_line.rb index aa410b6..23cda30 100644 --- a/lib/appwrite/models/attribute_line.rb +++ b/lib/appwrite/models/attribute_line.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_list.rb b/lib/appwrite/models/attribute_list.rb index a93c558..4aafafb 100644 --- a/lib/appwrite/models/attribute_list.rb +++ b/lib/appwrite/models/attribute_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/attribute_longtext.rb b/lib/appwrite/models/attribute_longtext.rb index 51607c8..55922b0 100644 --- a/lib/appwrite/models/attribute_longtext.rb +++ b/lib/appwrite/models/attribute_longtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_mediumtext.rb b/lib/appwrite/models/attribute_mediumtext.rb index eafa3cf..0dea933 100644 --- a/lib/appwrite/models/attribute_mediumtext.rb +++ b/lib/appwrite/models/attribute_mediumtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_object.rb b/lib/appwrite/models/attribute_object.rb new file mode 100644 index 0000000..ab85153 --- /dev/null +++ b/lib/appwrite/models/attribute_object.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class AttributeObject + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :required + attr_reader :array + attr_reader :created_at + attr_reader :updated_at + + def initialize( + key:, + type:, + status:, + error:, + required:, + array:, + created_at:, + updated_at: + ) + @key = key + @type = type + @status = validate_status(status) + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + end + + def self.from(map:) + AttributeObject.new( + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + required: map["required"], + array: map["array"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at + } + end + + private + + def validate_status(status) + valid_status = [ + Appwrite::Enums::AttributeStatus::AVAILABLE, + Appwrite::Enums::AttributeStatus::PROCESSING, + Appwrite::Enums::AttributeStatus::DELETING, + Appwrite::Enums::AttributeStatus::STUCK, + Appwrite::Enums::AttributeStatus::FAILED, + ] + + unless valid_status.include?(status) + raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') + end + + status + end + end + end +end diff --git a/lib/appwrite/models/attribute_point.rb b/lib/appwrite/models/attribute_point.rb index 27f4257..b236cb1 100644 --- a/lib/appwrite/models/attribute_point.rb +++ b/lib/appwrite/models/attribute_point.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_polygon.rb b/lib/appwrite/models/attribute_polygon.rb index a0b62c4..44ce447 100644 --- a/lib/appwrite/models/attribute_polygon.rb +++ b/lib/appwrite/models/attribute_polygon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_relationship.rb b/lib/appwrite/models/attribute_relationship.rb index 47e783f..9b8da81 100644 --- a/lib/appwrite/models/attribute_relationship.rb +++ b/lib/appwrite/models/attribute_relationship.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, related_collection:, @@ -105,7 +105,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_string.rb b/lib/appwrite/models/attribute_string.rb index 82f1df5..e5e2720 100644 --- a/lib/appwrite/models/attribute_string.rb +++ b/lib/appwrite/models/attribute_string.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_text.rb b/lib/appwrite/models/attribute_text.rb index 7a45111..3997ad1 100644 --- a/lib/appwrite/models/attribute_text.rb +++ b/lib/appwrite/models/attribute_text.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_url.rb b/lib/appwrite/models/attribute_url.rb index 0e9dcc0..2353dc7 100644 --- a/lib/appwrite/models/attribute_url.rb +++ b/lib/appwrite/models/attribute_url.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_varchar.rb b/lib/appwrite/models/attribute_varchar.rb index c318b9a..3720b0e 100644 --- a/lib/appwrite/models/attribute_varchar.rb +++ b/lib/appwrite/models/attribute_varchar.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/attribute_vector.rb b/lib/appwrite/models/attribute_vector.rb new file mode 100644 index 0000000..3954eef --- /dev/null +++ b/lib/appwrite/models/attribute_vector.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class AttributeVector + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :required + attr_reader :array + attr_reader :created_at + attr_reader :updated_at + attr_reader :size + + def initialize( + key:, + type:, + status:, + error:, + required:, + array:, + created_at:, + updated_at:, + size: + ) + @key = key + @type = type + @status = validate_status(status) + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @size = size + end + + def self.from(map:) + AttributeVector.new( + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + required: map["required"], + array: map["array"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + size: map["size"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "size": @size + } + end + + private + + def validate_status(status) + valid_status = [ + Appwrite::Enums::AttributeStatus::AVAILABLE, + Appwrite::Enums::AttributeStatus::PROCESSING, + Appwrite::Enums::AttributeStatus::DELETING, + Appwrite::Enums::AttributeStatus::STUCK, + Appwrite::Enums::AttributeStatus::FAILED, + ] + + unless valid_status.include?(status) + raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ') + end + + status + end + end + end +end diff --git a/lib/appwrite/models/backup_archive.rb b/lib/appwrite/models/backup_archive.rb index f8cb598..71ea159 100644 --- a/lib/appwrite/models/backup_archive.rb +++ b/lib/appwrite/models/backup_archive.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -27,8 +27,8 @@ def initialize( migration_id:, services:, resources:, - resource_id: , - resource_type: + resource_id:, + resource_type: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/backup_archive_list.rb b/lib/appwrite/models/backup_archive_list.rb index 40d4a3c..9c0cc7c 100644 --- a/lib/appwrite/models/backup_archive_list.rb +++ b/lib/appwrite/models/backup_archive_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_policy.rb b/lib/appwrite/models/backup_policy.rb index abbe49c..6e8e037 100644 --- a/lib/appwrite/models/backup_policy.rb +++ b/lib/appwrite/models/backup_policy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -23,8 +23,8 @@ def initialize( updated_at:, services:, resources:, - resource_id: , - resource_type: , + resource_id:, + resource_type:, retention:, schedule:, type:, diff --git a/lib/appwrite/models/backup_policy_list.rb b/lib/appwrite/models/backup_policy_list.rb index b7790d2..d5de4a5 100644 --- a/lib/appwrite/models/backup_policy_list.rb +++ b/lib/appwrite/models/backup_policy_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_restoration.rb b/lib/appwrite/models/backup_restoration.rb index 669e6cb..61eb62f 100644 --- a/lib/appwrite/models/backup_restoration.rb +++ b/lib/appwrite/models/backup_restoration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/backup_restoration_list.rb b/lib/appwrite/models/backup_restoration_list.rb index 102e840..671e135 100644 --- a/lib/appwrite/models/backup_restoration_list.rb +++ b/lib/appwrite/models/backup_restoration_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/billing_limits.rb b/lib/appwrite/models/billing_limits.rb index fa7f3ea..ef61643 100644 --- a/lib/appwrite/models/billing_limits.rb +++ b/lib/appwrite/models/billing_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,14 +13,14 @@ class BillingLimits attr_reader :budget_limit def initialize( - bandwidth: , - storage: , - users: , - executions: , - gb_hours: , - image_transformations: , - auth_phone: , - budget_limit: + bandwidth:, + storage:, + users:, + executions:, + gb_hours:, + image_transformations:, + auth_phone:, + budget_limit: ) @bandwidth = bandwidth @storage = storage diff --git a/lib/appwrite/models/billing_plan.rb b/lib/appwrite/models/billing_plan.rb index 5e7bd7d..b56d147 100644 --- a/lib/appwrite/models/billing_plan.rb +++ b/lib/appwrite/models/billing_plan.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -56,6 +56,7 @@ class BillingPlan attr_reader :supports_mock_numbers attr_reader :supports_organization_roles attr_reader :supports_credits + attr_reader :supports_dedicated_databases attr_reader :supports_disposable_email_validation attr_reader :supports_canonical_email_validation attr_reader :supports_free_email_validation @@ -71,6 +72,7 @@ class BillingPlan attr_reader :limits attr_reader :group attr_reader :program + attr_reader :database_compute_credit attr_reader :dedicated_databases def initialize( @@ -84,7 +86,7 @@ def initialize( storage:, image_transformations:, screenshots_generated:, - members: , + members:, webhooks:, waf_rules:, projects:, @@ -108,9 +110,9 @@ def initialize( topics:, auth_phone:, domains:, - activity_logs: , + activity_logs:, usage_logs:, - usage_logs_intervals: , + usage_logs_intervals:, project_inactivity_days:, alert_limit:, usage:, @@ -127,22 +129,24 @@ def initialize( supports_mock_numbers:, supports_organization_roles:, supports_credits:, + supports_dedicated_databases:, supports_disposable_email_validation:, supports_canonical_email_validation:, supports_free_email_validation:, supports_corporate_email_validation:, supports_project_specific_roles:, - backups_enabled: , + backups_enabled:, usage_per_project:, supported_addons:, - backup_policies: , + backup_policies:, deployment_size:, build_size:, databases_allow_encrypt:, - limits: , + limits:, group:, - program: , - dedicated_databases: + program:, + database_compute_credit:, + dedicated_databases: ) @id = id @name = name @@ -197,6 +201,7 @@ def initialize( @supports_mock_numbers = supports_mock_numbers @supports_organization_roles = supports_organization_roles @supports_credits = supports_credits + @supports_dedicated_databases = supports_dedicated_databases @supports_disposable_email_validation = supports_disposable_email_validation @supports_canonical_email_validation = supports_canonical_email_validation @supports_free_email_validation = supports_free_email_validation @@ -212,6 +217,7 @@ def initialize( @limits = limits @group = validate_group(group) @program = program + @database_compute_credit = database_compute_credit @dedicated_databases = dedicated_databases end @@ -270,6 +276,7 @@ def self.from(map:) supports_mock_numbers: map["supportsMockNumbers"], supports_organization_roles: map["supportsOrganizationRoles"], supports_credits: map["supportsCredits"], + supports_dedicated_databases: map["supportsDedicatedDatabases"], supports_disposable_email_validation: map["supportsDisposableEmailValidation"], supports_canonical_email_validation: map["supportsCanonicalEmailValidation"], supports_free_email_validation: map["supportsFreeEmailValidation"], @@ -285,6 +292,7 @@ def self.from(map:) limits: map["limits"].nil? ? nil : BillingPlanLimits.from(map: map["limits"]), group: map["group"], program: map["program"].nil? ? nil : Program.from(map: map["program"]), + database_compute_credit: map["databaseComputeCredit"], dedicated_databases: map["dedicatedDatabases"].nil? ? nil : BillingPlanDedicatedDatabaseLimits.from(map: map["dedicatedDatabases"]) ) end @@ -344,6 +352,7 @@ def to_map "supportsMockNumbers": @supports_mock_numbers, "supportsOrganizationRoles": @supports_organization_roles, "supportsCredits": @supports_credits, + "supportsDedicatedDatabases": @supports_dedicated_databases, "supportsDisposableEmailValidation": @supports_disposable_email_validation, "supportsCanonicalEmailValidation": @supports_canonical_email_validation, "supportsFreeEmailValidation": @supports_free_email_validation, @@ -359,6 +368,7 @@ def to_map "limits": @limits&.to_map, "group": @group, "program": @program&.to_map, + "databaseComputeCredit": @database_compute_credit, "dedicatedDatabases": @dedicated_databases&.to_map } end @@ -378,7 +388,6 @@ def validate_group(group) group end - end end end diff --git a/lib/appwrite/models/billing_plan_addon.rb b/lib/appwrite/models/billing_plan_addon.rb index b128cf1..3a24097 100644 --- a/lib/appwrite/models/billing_plan_addon.rb +++ b/lib/appwrite/models/billing_plan_addon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,8 +7,8 @@ class BillingPlanAddon attr_reader :projects def initialize( - seats: , - projects: + seats:, + projects: ) @seats = seats @projects = projects diff --git a/lib/appwrite/models/billing_plan_addon_details.rb b/lib/appwrite/models/billing_plan_addon_details.rb index 72335b4..3dc5e28 100644 --- a/lib/appwrite/models/billing_plan_addon_details.rb +++ b/lib/appwrite/models/billing_plan_addon_details.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -17,7 +17,7 @@ def initialize( plan_included:, limit:, type:, - currency: , + currency:, price:, value:, invoice_desc: diff --git a/lib/appwrite/models/billing_plan_dedicated_database_limits.rb b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb index 41458e7..3e179ad 100644 --- a/lib/appwrite/models/billing_plan_dedicated_database_limits.rb +++ b/lib/appwrite/models/billing_plan_dedicated_database_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,25 +24,25 @@ class BillingPlanDedicatedDatabaseLimits attr_reader :allowed_sync_modes def initialize( - min_cpu: , - max_cpu: , - min_memory_mb: , - max_memory_mb: , - min_storage_gb: , - max_storage_gb: , - max_replicas: , - max_connections: , - max_ip_allowlist_size: , - max_extensions: , - max_backup_retention_days: , - max_pitr_retention_days: , - max_sql_api_max_rows: , - max_sql_api_max_bytes: , - max_sql_api_timeout_seconds: , - max_sql_api_allowed_statements: , - allowed_sql_statements: , - allowed_storage_classes: , - allowed_sync_modes: + min_cpu:, + max_cpu:, + min_memory_mb:, + max_memory_mb:, + min_storage_gb:, + max_storage_gb:, + max_replicas:, + max_connections:, + max_ip_allowlist_size:, + max_extensions:, + max_backup_retention_days:, + max_pitr_retention_days:, + max_sql_api_max_rows:, + max_sql_api_max_bytes:, + max_sql_api_timeout_seconds:, + max_sql_api_allowed_statements:, + allowed_sql_statements:, + allowed_storage_classes:, + allowed_sync_modes: ) @min_cpu = min_cpu @max_cpu = max_cpu diff --git a/lib/appwrite/models/billing_plan_limits.rb b/lib/appwrite/models/billing_plan_limits.rb index 547fd30..999a55b 100644 --- a/lib/appwrite/models/billing_plan_limits.rb +++ b/lib/appwrite/models/billing_plan_limits.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,8 +7,8 @@ class BillingPlanLimits attr_reader :daily_credits def initialize( - credits: , - daily_credits: + credits:, + daily_credits: ) @credits = credits @daily_credits = daily_credits diff --git a/lib/appwrite/models/billing_plan_supported_addons.rb b/lib/appwrite/models/billing_plan_supported_addons.rb index 504a98d..ea2d807 100644 --- a/lib/appwrite/models/billing_plan_supported_addons.rb +++ b/lib/appwrite/models/billing_plan_supported_addons.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/block.rb b/lib/appwrite/models/block.rb index b7c5510..4a1c81a 100644 --- a/lib/appwrite/models/block.rb +++ b/lib/appwrite/models/block.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,8 +20,8 @@ def initialize( resource_type:, resource_id:, mode:, - reason: , - expired_at: , + reason:, + expired_at:, project_name:, region:, organization_name:, diff --git a/lib/appwrite/models/bucket.rb b/lib/appwrite/models/bucket.rb index ab45b57..c7e8af9 100644 --- a/lib/appwrite/models/bucket.rb +++ b/lib/appwrite/models/bucket.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/bucket_list.rb b/lib/appwrite/models/bucket_list.rb index 91e2c72..7d3c15a 100644 --- a/lib/appwrite/models/bucket_list.rb +++ b/lib/appwrite/models/bucket_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/collection.rb b/lib/appwrite/models/collection.rb index 3384086..9e270f2 100644 --- a/lib/appwrite/models/collection.rb +++ b/lib/appwrite/models/collection.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/collection_list.rb b/lib/appwrite/models/collection_list.rb index 3dc18b6..e1e42d2 100644 --- a/lib/appwrite/models/collection_list.rb +++ b/lib/appwrite/models/collection_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_bigint.rb b/lib/appwrite/models/column_bigint.rb index ee45efd..3dfa471 100644 --- a/lib/appwrite/models/column_bigint.rb +++ b/lib/appwrite/models/column_bigint.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_boolean.rb b/lib/appwrite/models/column_boolean.rb index 288cc68..83baf4a 100644 --- a/lib/appwrite/models/column_boolean.rb +++ b/lib/appwrite/models/column_boolean.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_datetime.rb b/lib/appwrite/models/column_datetime.rb index 6aaee90..6012266 100644 --- a/lib/appwrite/models/column_datetime.rb +++ b/lib/appwrite/models/column_datetime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_email.rb b/lib/appwrite/models/column_email.rb index ea67469..574e47e 100644 --- a/lib/appwrite/models/column_email.rb +++ b/lib/appwrite/models/column_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_enum.rb b/lib/appwrite/models/column_enum.rb index a705af9..0f2bd54 100644 --- a/lib/appwrite/models/column_enum.rb +++ b/lib/appwrite/models/column_enum.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, elements:, format:, - default: + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_float.rb b/lib/appwrite/models/column_float.rb index 7655e3b..3c06c69 100644 --- a/lib/appwrite/models/column_float.rb +++ b/lib/appwrite/models/column_float.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_index.rb b/lib/appwrite/models/column_index.rb index c9927de..478d4c2 100644 --- a/lib/appwrite/models/column_index.rb +++ b/lib/appwrite/models/column_index.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( error:, columns:, lengths:, - orders: + orders: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/column_index_list.rb b/lib/appwrite/models/column_index_list.rb index 8543887..9278fd4 100644 --- a/lib/appwrite/models/column_index_list.rb +++ b/lib/appwrite/models/column_index_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_integer.rb b/lib/appwrite/models/column_integer.rb index 3c5c86d..0a71c44 100644 --- a/lib/appwrite/models/column_integer.rb +++ b/lib/appwrite/models/column_integer.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - min: , - max: , - default: + min:, + max:, + default: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_ip.rb b/lib/appwrite/models/column_ip.rb index 2c17d3c..3d4f655 100644 --- a/lib/appwrite/models/column_ip.rb +++ b/lib/appwrite/models/column_ip.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_line.rb b/lib/appwrite/models/column_line.rb index ee7cb06..f8a14bf 100644 --- a/lib/appwrite/models/column_line.rb +++ b/lib/appwrite/models/column_line.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_list.rb b/lib/appwrite/models/column_list.rb index b01f858..8d239dd 100644 --- a/lib/appwrite/models/column_list.rb +++ b/lib/appwrite/models/column_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/column_longtext.rb b/lib/appwrite/models/column_longtext.rb index 9efbcec..5a11208 100644 --- a/lib/appwrite/models/column_longtext.rb +++ b/lib/appwrite/models/column_longtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_mediumtext.rb b/lib/appwrite/models/column_mediumtext.rb index 5260dca..c5b465c 100644 --- a/lib/appwrite/models/column_mediumtext.rb +++ b/lib/appwrite/models/column_mediumtext.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_point.rb b/lib/appwrite/models/column_point.rb index 4ce367e..34e5cf0 100644 --- a/lib/appwrite/models/column_point.rb +++ b/lib/appwrite/models/column_point.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_polygon.rb b/lib/appwrite/models/column_polygon.rb index db6d4db..82f3973 100644 --- a/lib/appwrite/models/column_polygon.rb +++ b/lib/appwrite/models/column_polygon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: + default: ) @key = key @type = type @@ -80,7 +80,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_relationship.rb b/lib/appwrite/models/column_relationship.rb index bf9645b..c34643e 100644 --- a/lib/appwrite/models/column_relationship.rb +++ b/lib/appwrite/models/column_relationship.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, related_table:, @@ -105,7 +105,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_string.rb b/lib/appwrite/models/column_string.rb index 3de0e08..6e08f2f 100644 --- a/lib/appwrite/models/column_string.rb +++ b/lib/appwrite/models/column_string.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_text.rb b/lib/appwrite/models/column_text.rb index d6f9ea1..c3c7afb 100644 --- a/lib/appwrite/models/column_text.rb +++ b/lib/appwrite/models/column_text.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_url.rb b/lib/appwrite/models/column_url.rb index 624e5c4..11829a7 100644 --- a/lib/appwrite/models/column_url.rb +++ b/lib/appwrite/models/column_url.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,11 +20,11 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, format:, - default: + default: ) @key = key @type = type @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/column_varchar.rb b/lib/appwrite/models/column_varchar.rb index 532686d..1a1083d 100644 --- a/lib/appwrite/models/column_varchar.rb +++ b/lib/appwrite/models/column_varchar.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -21,12 +21,12 @@ def initialize( status:, error:, required:, - array: , + array:, created_at:, updated_at:, size:, - default: , - encrypt: + default:, + encrypt: ) @key = key @type = type @@ -90,7 +90,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/continent.rb b/lib/appwrite/models/continent.rb index 3bfd855..861ec29 100644 --- a/lib/appwrite/models/continent.rb +++ b/lib/appwrite/models/continent.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/continent_list.rb b/lib/appwrite/models/continent_list.rb index d4c1495..a531249 100644 --- a/lib/appwrite/models/continent_list.rb +++ b/lib/appwrite/models/continent_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/country.rb b/lib/appwrite/models/country.rb index a5f66f9..0765979 100644 --- a/lib/appwrite/models/country.rb +++ b/lib/appwrite/models/country.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/country_list.rb b/lib/appwrite/models/country_list.rb index b885b7b..1611dda 100644 --- a/lib/appwrite/models/country_list.rb +++ b/lib/appwrite/models/country_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/currency.rb b/lib/appwrite/models/currency.rb index cfaa2fc..b89e48a 100644 --- a/lib/appwrite/models/currency.rb +++ b/lib/appwrite/models/currency.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/currency_list.rb b/lib/appwrite/models/currency_list.rb index 7c54d61..53d2359 100644 --- a/lib/appwrite/models/currency_list.rb +++ b/lib/appwrite/models/currency_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 90e95d6..d0408fc 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,6 +13,9 @@ class Database attr_reader :engine attr_reader :specification attr_reader :replicas + attr_reader :error + attr_reader :container_status + attr_reader :lifecycle_state attr_reader :policies attr_reader :archives @@ -23,12 +26,15 @@ def initialize( updated_at:, enabled:, type:, - status: , - engine: , - specification: , - replicas: , - policies: , - archives: + status:, + engine:, + specification:, + replicas:, + error:, + container_status:, + lifecycle_state:, + policies:, + archives: ) @id = id @name = name @@ -40,6 +46,9 @@ def initialize( @engine = engine @specification = specification @replicas = replicas + @error = error + @container_status = container_status + @lifecycle_state = lifecycle_state @policies = policies @archives = archives end @@ -56,6 +65,9 @@ def self.from(map:) engine: map["engine"], specification: map["specification"], replicas: map["replicas"], + error: map["error"], + container_status: map["containerStatus"], + lifecycle_state: map["lifecycleState"], policies: map["policies"]&.map { |it| BackupPolicy.from(map: it) }, archives: map["archives"]&.map { |it| BackupArchive.from(map: it) } ) @@ -73,6 +85,9 @@ def to_map "engine": @engine, "specification": @specification, "replicas": @replicas, + "error": @error, + "containerStatus": @container_status, + "lifecycleState": @lifecycle_state, "policies": @policies&.map { |it| it.to_map }, "archives": @archives&.map { |it| it.to_map } } @@ -122,7 +137,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/database_list.rb b/lib/appwrite/models/database_list.rb index 80f0791..37c83aa 100644 --- a/lib/appwrite/models/database_list.rb +++ b/lib/appwrite/models/database_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_migration.rb b/lib/appwrite/models/database_migration.rb index afd0ce6..75becc3 100644 --- a/lib/appwrite/models/database_migration.rb +++ b/lib/appwrite/models/database_migration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -13,6 +13,7 @@ class DatabaseMigration attr_reader :attempt attr_reader :last_error attr_reader :lag_documents + attr_reader :changelog_watermark attr_reader :verified_at attr_reader :cutover_at attr_reader :soak_until @@ -31,6 +32,7 @@ def initialize( attempt:, last_error:, lag_documents:, + changelog_watermark:, verified_at:, cutover_at:, soak_until:, @@ -48,6 +50,7 @@ def initialize( @attempt = attempt @last_error = last_error @lag_documents = lag_documents + @changelog_watermark = changelog_watermark @verified_at = verified_at @cutover_at = cutover_at @soak_until = soak_until @@ -68,6 +71,7 @@ def self.from(map:) attempt: map["attempt"], last_error: map["lastError"], lag_documents: map["lagDocuments"], + changelog_watermark: map["changelogWatermark"], verified_at: map["verifiedAt"], cutover_at: map["cutoverAt"], soak_until: map["soakUntil"], @@ -89,6 +93,7 @@ def to_map "attempt": @attempt, "lastError": @last_error, "lagDocuments": @lag_documents, + "changelogWatermark": @changelog_watermark, "verifiedAt": @verified_at, "cutoverAt": @cutover_at, "soakUntil": @soak_until, diff --git a/lib/appwrite/models/database_migration_list.rb b/lib/appwrite/models/database_migration_list.rb index aa238ba..2173026 100644 --- a/lib/appwrite/models/database_migration_list.rb +++ b/lib/appwrite/models/database_migration_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_status.rb b/lib/appwrite/models/database_status.rb index 4ed60bf..f4a609c 100644 --- a/lib/appwrite/models/database_status.rb +++ b/lib/appwrite/models/database_status.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -26,11 +26,11 @@ def initialize( uptime:, connections:, sync_mode:, - effective_sync_mode: , + effective_sync_mode:, sync_degraded:, sync_acknowledgements:, sync_standby_count:, - sync_state_confirmed: , + sync_state_confirmed:, replicas:, volumes: ) diff --git a/lib/appwrite/models/database_status_connections.rb b/lib/appwrite/models/database_status_connections.rb index bbf2395..623156d 100644 --- a/lib/appwrite/models/database_status_connections.rb +++ b/lib/appwrite/models/database_status_connections.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/database_status_replica.rb b/lib/appwrite/models/database_status_replica.rb index d88c2cb..7ed5387 100644 --- a/lib/appwrite/models/database_status_replica.rb +++ b/lib/appwrite/models/database_status_replica.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -6,17 +6,20 @@ class DatabaseStatusReplica attr_reader :index attr_reader :role attr_reader :healthy + attr_reader :replicating attr_reader :lag_seconds def initialize( index:, role:, healthy:, - lag_seconds: + replicating:, + lag_seconds: ) @index = index @role = role @healthy = healthy + @replicating = replicating @lag_seconds = lag_seconds end @@ -25,6 +28,7 @@ def self.from(map:) index: map["index"], role: map["role"], healthy: map["healthy"], + replicating: map["replicating"], lag_seconds: map["lagSeconds"] ) end @@ -34,6 +38,7 @@ def to_map "index": @index, "role": @role, "healthy": @healthy, + "replicating": @replicating, "lagSeconds": @lag_seconds } end diff --git a/lib/appwrite/models/database_status_volume.rb b/lib/appwrite/models/database_status_volume.rb index 7ace12c..cd15505 100644 --- a/lib/appwrite/models/database_status_volume.rb +++ b/lib/appwrite/models/database_status_volume.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database.rb b/lib/appwrite/models/dedicated_database.rb index d53b19f..9b21a35 100644 --- a/lib/appwrite/models/dedicated_database.rb +++ b/lib/appwrite/models/dedicated_database.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -71,8 +71,8 @@ def initialize( ssl:, status:, container_status:, - last_accessed_at: , - idle_until: , + last_accessed_at:, + idle_until:, lifecycle_state:, idle_timeout_minutes:, cpu:, diff --git a/lib/appwrite/models/dedicated_database_backup.rb b/lib/appwrite/models/dedicated_database_backup.rb new file mode 100644 index 0000000..f48b5d5 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackup + attr_reader :id + attr_reader :created_at + attr_reader :database_id + attr_reader :project_id + attr_reader :policy_id + attr_reader :trigger + attr_reader :type + attr_reader :requested_type + attr_reader :fallback_reason + attr_reader :status + attr_reader :size_bytes + attr_reader :started_at + attr_reader :completed_at + attr_reader :verified_at + attr_reader :expires_at + attr_reader :log_position + attr_reader :error + + def initialize( + id:, + created_at:, + database_id:, + project_id:, + policy_id:, + trigger:, + type:, + requested_type:, + fallback_reason:, + status:, + size_bytes:, + started_at:, + completed_at:, + verified_at:, + expires_at:, + log_position:, + error: + ) + @id = id + @created_at = created_at + @database_id = database_id + @project_id = project_id + @policy_id = policy_id + @trigger = trigger + @type = type + @requested_type = requested_type + @fallback_reason = fallback_reason + @status = status + @size_bytes = size_bytes + @started_at = started_at + @completed_at = completed_at + @verified_at = verified_at + @expires_at = expires_at + @log_position = log_position + @error = error + end + + def self.from(map:) + DedicatedDatabaseBackup.new( + id: map["$id"], + created_at: map["$createdAt"], + database_id: map["databaseId"], + project_id: map["projectId"], + policy_id: map["policyId"], + trigger: map["trigger"], + type: map["type"], + requested_type: map["requestedType"], + fallback_reason: map["fallbackReason"], + status: map["status"], + size_bytes: map["sizeBytes"], + started_at: map["startedAt"], + completed_at: map["completedAt"], + verified_at: map["verifiedAt"], + expires_at: map["expiresAt"], + log_position: map["logPosition"], + error: map["error"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "databaseId": @database_id, + "projectId": @project_id, + "policyId": @policy_id, + "trigger": @trigger, + "type": @type, + "requestedType": @requested_type, + "fallbackReason": @fallback_reason, + "status": @status, + "sizeBytes": @size_bytes, + "startedAt": @started_at, + "completedAt": @completed_at, + "verifiedAt": @verified_at, + "expiresAt": @expires_at, + "logPosition": @log_position, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_backup_list.rb b/lib/appwrite/models/dedicated_database_backup_list.rb new file mode 100644 index 0000000..37d85ec --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackupList + attr_reader :total + attr_reader :backups + + def initialize( + total:, + backups: + ) + @total = total + @backups = backups + end + + def self.from(map:) + DedicatedDatabaseBackupList.new( + total: map["total"], + backups: map["backups"].map { |it| DedicatedDatabaseBackup.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "backups": @backups.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_backup_storage.rb b/lib/appwrite/models/dedicated_database_backup_storage.rb new file mode 100644 index 0000000..3e1cb28 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_backup_storage.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBackupStorage + attr_reader :provider + attr_reader :bucket + attr_reader :region + attr_reader :prefix + attr_reader :endpoint + + def initialize( + provider:, + bucket:, + region:, + prefix:, + endpoint: + ) + @provider = provider + @bucket = bucket + @region = region + @prefix = prefix + @endpoint = endpoint + end + + def self.from(map:) + DedicatedDatabaseBackupStorage.new( + provider: map["provider"], + bucket: map["bucket"], + region: map["region"], + prefix: map["prefix"], + endpoint: map["endpoint"] + ) + end + + def to_map + { + "provider": @provider, + "bucket": @bucket, + "region": @region, + "prefix": @prefix, + "endpoint": @endpoint + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_branch.rb b/lib/appwrite/models/dedicated_database_branch.rb new file mode 100644 index 0000000..991728c --- /dev/null +++ b/lib/appwrite/models/dedicated_database_branch.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBranch + attr_reader :branch_id + attr_reader :branch_name + attr_reader :namespace + attr_reader :expires_at + attr_reader :host + attr_reader :port + attr_reader :database + attr_reader :username + attr_reader :password + attr_reader :ssl + attr_reader :engine + attr_reader :connection_string + + def initialize( + branch_id:, + branch_name:, + namespace:, + expires_at:, + host:, + port:, + database:, + username:, + password:, + ssl:, + engine:, + connection_string: + ) + @branch_id = branch_id + @branch_name = branch_name + @namespace = namespace + @expires_at = expires_at + @host = host + @port = port + @database = database + @username = username + @password = password + @ssl = ssl + @engine = engine + @connection_string = connection_string + end + + def self.from(map:) + DedicatedDatabaseBranch.new( + branch_id: map["branchId"], + branch_name: map["branchName"], + namespace: map["namespace"], + expires_at: map["expiresAt"], + host: map["host"], + port: map["port"], + database: map["database"], + username: map["username"], + password: map["password"], + ssl: map["ssl"], + engine: map["engine"], + connection_string: map["connectionString"] + ) + end + + def to_map + { + "branchId": @branch_id, + "branchName": @branch_name, + "namespace": @namespace, + "expiresAt": @expires_at, + "host": @host, + "port": @port, + "database": @database, + "username": @username, + "password": @password, + "ssl": @ssl, + "engine": @engine, + "connectionString": @connection_string + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_branch_list.rb b/lib/appwrite/models/dedicated_database_branch_list.rb new file mode 100644 index 0000000..106a3eb --- /dev/null +++ b/lib/appwrite/models/dedicated_database_branch_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseBranchList + attr_reader :total + attr_reader :branches + + def initialize( + total:, + branches: + ) + @total = total + @branches = branches + end + + def self.from(map:) + DedicatedDatabaseBranchList.new( + total: map["total"], + branches: map["branches"].map { |it| DedicatedDatabaseBranch.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "branches": @branches.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_execution.rb b/lib/appwrite/models/dedicated_database_execution.rb new file mode 100644 index 0000000..49e247f --- /dev/null +++ b/lib/appwrite/models/dedicated_database_execution.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExecution + attr_reader :rows + attr_reader :row_count + attr_reader :columns + attr_reader :duration_ms + attr_reader :truncated + attr_reader :bytes + + def initialize( + rows:, + row_count:, + columns:, + duration_ms:, + truncated:, + bytes: + ) + @rows = rows + @row_count = row_count + @columns = columns + @duration_ms = duration_ms + @truncated = truncated + @bytes = bytes + end + + def self.from(map:) + DedicatedDatabaseExecution.new( + rows: map["rows"], + row_count: map["rowCount"], + columns: map["columns"].map { |it| DedicatedDatabaseExecutionColumn.from(map: it) }, + duration_ms: map["durationMs"], + truncated: map["truncated"], + bytes: map["bytes"] + ) + end + + def to_map + { + "rows": @rows, + "rowCount": @row_count, + "columns": @columns.map { |it| it.to_map }, + "durationMs": @duration_ms, + "truncated": @truncated, + "bytes": @bytes + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_execution_column.rb b/lib/appwrite/models/dedicated_database_execution_column.rb new file mode 100644 index 0000000..4605650 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_execution_column.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExecutionColumn + attr_reader :name + attr_reader :type + + def initialize( + name:, + type: + ) + @name = name + @type = type + end + + def self.from(map:) + DedicatedDatabaseExecutionColumn.new( + name: map["name"], + type: map["type"] + ) + end + + def to_map + { + "name": @name, + "type": @type + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_extensions.rb b/lib/appwrite/models/dedicated_database_extensions.rb new file mode 100644 index 0000000..26c35a8 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_extensions.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseExtensions + attr_reader :installed + attr_reader :available + attr_reader :metadata + + def initialize( + installed:, + available:, + metadata: + ) + @installed = installed + @available = available + @metadata = metadata + end + + def self.from(map:) + DedicatedDatabaseExtensions.new( + installed: map["installed"], + available: map["available"], + metadata: map["metadata"].map { |it| PostgresExtension.from(map: it) } + ) + end + + def to_map + { + "installed": @installed, + "available": @available, + "metadata": @metadata.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_list.rb b/lib/appwrite/models/dedicated_database_list.rb new file mode 100644 index 0000000..3a66c93 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseList + attr_reader :total + attr_reader :databases + + def initialize( + total:, + databases: + ) + @total = total + @databases = databases + end + + def self.from(map:) + DedicatedDatabaseList.new( + total: map["total"], + databases: map["databases"].map { |it| DedicatedDatabase.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "databases": @databases.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_member.rb b/lib/appwrite/models/dedicated_database_member.rb index dcb0a6d..8aaddc7 100644 --- a/lib/appwrite/models/dedicated_database_member.rb +++ b/lib/appwrite/models/dedicated_database_member.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -6,17 +6,20 @@ class DedicatedDatabaseMember attr_reader :id attr_reader :role attr_reader :status + attr_reader :replicating attr_reader :lag_seconds def initialize( id:, role:, status:, - lag_seconds: + replicating:, + lag_seconds: ) @id = id @role = role @status = status + @replicating = replicating @lag_seconds = lag_seconds end @@ -25,6 +28,7 @@ def self.from(map:) id: map["$id"], role: map["role"], status: map["status"], + replicating: map["replicating"], lag_seconds: map["lagSeconds"] ) end @@ -34,6 +38,7 @@ def to_map "$id": @id, "role": @role, "status": @status, + "replicating": @replicating, "lagSeconds": @lag_seconds } end diff --git a/lib/appwrite/models/dedicated_database_operation.rb b/lib/appwrite/models/dedicated_database_operation.rb index b5f9d8b..bd6b53c 100644 --- a/lib/appwrite/models/dedicated_database_operation.rb +++ b/lib/appwrite/models/dedicated_database_operation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,9 +22,9 @@ def initialize( type:, status:, attempts:, - requested_at: , - started_at: , - completed_at: , + requested_at:, + started_at:, + completed_at:, error_code:, error_message: ) diff --git a/lib/appwrite/models/dedicated_database_operation_list.rb b/lib/appwrite/models/dedicated_database_operation_list.rb index 8ed7a8c..d498573 100644 --- a/lib/appwrite/models/dedicated_database_operation_list.rb +++ b/lib/appwrite/models/dedicated_database_operation_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_pitr_windows.rb b/lib/appwrite/models/dedicated_database_pitr_windows.rb new file mode 100644 index 0000000..b80d115 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_pitr_windows.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabasePITRWindows + attr_reader :earliest + attr_reader :latest + + def initialize( + earliest:, + latest: + ) + @earliest = earliest + @latest = latest + end + + def self.from(map:) + DedicatedDatabasePITRWindows.new( + earliest: map["earliest"], + latest: map["latest"] + ) + end + + def to_map + { + "earliest": @earliest, + "latest": @latest + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_pooler.rb b/lib/appwrite/models/dedicated_database_pooler.rb new file mode 100644 index 0000000..a87c177 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_pooler.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabasePooler + attr_reader :enabled + attr_reader :mode + attr_reader :max_connections + attr_reader :default_pool_size + attr_reader :port + attr_reader :read_write_splitting + attr_reader :pooler_cpu_request + attr_reader :pooler_cpu_limit + attr_reader :pooler_memory_request + attr_reader :pooler_memory_limit + + def initialize( + enabled:, + mode:, + max_connections:, + default_pool_size:, + port:, + read_write_splitting:, + pooler_cpu_request:, + pooler_cpu_limit:, + pooler_memory_request:, + pooler_memory_limit: + ) + @enabled = enabled + @mode = mode + @max_connections = max_connections + @default_pool_size = default_pool_size + @port = port + @read_write_splitting = read_write_splitting + @pooler_cpu_request = pooler_cpu_request + @pooler_cpu_limit = pooler_cpu_limit + @pooler_memory_request = pooler_memory_request + @pooler_memory_limit = pooler_memory_limit + end + + def self.from(map:) + DedicatedDatabasePooler.new( + enabled: map["enabled"], + mode: map["mode"], + max_connections: map["maxConnections"], + default_pool_size: map["defaultPoolSize"], + port: map["port"], + read_write_splitting: map["readWriteSplitting"], + pooler_cpu_request: map["poolerCpuRequest"], + pooler_cpu_limit: map["poolerCpuLimit"], + pooler_memory_request: map["poolerMemoryRequest"], + pooler_memory_limit: map["poolerMemoryLimit"] + ) + end + + def to_map + { + "enabled": @enabled, + "mode": @mode, + "maxConnections": @max_connections, + "defaultPoolSize": @default_pool_size, + "port": @port, + "readWriteSplitting": @read_write_splitting, + "poolerCpuRequest": @pooler_cpu_request, + "poolerCpuLimit": @pooler_cpu_limit, + "poolerMemoryRequest": @pooler_memory_request, + "poolerMemoryLimit": @pooler_memory_limit + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_replicas.rb b/lib/appwrite/models/dedicated_database_replicas.rb index 7773340..7210677 100644 --- a/lib/appwrite/models/dedicated_database_replicas.rb +++ b/lib/appwrite/models/dedicated_database_replicas.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -15,11 +15,11 @@ class DedicatedDatabaseReplicas def initialize( replicas:, sync_mode:, - effective_sync_mode: , + effective_sync_mode:, sync_degraded:, sync_acknowledgements:, sync_standby_count:, - sync_state_confirmed: , + sync_state_confirmed:, members: ) @replicas = replicas diff --git a/lib/appwrite/models/dedicated_database_restoration.rb b/lib/appwrite/models/dedicated_database_restoration.rb new file mode 100644 index 0000000..be6e9f2 --- /dev/null +++ b/lib/appwrite/models/dedicated_database_restoration.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseRestoration + attr_reader :id + attr_reader :created_at + attr_reader :database_id + attr_reader :source_database_id + attr_reader :project_id + attr_reader :backup_id + attr_reader :type + attr_reader :status + attr_reader :target_time + attr_reader :started_at + attr_reader :completed_at + attr_reader :error + + def initialize( + id:, + created_at:, + database_id:, + source_database_id:, + project_id:, + backup_id:, + type:, + status:, + target_time:, + started_at:, + completed_at:, + error: + ) + @id = id + @created_at = created_at + @database_id = database_id + @source_database_id = source_database_id + @project_id = project_id + @backup_id = backup_id + @type = type + @status = status + @target_time = target_time + @started_at = started_at + @completed_at = completed_at + @error = error + end + + def self.from(map:) + DedicatedDatabaseRestoration.new( + id: map["$id"], + created_at: map["$createdAt"], + database_id: map["databaseId"], + source_database_id: map["sourceDatabaseId"], + project_id: map["projectId"], + backup_id: map["backupId"], + type: map["type"], + status: map["status"], + target_time: map["targetTime"], + started_at: map["startedAt"], + completed_at: map["completedAt"], + error: map["error"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "databaseId": @database_id, + "sourceDatabaseId": @source_database_id, + "projectId": @project_id, + "backupId": @backup_id, + "type": @type, + "status": @status, + "targetTime": @target_time, + "startedAt": @started_at, + "completedAt": @completed_at, + "error": @error + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_restoration_list.rb b/lib/appwrite/models/dedicated_database_restoration_list.rb new file mode 100644 index 0000000..dcb3f9e --- /dev/null +++ b/lib/appwrite/models/dedicated_database_restoration_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class DedicatedDatabaseRestorationList + attr_reader :total + attr_reader :restorations + + def initialize( + total:, + restorations: + ) + @total = total + @restorations = restorations + end + + def self.from(map:) + DedicatedDatabaseRestorationList.new( + total: map["total"], + restorations: map["restorations"].map { |it| DedicatedDatabaseRestoration.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "restorations": @restorations.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/dedicated_database_specification.rb b/lib/appwrite/models/dedicated_database_specification.rb index ceb5594..2448c2e 100644 --- a/lib/appwrite/models/dedicated_database_specification.rb +++ b/lib/appwrite/models/dedicated_database_specification.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_specification_list.rb b/lib/appwrite/models/dedicated_database_specification_list.rb index 7201593..206eec2 100644 --- a/lib/appwrite/models/dedicated_database_specification_list.rb +++ b/lib/appwrite/models/dedicated_database_specification_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dedicated_database_specification_pricing.rb b/lib/appwrite/models/dedicated_database_specification_pricing.rb index e9a679b..d6ef0ef 100644 --- a/lib/appwrite/models/dedicated_database_specification_pricing.rb +++ b/lib/appwrite/models/dedicated_database_specification_pricing.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/deployment.rb b/lib/appwrite/models/deployment.rb index 2dc1835..6fc3465 100644 --- a/lib/appwrite/models/deployment.rb +++ b/lib/appwrite/models/deployment.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -171,7 +171,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/deployment_list.rb b/lib/appwrite/models/deployment_list.rb index 971e485..f9a2d69 100644 --- a/lib/appwrite/models/deployment_list.rb +++ b/lib/appwrite/models/deployment_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/dev_key.rb b/lib/appwrite/models/dev_key.rb index cb3f60d..4389e82 100644 --- a/lib/appwrite/models/dev_key.rb +++ b/lib/appwrite/models/dev_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/document.rb b/lib/appwrite/models/document.rb index 5b7987a..0cc8a46 100644 --- a/lib/appwrite/models/document.rb +++ b/lib/appwrite/models/document.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/document_list.rb b/lib/appwrite/models/document_list.rb index b2ae468..254e19e 100644 --- a/lib/appwrite/models/document_list.rb +++ b/lib/appwrite/models/document_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/email_template.rb b/lib/appwrite/models/email_template.rb index 0e3d0a7..5cacd76 100644 --- a/lib/appwrite/models/email_template.rb +++ b/lib/appwrite/models/email_template.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/email_template_list.rb b/lib/appwrite/models/email_template_list.rb index a881b3e..fbc649f 100644 --- a/lib/appwrite/models/email_template_list.rb +++ b/lib/appwrite/models/email_template_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/embedding.rb b/lib/appwrite/models/embedding.rb index 991b6e5..177a94f 100644 --- a/lib/appwrite/models/embedding.rb +++ b/lib/appwrite/models/embedding.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/embedding_list.rb b/lib/appwrite/models/embedding_list.rb index 770ca0e..848b50d 100644 --- a/lib/appwrite/models/embedding_list.rb +++ b/lib/appwrite/models/embedding_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/ephemeral_key.rb b/lib/appwrite/models/ephemeral_key.rb index e974df0..14761c4 100644 --- a/lib/appwrite/models/ephemeral_key.rb +++ b/lib/appwrite/models/ephemeral_key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/execution.rb b/lib/appwrite/models/execution.rb index ef56563..55a701d 100644 --- a/lib/appwrite/models/execution.rb +++ b/lib/appwrite/models/execution.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -7,7 +7,8 @@ class Execution attr_reader :created_at attr_reader :updated_at attr_reader :permissions - attr_reader :function_id + attr_reader :resource_id + attr_reader :resource_type attr_reader :deployment_id attr_reader :trigger attr_reader :status @@ -27,7 +28,8 @@ def initialize( created_at:, updated_at:, permissions:, - function_id:, + resource_id:, + resource_type:, deployment_id:, trigger:, status:, @@ -40,13 +42,14 @@ def initialize( logs:, errors:, duration:, - scheduled_at: + scheduled_at: ) @id = id @created_at = created_at @updated_at = updated_at @permissions = permissions - @function_id = function_id + @resource_id = resource_id + @resource_type = validate_resource_type(resource_type) @deployment_id = deployment_id @trigger = validate_trigger(trigger) @status = validate_status(status) @@ -68,7 +71,8 @@ def self.from(map:) created_at: map["$createdAt"], updated_at: map["$updatedAt"], permissions: map["$permissions"], - function_id: map["functionId"], + resource_id: map["resourceId"], + resource_type: map["resourceType"], deployment_id: map["deploymentId"], trigger: map["trigger"], status: map["status"], @@ -91,7 +95,8 @@ def to_map "$createdAt": @created_at, "$updatedAt": @updated_at, "$permissions": @permissions, - "functionId": @function_id, + "resourceId": @resource_id, + "resourceType": @resource_type, "deploymentId": @deployment_id, "trigger": @trigger, "status": @status, @@ -110,6 +115,19 @@ def to_map private + def validate_resource_type(resource_type) + valid_resource_type = [ + Appwrite::Enums::ExecutionResourceType::FUNCTIONS, + Appwrite::Enums::ExecutionResourceType::SITES, + ] + + unless valid_resource_type.include?(resource_type) + raise ArgumentError, "Invalid " + resource_type + ". Must be one of: " + valid_resource_type.join(', ') + end + + resource_type + end + def validate_trigger(trigger) valid_trigger = [ Appwrite::Enums::ExecutionTrigger::HTTP, @@ -139,7 +157,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/execution_list.rb b/lib/appwrite/models/execution_list.rb index b14ff4e..531551d 100644 --- a/lib/appwrite/models/execution_list.rb +++ b/lib/appwrite/models/execution_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/file.rb b/lib/appwrite/models/file.rb index 525a88b..66ee936 100644 --- a/lib/appwrite/models/file.rb +++ b/lib/appwrite/models/file.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/file_list.rb b/lib/appwrite/models/file_list.rb index f859b0b..7a033d5 100644 --- a/lib/appwrite/models/file_list.rb +++ b/lib/appwrite/models/file_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework.rb b/lib/appwrite/models/framework.rb index a465400..98108bf 100644 --- a/lib/appwrite/models/framework.rb +++ b/lib/appwrite/models/framework.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework_adapter.rb b/lib/appwrite/models/framework_adapter.rb index e96509a..81d06e2 100644 --- a/lib/appwrite/models/framework_adapter.rb +++ b/lib/appwrite/models/framework_adapter.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/framework_list.rb b/lib/appwrite/models/framework_list.rb index 6fe936e..da86b56 100644 --- a/lib/appwrite/models/framework_list.rb +++ b/lib/appwrite/models/framework_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/function.rb b/lib/appwrite/models/function.rb index 09cb6d7..0e76555 100644 --- a/lib/appwrite/models/function.rb +++ b/lib/appwrite/models/function.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/function_list.rb b/lib/appwrite/models/function_list.rb index 0fbb1b9..8ac71cf 100644 --- a/lib/appwrite/models/function_list.rb +++ b/lib/appwrite/models/function_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/headers.rb b/lib/appwrite/models/headers.rb index 3604ab7..5c43bea 100644 --- a/lib/appwrite/models/headers.rb +++ b/lib/appwrite/models/headers.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/identity.rb b/lib/appwrite/models/identity.rb index 0f7fb5e..bd6e58c 100644 --- a/lib/appwrite/models/identity.rb +++ b/lib/appwrite/models/identity.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/identity_list.rb b/lib/appwrite/models/identity_list.rb index c8a3851..bef444b 100644 --- a/lib/appwrite/models/identity_list.rb +++ b/lib/appwrite/models/identity_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/index.rb b/lib/appwrite/models/index.rb index 6fccd4b..20b6e62 100644 --- a/lib/appwrite/models/index.rb +++ b/lib/appwrite/models/index.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( error:, attributes:, lengths:, - orders: + orders: ) @id = id @created_at = created_at @@ -85,7 +85,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/index_list.rb b/lib/appwrite/models/index_list.rb index 140bf16..a0795d1 100644 --- a/lib/appwrite/models/index_list.rb +++ b/lib/appwrite/models/index_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/insight.rb b/lib/appwrite/models/insight.rb index b5131c8..a10df16 100644 --- a/lib/appwrite/models/insight.rb +++ b/lib/appwrite/models/insight.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -36,9 +36,9 @@ def initialize( title:, summary:, ctas:, - analyzed_at: , - dismissed_at: , - dismissed_by: + analyzed_at:, + dismissed_at:, + dismissed_by: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/insight_cta.rb b/lib/appwrite/models/insight_cta.rb index 82d61bf..36670cb 100644 --- a/lib/appwrite/models/insight_cta.rb +++ b/lib/appwrite/models/insight_cta.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/insight_list.rb b/lib/appwrite/models/insight_list.rb index 541023a..af19aa8 100644 --- a/lib/appwrite/models/insight_list.rb +++ b/lib/appwrite/models/insight_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/jwt.rb b/lib/appwrite/models/jwt.rb index efd5daf..73d8c92 100644 --- a/lib/appwrite/models/jwt.rb +++ b/lib/appwrite/models/jwt.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/key.rb b/lib/appwrite/models/key.rb index aaeac7a..4df47cf 100644 --- a/lib/appwrite/models/key.rb +++ b/lib/appwrite/models/key.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/key_list.rb b/lib/appwrite/models/key_list.rb index d49db9b..d7a9649 100644 --- a/lib/appwrite/models/key_list.rb +++ b/lib/appwrite/models/key_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/language.rb b/lib/appwrite/models/language.rb index d31449b..8850a69 100644 --- a/lib/appwrite/models/language.rb +++ b/lib/appwrite/models/language.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/language_list.rb b/lib/appwrite/models/language_list.rb index 231d727..118fc41 100644 --- a/lib/appwrite/models/language_list.rb +++ b/lib/appwrite/models/language_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/locale.rb b/lib/appwrite/models/locale.rb index 7480e2b..a31aea6 100644 --- a/lib/appwrite/models/locale.rb +++ b/lib/appwrite/models/locale.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -30,17 +30,17 @@ def initialize( continent:, eu:, currency:, - city: , - time_zone: , - postal_code: , - latitude: , - longitude: , - autonomous_system_number: , - autonomous_system_organization: , - isp: , - connection_type: , - connection_usage_type: , - connection_organization: + city:, + time_zone:, + postal_code:, + latitude:, + longitude:, + autonomous_system_number:, + autonomous_system_organization:, + isp:, + connection_type:, + connection_usage_type:, + connection_organization: ) @ip = ip @country_code = country_code diff --git a/lib/appwrite/models/locale_code.rb b/lib/appwrite/models/locale_code.rb index 247c758..6089272 100644 --- a/lib/appwrite/models/locale_code.rb +++ b/lib/appwrite/models/locale_code.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/locale_code_list.rb b/lib/appwrite/models/locale_code_list.rb index 56fb762..b93213c 100644 --- a/lib/appwrite/models/locale_code_list.rb +++ b/lib/appwrite/models/locale_code_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/log.rb b/lib/appwrite/models/log.rb index c4653ac..89e1a67 100644 --- a/lib/appwrite/models/log.rb +++ b/lib/appwrite/models/log.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/log_list.rb b/lib/appwrite/models/log_list.rb index f1b32c6..cdad965 100644 --- a/lib/appwrite/models/log_list.rb +++ b/lib/appwrite/models/log_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/membership.rb b/lib/appwrite/models/membership.rb index 4880a9c..84b3ce1 100644 --- a/lib/appwrite/models/membership.rb +++ b/lib/appwrite/models/membership.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/membership_list.rb b/lib/appwrite/models/membership_list.rb index 87a0cb5..0cc220c 100644 --- a/lib/appwrite/models/membership_list.rb +++ b/lib/appwrite/models/membership_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/message.rb b/lib/appwrite/models/message.rb index 25e366b..456afe3 100644 --- a/lib/appwrite/models/message.rb +++ b/lib/appwrite/models/message.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -25,9 +25,9 @@ def initialize( topics:, users:, targets:, - scheduled_at: , - delivered_at: , - delivery_errors: , + scheduled_at:, + delivered_at:, + delivery_errors:, delivered_total:, data:, status: @@ -100,7 +100,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/message_list.rb b/lib/appwrite/models/message_list.rb index d96ae8c..5017544 100644 --- a/lib/appwrite/models/message_list.rb +++ b/lib/appwrite/models/message_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_challenge.rb b/lib/appwrite/models/mfa_challenge.rb index 8ae49c8..6ba21fe 100644 --- a/lib/appwrite/models/mfa_challenge.rb +++ b/lib/appwrite/models/mfa_challenge.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_challenge_secret.rb b/lib/appwrite/models/mfa_challenge_secret.rb index e17abe4..ad8abbc 100644 --- a/lib/appwrite/models/mfa_challenge_secret.rb +++ b/lib/appwrite/models/mfa_challenge_secret.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_factors.rb b/lib/appwrite/models/mfa_factors.rb index ed0d6e1..55b58ca 100644 --- a/lib/appwrite/models/mfa_factors.rb +++ b/lib/appwrite/models/mfa_factors.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_recovery_codes.rb b/lib/appwrite/models/mfa_recovery_codes.rb index 9d9b897..1fd53c1 100644 --- a/lib/appwrite/models/mfa_recovery_codes.rb +++ b/lib/appwrite/models/mfa_recovery_codes.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mfa_type.rb b/lib/appwrite/models/mfa_type.rb index 76b7ec8..0612dc2 100644 --- a/lib/appwrite/models/mfa_type.rb +++ b/lib/appwrite/models/mfa_type.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mock_number.rb b/lib/appwrite/models/mock_number.rb index 8ef41d4..59d96f2 100644 --- a/lib/appwrite/models/mock_number.rb +++ b/lib/appwrite/models/mock_number.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/mock_number_list.rb b/lib/appwrite/models/mock_number_list.rb index 6971dcf..56a7fdd 100644 --- a/lib/appwrite/models/mock_number_list.rb +++ b/lib/appwrite/models/mock_number_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_amazon.rb b/lib/appwrite/models/o_auth2_amazon.rb index 23a99cd..177ce12 100644 --- a/lib/appwrite/models/o_auth2_amazon.rb +++ b/lib/appwrite/models/o_auth2_amazon.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_apple.rb b/lib/appwrite/models/o_auth2_apple.rb index 94d0715..bc7d9cb 100644 --- a/lib/appwrite/models/o_auth2_apple.rb +++ b/lib/appwrite/models/o_auth2_apple.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_appwrite.rb b/lib/appwrite/models/o_auth2_appwrite.rb index f9ca477..c12a6b5 100644 --- a/lib/appwrite/models/o_auth2_appwrite.rb +++ b/lib/appwrite/models/o_auth2_appwrite.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_auth0.rb b/lib/appwrite/models/o_auth2_auth0.rb index 9771a9b..aa26143 100644 --- a/lib/appwrite/models/o_auth2_auth0.rb +++ b/lib/appwrite/models/o_auth2_auth0.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_authentik.rb b/lib/appwrite/models/o_auth2_authentik.rb index 67d497e..81fc7ff 100644 --- a/lib/appwrite/models/o_auth2_authentik.rb +++ b/lib/appwrite/models/o_auth2_authentik.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_autodesk.rb b/lib/appwrite/models/o_auth2_autodesk.rb index a91f74f..f260b12 100644 --- a/lib/appwrite/models/o_auth2_autodesk.rb +++ b/lib/appwrite/models/o_auth2_autodesk.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_bitbucket.rb b/lib/appwrite/models/o_auth2_bitbucket.rb index d5dd4a2..4450950 100644 --- a/lib/appwrite/models/o_auth2_bitbucket.rb +++ b/lib/appwrite/models/o_auth2_bitbucket.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_bitly.rb b/lib/appwrite/models/o_auth2_bitly.rb index 9a49b91..ad116ed 100644 --- a/lib/appwrite/models/o_auth2_bitly.rb +++ b/lib/appwrite/models/o_auth2_bitly.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_box.rb b/lib/appwrite/models/o_auth2_box.rb index 7334f39..7cdfedd 100644 --- a/lib/appwrite/models/o_auth2_box.rb +++ b/lib/appwrite/models/o_auth2_box.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_dailymotion.rb b/lib/appwrite/models/o_auth2_dailymotion.rb index 97c2d13..31e10ed 100644 --- a/lib/appwrite/models/o_auth2_dailymotion.rb +++ b/lib/appwrite/models/o_auth2_dailymotion.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_discord.rb b/lib/appwrite/models/o_auth2_discord.rb index 9e87ca1..b24b44c 100644 --- a/lib/appwrite/models/o_auth2_discord.rb +++ b/lib/appwrite/models/o_auth2_discord.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_disqus.rb b/lib/appwrite/models/o_auth2_disqus.rb index eab489b..2b8e426 100644 --- a/lib/appwrite/models/o_auth2_disqus.rb +++ b/lib/appwrite/models/o_auth2_disqus.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_dropbox.rb b/lib/appwrite/models/o_auth2_dropbox.rb index 1a4df15..d558131 100644 --- a/lib/appwrite/models/o_auth2_dropbox.rb +++ b/lib/appwrite/models/o_auth2_dropbox.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_etsy.rb b/lib/appwrite/models/o_auth2_etsy.rb index 340209c..87acab7 100644 --- a/lib/appwrite/models/o_auth2_etsy.rb +++ b/lib/appwrite/models/o_auth2_etsy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_facebook.rb b/lib/appwrite/models/o_auth2_facebook.rb index e734110..f42ab1e 100644 --- a/lib/appwrite/models/o_auth2_facebook.rb +++ b/lib/appwrite/models/o_auth2_facebook.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_figma.rb b/lib/appwrite/models/o_auth2_figma.rb index 15b6ea4..7da8c79 100644 --- a/lib/appwrite/models/o_auth2_figma.rb +++ b/lib/appwrite/models/o_auth2_figma.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_fusion_auth.rb b/lib/appwrite/models/o_auth2_fusion_auth.rb index 6cd6951..74e205e 100644 --- a/lib/appwrite/models/o_auth2_fusion_auth.rb +++ b/lib/appwrite/models/o_auth2_fusion_auth.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_github.rb b/lib/appwrite/models/o_auth2_github.rb index afc1190..9f72146 100644 --- a/lib/appwrite/models/o_auth2_github.rb +++ b/lib/appwrite/models/o_auth2_github.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_gitlab.rb b/lib/appwrite/models/o_auth2_gitlab.rb index 9786ddd..2f1d223 100644 --- a/lib/appwrite/models/o_auth2_gitlab.rb +++ b/lib/appwrite/models/o_auth2_gitlab.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_google.rb b/lib/appwrite/models/o_auth2_google.rb index 5f6df20..e220ee6 100644 --- a/lib/appwrite/models/o_auth2_google.rb +++ b/lib/appwrite/models/o_auth2_google.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -20,7 +20,7 @@ def initialize( @enabled = enabled @client_id = client_id @client_secret = client_secret - @prompt = prompt + @prompt = validate_prompt(prompt) end def self.from(map:) @@ -42,6 +42,22 @@ def to_map "prompt": @prompt } end + + private + + def validate_prompt(prompt) + valid_prompt = [ + Appwrite::Enums::OAuth2GooglePrompt::NONE, + Appwrite::Enums::OAuth2GooglePrompt::CONSENT, + Appwrite::Enums::OAuth2GooglePrompt::SELECT_ACCOUNT, + ] + + unless valid_prompt.include?(prompt) + raise ArgumentError, "Invalid " + prompt + ". Must be one of: " + valid_prompt.join(', ') + end + + prompt + end end end end diff --git a/lib/appwrite/models/o_auth2_hugging_face.rb b/lib/appwrite/models/o_auth2_hugging_face.rb new file mode 100644 index 0000000..c75e13c --- /dev/null +++ b/lib/appwrite/models/o_auth2_hugging_face.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class OAuth2HuggingFace + attr_reader :id + attr_reader :enabled + attr_reader :client_id + attr_reader :client_secret + + def initialize( + id:, + enabled:, + client_id:, + client_secret: + ) + @id = id + @enabled = enabled + @client_id = client_id + @client_secret = client_secret + end + + def self.from(map:) + OAuth2HuggingFace.new( + id: map["$id"], + enabled: map["enabled"], + client_id: map["clientId"], + client_secret: map["clientSecret"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled, + "clientId": @client_id, + "clientSecret": @client_secret + } + end + end + end +end diff --git a/lib/appwrite/models/o_auth2_keycloak.rb b/lib/appwrite/models/o_auth2_keycloak.rb index a6ab0bf..6af51b9 100644 --- a/lib/appwrite/models/o_auth2_keycloak.rb +++ b/lib/appwrite/models/o_auth2_keycloak.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_kick.rb b/lib/appwrite/models/o_auth2_kick.rb index 59d3e2a..eb5c809 100644 --- a/lib/appwrite/models/o_auth2_kick.rb +++ b/lib/appwrite/models/o_auth2_kick.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_linkedin.rb b/lib/appwrite/models/o_auth2_linkedin.rb index b807439..8b91b06 100644 --- a/lib/appwrite/models/o_auth2_linkedin.rb +++ b/lib/appwrite/models/o_auth2_linkedin.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_microsoft.rb b/lib/appwrite/models/o_auth2_microsoft.rb index 563e62d..0173d39 100644 --- a/lib/appwrite/models/o_auth2_microsoft.rb +++ b/lib/appwrite/models/o_auth2_microsoft.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_notion.rb b/lib/appwrite/models/o_auth2_notion.rb index 4b0c001..3382c41 100644 --- a/lib/appwrite/models/o_auth2_notion.rb +++ b/lib/appwrite/models/o_auth2_notion.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_oidc.rb b/lib/appwrite/models/o_auth2_oidc.rb index 105d148..a4ea66f 100644 --- a/lib/appwrite/models/o_auth2_oidc.rb +++ b/lib/appwrite/models/o_auth2_oidc.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -24,7 +24,7 @@ def initialize( token_url:, user_info_url:, prompt:, - max_age: + max_age: ) @id = id @enabled = enabled @@ -34,7 +34,7 @@ def initialize( @authorization_url = authorization_url @token_url = token_url @user_info_url = user_info_url - @prompt = prompt + @prompt = validate_prompt(prompt) @max_age = max_age end @@ -67,6 +67,23 @@ def to_map "maxAge": @max_age } end + + private + + def validate_prompt(prompt) + valid_prompt = [ + Appwrite::Enums::OAuth2OidcPrompt::NONE, + Appwrite::Enums::OAuth2OidcPrompt::LOGIN, + Appwrite::Enums::OAuth2OidcPrompt::CONSENT, + Appwrite::Enums::OAuth2OidcPrompt::SELECT_ACCOUNT, + ] + + unless valid_prompt.include?(prompt) + raise ArgumentError, "Invalid " + prompt + ". Must be one of: " + valid_prompt.join(', ') + end + + prompt + end end end end diff --git a/lib/appwrite/models/o_auth2_okta.rb b/lib/appwrite/models/o_auth2_okta.rb index df3c6b6..61ef16e 100644 --- a/lib/appwrite/models/o_auth2_okta.rb +++ b/lib/appwrite/models/o_auth2_okta.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_paypal.rb b/lib/appwrite/models/o_auth2_paypal.rb index fd1bbcd..32263b4 100644 --- a/lib/appwrite/models/o_auth2_paypal.rb +++ b/lib/appwrite/models/o_auth2_paypal.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_podio.rb b/lib/appwrite/models/o_auth2_podio.rb index 9e02118..d1efea8 100644 --- a/lib/appwrite/models/o_auth2_podio.rb +++ b/lib/appwrite/models/o_auth2_podio.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_provider_list.rb b/lib/appwrite/models/o_auth2_provider_list.rb index 9dce4cc..16bdbba 100644 --- a/lib/appwrite/models/o_auth2_provider_list.rb +++ b/lib/appwrite/models/o_auth2_provider_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_salesforce.rb b/lib/appwrite/models/o_auth2_salesforce.rb index db8956f..22cdf2b 100644 --- a/lib/appwrite/models/o_auth2_salesforce.rb +++ b/lib/appwrite/models/o_auth2_salesforce.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_slack.rb b/lib/appwrite/models/o_auth2_slack.rb index a65252d..209cc3b 100644 --- a/lib/appwrite/models/o_auth2_slack.rb +++ b/lib/appwrite/models/o_auth2_slack.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_spotify.rb b/lib/appwrite/models/o_auth2_spotify.rb index 63f402c..014d82d 100644 --- a/lib/appwrite/models/o_auth2_spotify.rb +++ b/lib/appwrite/models/o_auth2_spotify.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_stripe.rb b/lib/appwrite/models/o_auth2_stripe.rb index 0caceb2..6660440 100644 --- a/lib/appwrite/models/o_auth2_stripe.rb +++ b/lib/appwrite/models/o_auth2_stripe.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_tradeshift.rb b/lib/appwrite/models/o_auth2_tradeshift.rb index 7ae5202..749c666 100644 --- a/lib/appwrite/models/o_auth2_tradeshift.rb +++ b/lib/appwrite/models/o_auth2_tradeshift.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_twitch.rb b/lib/appwrite/models/o_auth2_twitch.rb index 9801c8e..ac7fa8a 100644 --- a/lib/appwrite/models/o_auth2_twitch.rb +++ b/lib/appwrite/models/o_auth2_twitch.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_word_press.rb b/lib/appwrite/models/o_auth2_word_press.rb index 689f4cc..3fab755 100644 --- a/lib/appwrite/models/o_auth2_word_press.rb +++ b/lib/appwrite/models/o_auth2_word_press.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_x.rb b/lib/appwrite/models/o_auth2_x.rb index 0819e3a..d2f771a 100644 --- a/lib/appwrite/models/o_auth2_x.rb +++ b/lib/appwrite/models/o_auth2_x.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_yahoo.rb b/lib/appwrite/models/o_auth2_yahoo.rb index afe6f7f..13aea49 100644 --- a/lib/appwrite/models/o_auth2_yahoo.rb +++ b/lib/appwrite/models/o_auth2_yahoo.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_yandex.rb b/lib/appwrite/models/o_auth2_yandex.rb index 2f8438e..8373037 100644 --- a/lib/appwrite/models/o_auth2_yandex.rb +++ b/lib/appwrite/models/o_auth2_yandex.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_zoho.rb b/lib/appwrite/models/o_auth2_zoho.rb index 629879a..6b40cab 100644 --- a/lib/appwrite/models/o_auth2_zoho.rb +++ b/lib/appwrite/models/o_auth2_zoho.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/o_auth2_zoom.rb b/lib/appwrite/models/o_auth2_zoom.rb index 74f8f26..d7b261c 100644 --- a/lib/appwrite/models/o_auth2_zoom.rb +++ b/lib/appwrite/models/o_auth2_zoom.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_approve.rb b/lib/appwrite/models/oauth2_approve.rb index a153919..748c788 100644 --- a/lib/appwrite/models/oauth2_approve.rb +++ b/lib/appwrite/models/oauth2_approve.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_authorize.rb b/lib/appwrite/models/oauth2_authorize.rb index 82a0c3c..99f35e8 100644 --- a/lib/appwrite/models/oauth2_authorize.rb +++ b/lib/appwrite/models/oauth2_authorize.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent.rb b/lib/appwrite/models/oauth2_consent.rb index 7387ddd..af8f3ec 100644 --- a/lib/appwrite/models/oauth2_consent.rb +++ b/lib/appwrite/models/oauth2_consent.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_list.rb b/lib/appwrite/models/oauth2_consent_list.rb index 6d48dd8..a6ca3ce 100644 --- a/lib/appwrite/models/oauth2_consent_list.rb +++ b/lib/appwrite/models/oauth2_consent_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_token.rb b/lib/appwrite/models/oauth2_consent_token.rb index b98a942..6b1bc02 100644 --- a/lib/appwrite/models/oauth2_consent_token.rb +++ b/lib/appwrite/models/oauth2_consent_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_consent_token_list.rb b/lib/appwrite/models/oauth2_consent_token_list.rb index a06536e..edf5aef 100644 --- a/lib/appwrite/models/oauth2_consent_token_list.rb +++ b/lib/appwrite/models/oauth2_consent_token_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_device_authorization.rb b/lib/appwrite/models/oauth2_device_authorization.rb index c50e371..428970a 100644 --- a/lib/appwrite/models/oauth2_device_authorization.rb +++ b/lib/appwrite/models/oauth2_device_authorization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_grant.rb b/lib/appwrite/models/oauth2_grant.rb index 8e87f96..df5192b 100644 --- a/lib/appwrite/models/oauth2_grant.rb +++ b/lib/appwrite/models/oauth2_grant.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_organization.rb b/lib/appwrite/models/oauth2_organization.rb index c54bc38..b69fd0c 100644 --- a/lib/appwrite/models/oauth2_organization.rb +++ b/lib/appwrite/models/oauth2_organization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_organization_list.rb b/lib/appwrite/models/oauth2_organization_list.rb index dd9691b..7921605 100644 --- a/lib/appwrite/models/oauth2_organization_list.rb +++ b/lib/appwrite/models/oauth2_organization_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_par.rb b/lib/appwrite/models/oauth2_par.rb index c42f872..18198dc 100644 --- a/lib/appwrite/models/oauth2_par.rb +++ b/lib/appwrite/models/oauth2_par.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_project.rb b/lib/appwrite/models/oauth2_project.rb index a3fdf58..01b2531 100644 --- a/lib/appwrite/models/oauth2_project.rb +++ b/lib/appwrite/models/oauth2_project.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_project_list.rb b/lib/appwrite/models/oauth2_project_list.rb index 5063b9b..a98a676 100644 --- a/lib/appwrite/models/oauth2_project_list.rb +++ b/lib/appwrite/models/oauth2_project_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_reject.rb b/lib/appwrite/models/oauth2_reject.rb index 62f80c4..614546e 100644 --- a/lib/appwrite/models/oauth2_reject.rb +++ b/lib/appwrite/models/oauth2_reject.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/oauth2_token.rb b/lib/appwrite/models/oauth2_token.rb index db7630c..59ffd23 100644 --- a/lib/appwrite/models/oauth2_token.rb +++ b/lib/appwrite/models/oauth2_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -17,8 +17,8 @@ def initialize( expires_in:, refresh_token:, scope:, - authorization_details: , - id_token: + authorization_details:, + id_token: ) @access_token = access_token @token_type = token_type diff --git a/lib/appwrite/models/organization.rb b/lib/appwrite/models/organization.rb index d3aa9fe..aa53b68 100644 --- a/lib/appwrite/models/organization.rb +++ b/lib/appwrite/models/organization.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -46,7 +46,7 @@ def initialize( name:, total:, prefs:, - billing_budget: , + billing_budget:, budget_alerts:, billing_plan:, billing_plan_id:, @@ -55,23 +55,23 @@ def initialize( billing_start_date:, billing_current_invoice_date:, billing_next_invoice_date:, - billing_trial_start_date: , + billing_trial_start_date:, billing_trial_days:, billing_aggregation_id:, billing_invoice_id:, payment_method_id:, - billing_address_id: , - backup_payment_method_id: , + billing_address_id:, + backup_payment_method_id:, status:, - remarks: , - agreement_baa: , - program_manager_name: , - program_manager_calendar: , - program_discord_channel_name: , - program_discord_channel_url: , - billing_limits: , - billing_plan_downgrade: , - billing_tax_id: , + remarks:, + agreement_baa:, + program_manager_name:, + program_manager_calendar:, + program_discord_channel_name:, + program_discord_channel_url:, + billing_limits:, + billing_plan_downgrade:, + billing_tax_id:, marked_for_deletion:, platform:, projects: diff --git a/lib/appwrite/models/phone.rb b/lib/appwrite/models/phone.rb index 176532e..769ea1b 100644 --- a/lib/appwrite/models/phone.rb +++ b/lib/appwrite/models/phone.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/phone_list.rb b/lib/appwrite/models/phone_list.rb index 6bc2089..d6ad3e1 100644 --- a/lib/appwrite/models/phone_list.rb +++ b/lib/appwrite/models/phone_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/platform_android.rb b/lib/appwrite/models/platform_android.rb index 042bf0b..64b05d7 100644 --- a/lib/appwrite/models/platform_android.rb +++ b/lib/appwrite/models/platform_android.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_apple.rb b/lib/appwrite/models/platform_apple.rb index 61174db..06f7aee 100644 --- a/lib/appwrite/models/platform_apple.rb +++ b/lib/appwrite/models/platform_apple.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_linux.rb b/lib/appwrite/models/platform_linux.rb index 53e2e90..1442fd5 100644 --- a/lib/appwrite/models/platform_linux.rb +++ b/lib/appwrite/models/platform_linux.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_list.rb b/lib/appwrite/models/platform_list.rb index d374d18..a51bb20 100644 --- a/lib/appwrite/models/platform_list.rb +++ b/lib/appwrite/models/platform_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/platform_web.rb b/lib/appwrite/models/platform_web.rb index 2431d06..8e84519 100644 --- a/lib/appwrite/models/platform_web.rb +++ b/lib/appwrite/models/platform_web.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/platform_windows.rb b/lib/appwrite/models/platform_windows.rb index 08dcec1..560f44d 100644 --- a/lib/appwrite/models/platform_windows.rb +++ b/lib/appwrite/models/platform_windows.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -65,7 +65,6 @@ def validate_type(type) type end - end end end diff --git a/lib/appwrite/models/policy_deny_aliased_email.rb b/lib/appwrite/models/policy_deny_aliased_email.rb index 9d3ef5a..f7b755a 100644 --- a/lib/appwrite/models/policy_deny_aliased_email.rb +++ b/lib/appwrite/models/policy_deny_aliased_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_corporate_email.rb b/lib/appwrite/models/policy_deny_corporate_email.rb index d57f0c2..4bdf38a 100644 --- a/lib/appwrite/models/policy_deny_corporate_email.rb +++ b/lib/appwrite/models/policy_deny_corporate_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_disposable_email.rb b/lib/appwrite/models/policy_deny_disposable_email.rb index 14d5d5e..23393be 100644 --- a/lib/appwrite/models/policy_deny_disposable_email.rb +++ b/lib/appwrite/models/policy_deny_disposable_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_deny_free_email.rb b/lib/appwrite/models/policy_deny_free_email.rb index 54d5681..766573b 100644 --- a/lib/appwrite/models/policy_deny_free_email.rb +++ b/lib/appwrite/models/policy_deny_free_email.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_list.rb b/lib/appwrite/models/policy_list.rb index afcebe5..077c62f 100644 --- a/lib/appwrite/models/policy_list.rb +++ b/lib/appwrite/models/policy_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_membership_privacy.rb b/lib/appwrite/models/policy_membership_privacy.rb index 9635ac3..9fa040f 100644 --- a/lib/appwrite/models/policy_membership_privacy.rb +++ b/lib/appwrite/models/policy_membership_privacy.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_mfa_factors.rb b/lib/appwrite/models/policy_mfa_factors.rb index 158c12f..e49890a 100644 --- a/lib/appwrite/models/policy_mfa_factors.rb +++ b/lib/appwrite/models/policy_mfa_factors.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_dictionary.rb b/lib/appwrite/models/policy_password_dictionary.rb index a668c5a..38423bc 100644 --- a/lib/appwrite/models/policy_password_dictionary.rb +++ b/lib/appwrite/models/policy_password_dictionary.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_history.rb b/lib/appwrite/models/policy_password_history.rb index 1eca50a..e2d4b84 100644 --- a/lib/appwrite/models/policy_password_history.rb +++ b/lib/appwrite/models/policy_password_history.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_personal_data.rb b/lib/appwrite/models/policy_password_personal_data.rb index cd05e9d..7e2c290 100644 --- a/lib/appwrite/models/policy_password_personal_data.rb +++ b/lib/appwrite/models/policy_password_personal_data.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_password_strength.rb b/lib/appwrite/models/policy_password_strength.rb index 0f712e4..c2bf28f 100644 --- a/lib/appwrite/models/policy_password_strength.rb +++ b/lib/appwrite/models/policy_password_strength.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_alert.rb b/lib/appwrite/models/policy_session_alert.rb index b97135f..74ee3fa 100644 --- a/lib/appwrite/models/policy_session_alert.rb +++ b/lib/appwrite/models/policy_session_alert.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_duration.rb b/lib/appwrite/models/policy_session_duration.rb index a20b886..f23f26e 100644 --- a/lib/appwrite/models/policy_session_duration.rb +++ b/lib/appwrite/models/policy_session_duration.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_invalidation.rb b/lib/appwrite/models/policy_session_invalidation.rb index a2c1831..4c7b0a2 100644 --- a/lib/appwrite/models/policy_session_invalidation.rb +++ b/lib/appwrite/models/policy_session_invalidation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_session_limit.rb b/lib/appwrite/models/policy_session_limit.rb index 8c06cde..2c3783d 100644 --- a/lib/appwrite/models/policy_session_limit.rb +++ b/lib/appwrite/models/policy_session_limit.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/policy_user_limit.rb b/lib/appwrite/models/policy_user_limit.rb index 976fc68..b5554c1 100644 --- a/lib/appwrite/models/policy_user_limit.rb +++ b/lib/appwrite/models/policy_user_limit.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/postgres_extension.rb b/lib/appwrite/models/postgres_extension.rb new file mode 100644 index 0000000..6ae0933 --- /dev/null +++ b/lib/appwrite/models/postgres_extension.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class PostgresExtension + attr_reader :key + attr_reader :name + attr_reader :description + attr_reader :category + + def initialize( + key:, + name:, + description:, + category: + ) + @key = key + @name = name + @description = description + @category = category + end + + def self.from(map:) + PostgresExtension.new( + key: map["key"], + name: map["name"], + description: map["description"], + category: map["category"] + ) + end + + def to_map + { + "key": @key, + "name": @name, + "description": @description, + "category": @category + } + end + end + end +end diff --git a/lib/appwrite/models/preferences.rb b/lib/appwrite/models/preferences.rb index a455127..838aee6 100644 --- a/lib/appwrite/models/preferences.rb +++ b/lib/appwrite/models/preferences.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/presence.rb b/lib/appwrite/models/presence.rb index 237cd16..dabfb83 100644 --- a/lib/appwrite/models/presence.rb +++ b/lib/appwrite/models/presence.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,10 +19,10 @@ def initialize( updated_at:, permissions:, user_id:, - status: , + status:, source:, - expires_at: , - metadata: + expires_at:, + metadata: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/presence_list.rb b/lib/appwrite/models/presence_list.rb index c504271..01fa5bc 100644 --- a/lib/appwrite/models/presence_list.rb +++ b/lib/appwrite/models/presence_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/program.rb b/lib/appwrite/models/program.rb index 4a2f103..db9215e 100644 --- a/lib/appwrite/models/program.rb +++ b/lib/appwrite/models/program.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index bf6fc02..3e50881 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -79,24 +79,24 @@ def initialize( blocks:, console_accessed_at:, waf_enabled:, - billing_limits: , - o_auth2_server_enabled: , - o_auth2_server_authorization_url: , - o_auth2_server_scopes: , - o_auth2_server_default_scopes: , - o_auth2_server_installation_scopes: , - o_auth2_server_authorization_details_types: , - o_auth2_server_access_token_duration: , - o_auth2_server_refresh_token_duration: , - o_auth2_server_public_access_token_duration: , - o_auth2_server_public_refresh_token_duration: , - o_auth2_server_installation_access_token_duration: , - o_auth2_server_confidential_pkce: , - o_auth2_server_verification_url: , - o_auth2_server_user_code_length: , - o_auth2_server_user_code_format: , - o_auth2_server_device_code_duration: , - o_auth2_server_discovery_url: + billing_limits:, + o_auth2_server_enabled:, + o_auth2_server_authorization_url:, + o_auth2_server_scopes:, + o_auth2_server_default_scopes:, + o_auth2_server_installation_scopes:, + o_auth2_server_authorization_details_types:, + o_auth2_server_access_token_duration:, + o_auth2_server_refresh_token_duration:, + o_auth2_server_public_access_token_duration:, + o_auth2_server_public_refresh_token_duration:, + o_auth2_server_installation_access_token_duration:, + o_auth2_server_confidential_pkce:, + o_auth2_server_verification_url:, + o_auth2_server_user_code_length:, + o_auth2_server_user_code_format:, + o_auth2_server_device_code_duration:, + o_auth2_server_discovery_url: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/project_auth_method.rb b/lib/appwrite/models/project_auth_method.rb index 17cfbbc..8aa6481 100644 --- a/lib/appwrite/models/project_auth_method.rb +++ b/lib/appwrite/models/project_auth_method.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -47,7 +47,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/project_list.rb b/lib/appwrite/models/project_list.rb index b8e0693..552309a 100644 --- a/lib/appwrite/models/project_list.rb +++ b/lib/appwrite/models/project_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/project_protocol.rb b/lib/appwrite/models/project_protocol.rb index 2c8f0b8..5844821 100644 --- a/lib/appwrite/models/project_protocol.rb +++ b/lib/appwrite/models/project_protocol.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -43,7 +43,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/project_service.rb b/lib/appwrite/models/project_service.rb index b533675..6f42684 100644 --- a/lib/appwrite/models/project_service.rb +++ b/lib/appwrite/models/project_service.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -58,7 +58,6 @@ def validate_id(id) id end - end end end diff --git a/lib/appwrite/models/provider.rb b/lib/appwrite/models/provider.rb index f76f1d6..80d6c95 100644 --- a/lib/appwrite/models/provider.rb +++ b/lib/appwrite/models/provider.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -22,7 +22,7 @@ def initialize( enabled:, type:, credentials:, - options: + options: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/provider_list.rb b/lib/appwrite/models/provider_list.rb index 40e411b..32f7da9 100644 --- a/lib/appwrite/models/provider_list.rb +++ b/lib/appwrite/models/provider_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/proxy_invalidation.rb b/lib/appwrite/models/proxy_invalidation.rb index d87b4b1..584669a 100644 --- a/lib/appwrite/models/proxy_invalidation.rb +++ b/lib/appwrite/models/proxy_invalidation.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/proxy_rule.rb b/lib/appwrite/models/proxy_rule.rb index 70990c4..adb1cd5 100644 --- a/lib/appwrite/models/proxy_rule.rb +++ b/lib/appwrite/models/proxy_rule.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -29,7 +29,7 @@ def initialize( redirect_url:, redirect_status_code:, deployment_id:, - deployment_resource_type: , + deployment_resource_type:, deployment_resource_id:, deployment_vcs_provider_branch:, status:, @@ -121,7 +121,6 @@ def validate_status(status) status end - end end end diff --git a/lib/appwrite/models/proxy_rule_list.rb b/lib/appwrite/models/proxy_rule_list.rb index a167e51..24f9923 100644 --- a/lib/appwrite/models/proxy_rule_list.rb +++ b/lib/appwrite/models/proxy_rule_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/report.rb b/lib/appwrite/models/report.rb index 3459791..b391231 100644 --- a/lib/appwrite/models/report.rb +++ b/lib/appwrite/models/report.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -28,7 +28,7 @@ def initialize( target:, categories:, insights:, - analyzed_at: + analyzed_at: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/report_list.rb b/lib/appwrite/models/report_list.rb index a8eb1f5..8cdd69a 100644 --- a/lib/appwrite/models/report_list.rb +++ b/lib/appwrite/models/report_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/resource_token.rb b/lib/appwrite/models/resource_token.rb index 1d01e10..61c2b49 100644 --- a/lib/appwrite/models/resource_token.rb +++ b/lib/appwrite/models/resource_token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/resource_token_list.rb b/lib/appwrite/models/resource_token_list.rb index c950a58..928b782 100644 --- a/lib/appwrite/models/resource_token_list.rb +++ b/lib/appwrite/models/resource_token_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/row.rb b/lib/appwrite/models/row.rb index 48d852c..c19c044 100644 --- a/lib/appwrite/models/row.rb +++ b/lib/appwrite/models/row.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/row_list.rb b/lib/appwrite/models/row_list.rb index 26e676b..debd9e5 100644 --- a/lib/appwrite/models/row_list.rb +++ b/lib/appwrite/models/row_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/runtime.rb b/lib/appwrite/models/runtime.rb index 4158038..4a09aa2 100644 --- a/lib/appwrite/models/runtime.rb +++ b/lib/appwrite/models/runtime.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/runtime_list.rb b/lib/appwrite/models/runtime_list.rb index a528fbe..5b69b4a 100644 --- a/lib/appwrite/models/runtime_list.rb +++ b/lib/appwrite/models/runtime_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/session.rb b/lib/appwrite/models/session.rb index 6aa33b4..762ee42 100644 --- a/lib/appwrite/models/session.rb +++ b/lib/appwrite/models/session.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/session_list.rb b/lib/appwrite/models/session_list.rb index c4e2efe..320cefe 100644 --- a/lib/appwrite/models/session_list.rb +++ b/lib/appwrite/models/session_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/site.rb b/lib/appwrite/models/site.rb index 7e367f4..94e80f0 100644 --- a/lib/appwrite/models/site.rb +++ b/lib/appwrite/models/site.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,6 +19,7 @@ class Site attr_reader :latest_deployment_id attr_reader :latest_deployment_created_at attr_reader :latest_deployment_status + attr_reader :scopes attr_reader :vars attr_reader :timeout attr_reader :install_command @@ -55,6 +56,7 @@ def initialize( latest_deployment_id:, latest_deployment_created_at:, latest_deployment_status:, + scopes:, vars:, timeout:, install_command:, @@ -90,6 +92,7 @@ def initialize( @latest_deployment_id = latest_deployment_id @latest_deployment_created_at = latest_deployment_created_at @latest_deployment_status = latest_deployment_status + @scopes = scopes @vars = vars @timeout = timeout @install_command = install_command @@ -128,6 +131,7 @@ def self.from(map:) latest_deployment_id: map["latestDeploymentId"], latest_deployment_created_at: map["latestDeploymentCreatedAt"], latest_deployment_status: map["latestDeploymentStatus"], + scopes: map["scopes"], vars: map["vars"].map { |it| Variable.from(map: it) }, timeout: map["timeout"], install_command: map["installCommand"], @@ -167,6 +171,7 @@ def to_map "latestDeploymentId": @latest_deployment_id, "latestDeploymentCreatedAt": @latest_deployment_created_at, "latestDeploymentStatus": @latest_deployment_status, + "scopes": @scopes, "vars": @vars.map { |it| it.to_map }, "timeout": @timeout, "installCommand": @install_command, diff --git a/lib/appwrite/models/site_list.rb b/lib/appwrite/models/site_list.rb index 52efd19..51fb319 100644 --- a/lib/appwrite/models/site_list.rb +++ b/lib/appwrite/models/site_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/specification.rb b/lib/appwrite/models/specification.rb index 00c5554..e9ff546 100644 --- a/lib/appwrite/models/specification.rb +++ b/lib/appwrite/models/specification.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/specification_list.rb b/lib/appwrite/models/specification_list.rb index 8a21f36..8212053 100644 --- a/lib/appwrite/models/specification_list.rb +++ b/lib/appwrite/models/specification_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/subscriber.rb b/lib/appwrite/models/subscriber.rb index 1f8fa67..318baaa 100644 --- a/lib/appwrite/models/subscriber.rb +++ b/lib/appwrite/models/subscriber.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/subscriber_list.rb b/lib/appwrite/models/subscriber_list.rb index 1aafca6..0137338 100644 --- a/lib/appwrite/models/subscriber_list.rb +++ b/lib/appwrite/models/subscriber_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/table.rb b/lib/appwrite/models/table.rb index 6b1ebb3..2a7e464 100644 --- a/lib/appwrite/models/table.rb +++ b/lib/appwrite/models/table.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/table_list.rb b/lib/appwrite/models/table_list.rb index 9c8d0ac..034d7fb 100644 --- a/lib/appwrite/models/table_list.rb +++ b/lib/appwrite/models/table_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/target.rb b/lib/appwrite/models/target.rb index 91101a5..56e9075 100644 --- a/lib/appwrite/models/target.rb +++ b/lib/appwrite/models/target.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -19,7 +19,7 @@ def initialize( updated_at:, name:, user_id:, - provider_id: , + provider_id:, provider_type:, identifier:, expired: diff --git a/lib/appwrite/models/target_list.rb b/lib/appwrite/models/target_list.rb index 8ad6787..9ccd770 100644 --- a/lib/appwrite/models/target_list.rb +++ b/lib/appwrite/models/target_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/team.rb b/lib/appwrite/models/team.rb index 7b85b15..d08f183 100644 --- a/lib/appwrite/models/team.rb +++ b/lib/appwrite/models/team.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/team_list.rb b/lib/appwrite/models/team_list.rb index 169c1ee..e02efc9 100644 --- a/lib/appwrite/models/team_list.rb +++ b/lib/appwrite/models/team_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/token.rb b/lib/appwrite/models/token.rb index e5c76b4..b3f539a 100644 --- a/lib/appwrite/models/token.rb +++ b/lib/appwrite/models/token.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/topic.rb b/lib/appwrite/models/topic.rb index ee19d41..4034f4b 100644 --- a/lib/appwrite/models/topic.rb +++ b/lib/appwrite/models/topic.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/topic_list.rb b/lib/appwrite/models/topic_list.rb index a84a029..e1b8c6d 100644 --- a/lib/appwrite/models/topic_list.rb +++ b/lib/appwrite/models/topic_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/transaction.rb b/lib/appwrite/models/transaction.rb index a5e3456..481c25c 100644 --- a/lib/appwrite/models/transaction.rb +++ b/lib/appwrite/models/transaction.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/transaction_list.rb b/lib/appwrite/models/transaction_list.rb index af4c464..17234ab 100644 --- a/lib/appwrite/models/transaction_list.rb +++ b/lib/appwrite/models/transaction_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/usage_billing_plan.rb b/lib/appwrite/models/usage_billing_plan.rb index 2352158..be1d81f 100644 --- a/lib/appwrite/models/usage_billing_plan.rb +++ b/lib/appwrite/models/usage_billing_plan.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -18,15 +18,15 @@ class UsageBillingPlan def initialize( bandwidth:, executions:, - member: , + member:, realtime:, realtime_messages:, - realtime_bandwidth: , + realtime_bandwidth:, storage:, users:, gb_hours:, image_transformations:, - credits: + credits: ) @bandwidth = bandwidth @executions = executions diff --git a/lib/appwrite/models/user.rb b/lib/appwrite/models/user.rb index e55781e..aa133c2 100644 --- a/lib/appwrite/models/user.rb +++ b/lib/appwrite/models/user.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models @@ -35,9 +35,9 @@ def initialize( created_at:, updated_at:, name:, - password: , - hash: , - hash_options: , + password:, + hash:, + hash_options:, registration:, status:, labels:, @@ -45,18 +45,18 @@ def initialize( email:, phone:, email_verification:, - email_canonical: , - email_is_free: , - email_is_disposable: , - email_is_corporate: , - email_is_canonical: , + email_canonical:, + email_is_free:, + email_is_disposable:, + email_is_corporate:, + email_is_canonical:, phone_verification:, mfa:, prefs:, targets:, accessed_at:, - impersonator: , - impersonator_user_id: + impersonator:, + impersonator_user_id: ) @id = id @created_at = created_at diff --git a/lib/appwrite/models/user_list.rb b/lib/appwrite/models/user_list.rb index 6ed8355..79c4c6d 100644 --- a/lib/appwrite/models/user_list.rb +++ b/lib/appwrite/models/user_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/variable.rb b/lib/appwrite/models/variable.rb index b6d33d7..1c14a73 100644 --- a/lib/appwrite/models/variable.rb +++ b/lib/appwrite/models/variable.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/variable_list.rb b/lib/appwrite/models/variable_list.rb index a526175..6c36b9d 100644 --- a/lib/appwrite/models/variable_list.rb +++ b/lib/appwrite/models/variable_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/vectorsdb_collection.rb b/lib/appwrite/models/vectorsdb_collection.rb new file mode 100644 index 0000000..fc87866 --- /dev/null +++ b/lib/appwrite/models/vectorsdb_collection.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class VectorsdbCollection + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :permissions + attr_reader :database_id + attr_reader :name + attr_reader :enabled + attr_reader :document_security + attr_reader :attributes + attr_reader :indexes + attr_reader :bytes_max + attr_reader :bytes_used + attr_reader :dimension + + def initialize( + id:, + created_at:, + updated_at:, + permissions:, + database_id:, + name:, + enabled:, + document_security:, + attributes:, + indexes:, + bytes_max:, + bytes_used:, + dimension: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @permissions = permissions + @database_id = database_id + @name = name + @enabled = enabled + @document_security = document_security + @attributes = attributes + @indexes = indexes + @bytes_max = bytes_max + @bytes_used = bytes_used + @dimension = dimension + end + + def self.from(map:) + VectorsdbCollection.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + permissions: map["$permissions"], + database_id: map["databaseId"], + name: map["name"], + enabled: map["enabled"], + document_security: map["documentSecurity"], + attributes: map["attributes"], + indexes: map["indexes"].map { |it| Index.from(map: it) }, + bytes_max: map["bytesMax"], + bytes_used: map["bytesUsed"], + dimension: map["dimension"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "$permissions": @permissions, + "databaseId": @database_id, + "name": @name, + "enabled": @enabled, + "documentSecurity": @document_security, + "attributes": @attributes, + "indexes": @indexes.map { |it| it.to_map }, + "bytesMax": @bytes_max, + "bytesUsed": @bytes_used, + "dimension": @dimension + } + end + end + end +end diff --git a/lib/appwrite/models/vectorsdb_collection_list.rb b/lib/appwrite/models/vectorsdb_collection_list.rb new file mode 100644 index 0000000..e933696 --- /dev/null +++ b/lib/appwrite/models/vectorsdb_collection_list.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Appwrite + module Models + class VectorsdbCollectionList + attr_reader :total + attr_reader :collections + + def initialize( + total:, + collections: + ) + @total = total + @collections = collections + end + + def self.from(map:) + VectorsdbCollectionList.new( + total: map["total"], + collections: map["collections"].map { |it| VectorsdbCollection.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "collections": @collections.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/webhook.rb b/lib/appwrite/models/webhook.rb index 77ed5de..5e41807 100644 --- a/lib/appwrite/models/webhook.rb +++ b/lib/appwrite/models/webhook.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/models/webhook_list.rb b/lib/appwrite/models/webhook_list.rb index 0225609..1df070b 100644 --- a/lib/appwrite/models/webhook_list.rb +++ b/lib/appwrite/models/webhook_list.rb @@ -1,4 +1,4 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite module Models diff --git a/lib/appwrite/operator.rb b/lib/appwrite/operator.rb index 92ea6fa..87de54c 100644 --- a/lib/appwrite/operator.rb +++ b/lib/appwrite/operator.rb @@ -40,6 +40,7 @@ class << Operator def increment(value = 1, max = nil) raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [value] values << max if max != nil return Operator.new("increment", values).to_s @@ -48,6 +49,7 @@ def increment(value = 1, max = nil) def decrement(value = 1, min = nil) raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?) raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?) + values = [value] values << min if min != nil return Operator.new("decrement", values).to_s @@ -56,6 +58,7 @@ def decrement(value = 1, min = nil) def multiply(factor, max = nil) raise ArgumentError, "Factor cannot be NaN or Infinity" if factor.respond_to?(:nan?) && (factor.nan? || factor.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [factor] values << max if max != nil return Operator.new("multiply", values).to_s @@ -65,6 +68,7 @@ def divide(divisor, min = nil) raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?) raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?) raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0 + values = [divisor] values << min if min != nil return Operator.new("divide", values).to_s @@ -73,12 +77,14 @@ def divide(divisor, min = nil) def modulo(divisor) raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?) raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0 + return Operator.new("modulo", [divisor]).to_s end def power(exponent, max = nil) raise ArgumentError, "Exponent cannot be NaN or Infinity" if exponent.respond_to?(:nan?) && (exponent.nan? || exponent.infinite?) raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?) + values = [exponent] values << max if max != nil return Operator.new("power", values).to_s diff --git a/lib/appwrite/permission.rb b/lib/appwrite/permission.rb index f47a5c2..190aa9d 100644 --- a/lib/appwrite/permission.rb +++ b/lib/appwrite/permission.rb @@ -4,15 +4,19 @@ class << Permission def read(role) return "read(\"#{role}\")" end + def write(role) return "write(\"#{role}\")" end + def create(role) return "create(\"#{role}\")" end + def update(role) return "update(\"#{role}\")" end + def delete(role) return "delete(\"#{role}\")" end diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index aa7f01e..3312d81 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -48,15 +48,15 @@ def regex(attribute, pattern) def less_than(attribute, value) return Query.new("lessThan", attribute, value).to_s end - + def less_than_equal(attribute, value) return Query.new("lessThanEqual", attribute, value).to_s end - + def greater_than(attribute, value) return Query.new("greaterThan", attribute, value).to_s end - + def greater_than_equal(attribute, value) return Query.new("greaterThanEqual", attribute, value).to_s end @@ -100,7 +100,7 @@ def ends_with(attribute, value) def select(attributes) return Query.new("select", nil, attributes).to_s end - + def search(attribute, value) return Query.new("search", attribute, value).to_s end diff --git a/lib/appwrite/role.rb b/lib/appwrite/role.rb index ec17154..7c32245 100644 --- a/lib/appwrite/role.rb +++ b/lib/appwrite/role.rb @@ -1,10 +1,8 @@ module Appwrite - # Helper class to generate role strings for `Permission`. class Role - # Grants access to anyone. - # + # # This includes authenticated and unauthenticated users. # # @return [String] @@ -13,24 +11,24 @@ def self.any end # Grants access to a specific user by user ID. - # + # # You can optionally pass verified or unverified for # `status` to target specific types of users. # # @param [String] id # @param [String] status - # + # # @return [String] def self.user(id, status = "") - if(status.empty?) + if (status.empty?) "user:#{id}" else "user:#{id}/#{status}" end end - + # Grants access to any authenticated or anonymous user. - # + # # You can optionally pass verified or unverified for # `status` to target specific types of users. # @@ -38,13 +36,13 @@ def self.user(id, status = "") # # @return [String] def self.users(status = "") - if(status.empty?) + if (status.empty?) 'users' else "users/#{status}" end end - + # Grants access to any guest user without a session. # # Authenticated users don't have access to this role. @@ -53,7 +51,7 @@ def self.users(status = "") def self.guests 'guests' end - + # Grants access to a team by team ID. # # You can optionally pass a role for `role` to target @@ -64,7 +62,7 @@ def self.guests # # @return [String] def self.team(id, role = "") - if(role.empty?) + if (role.empty?) "team:#{id}" else "team:#{id}/#{role}" @@ -72,7 +70,7 @@ def self.team(id, role = "") end # Grants access to a specific member of a team. - # + # # When the member is removed from the team, they will # no longer have access. # @@ -92,4 +90,4 @@ def self.label(name) "label:#{name}" end end -end \ No newline at end of file +end diff --git a/lib/appwrite/service.rb b/lib/appwrite/service.rb index c0ec9a5..2ff69d5 100644 --- a/lib/appwrite/service.rb +++ b/lib/appwrite/service.rb @@ -3,5 +3,5 @@ class Service def initialize(client) @client = client end - end + end end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 7b2bcb7..e32c130 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Account < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/account' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -29,7 +27,6 @@ def get() params: api_params, response_type: Models::User ) - end # Use this endpoint to allow a new user to register a new account in your @@ -40,25 +37,30 @@ def get() # login to their new account, you need to create a new [account # session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password New user password. Must be between 8 and 256 chars. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create(user_id:, email:, password:, name: nil) + def create( + user_id:, + email:, + password:, + name: nil + ) api_path = '/account' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -67,7 +69,7 @@ def create(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -81,7 +83,6 @@ def create(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Get a list of the OAuth2 consents the current user has given to third-party @@ -91,14 +92,17 @@ def create(user_id:, email:, password:, name: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [Oauth2ConsentList] - def list_consents(queries: nil, total: nil) + def list_consents( + queries: nil, + total: nil + ) api_path = '/account/consents' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -111,7 +115,6 @@ def list_consents(queries: nil, total: nil) params: api_params, response_type: Models::Oauth2ConsentList ) - end # Get an OAuth2 consent the current user has given to a third-party app by @@ -120,17 +123,18 @@ def list_consents(queries: nil, total: nil) # @param [String] consent_id Consent unique ID. # # @return [Oauth2Consent] - def get_consent(consent_id:) + def get_consent( + consent_id: + ) api_path = '/account/consents/{consentId}' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -143,7 +147,6 @@ def get_consent(consent_id:) params: api_params, response_type: Models::Oauth2Consent ) - end # Delete an OAuth2 consent by its unique ID. All token families issued under @@ -153,17 +156,18 @@ def get_consent(consent_id:) # @param [String] consent_id Consent unique ID. # # @return [] - def delete_consent(consent_id:) + def delete_consent( + consent_id: + ) api_path = '/account/consents/{consentId}' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -176,7 +180,6 @@ def delete_consent(consent_id:) headers: api_headers, params: api_params, ) - end # Get a list of the token families issued under an OAuth2 consent. Each entry @@ -188,19 +191,23 @@ def delete_consent(consent_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [Oauth2ConsentTokenList] - def list_consent_tokens(consent_id:, queries: nil, total: nil) + def list_consent_tokens( + consent_id:, + queries: nil, + total: nil + ) api_path = '/account/consents/{consentId}/tokens' .gsub('{consentId}', consent_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -213,7 +220,6 @@ def list_consent_tokens(consent_id:, queries: nil, total: nil) params: api_params, response_type: Models::Oauth2ConsentTokenList ) - end # Get a token family issued under an OAuth2 consent by its unique ID. The @@ -223,22 +229,24 @@ def list_consent_tokens(consent_id:, queries: nil, total: nil) # @param [String] token_id Token unique ID. # # @return [Oauth2ConsentToken] - def get_consent_token(consent_id:, token_id:) + def get_consent_token( + consent_id:, + token_id: + ) api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', consent_id) .gsub('{tokenId}', token_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -251,7 +259,6 @@ def get_consent_token(consent_id:, token_id:) params: api_params, response_type: Models::Oauth2ConsentToken ) - end # Delete a token family issued under an OAuth2 consent by its unique ID. The @@ -262,22 +269,24 @@ def get_consent_token(consent_id:, token_id:) # @param [String] token_id Token unique ID. # # @return [] - def delete_consent_token(consent_id:, token_id:) + def delete_consent_token( + consent_id:, + token_id: + ) api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', consent_id) .gsub('{tokenId}', token_id) if consent_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "consentId"') + raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -290,7 +299,6 @@ def delete_consent_token(consent_id:, token_id:) headers: api_headers, params: api_params, ) - end # Update currently logged in user account email address. After changing user @@ -300,28 +308,31 @@ def delete_consent_token(consent_id:, token_id:) # user password is required to complete this request. # This endpoint can also be used to convert an anonymous account to a normal # one, by passing an email address and a new password. - # + # # # @param [String] email User email. # @param [String] password User password. Must be at least 8 chars. # # @return [User] - def update_email(email:, password:) + def update_email( + email:, + password: + ) api_path = '/account/email' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { email: email, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -335,7 +346,6 @@ def update_email(email:, password:) params: api_params, response_type: Models::User ) - end # Get the list of identities for the currently logged in user. @@ -344,14 +354,17 @@ def update_email(email:, password:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IdentityList] - def list_identities(queries: nil, total: nil) + def list_identities( + queries: nil, + total: nil + ) api_path = '/account/identities' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -364,7 +377,6 @@ def list_identities(queries: nil, total: nil) params: api_params, response_type: Models::IdentityList ) - end # Delete an identity by its unique ID. @@ -372,17 +384,18 @@ def list_identities(queries: nil, total: nil) # @param [String] identity_id Identity ID. # # @return [] - def delete_identity(identity_id:) + def delete_identity( + identity_id: + ) api_path = '/account/identities/{identityId}' .gsub('{identityId}', identity_id) if identity_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "identityId"') + raise Appwrite::Exception.new('Missing required parameter: "identityId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -394,7 +407,6 @@ def delete_identity(identity_id:) headers: api_headers, params: api_params, ) - end # Get the list of latest security activity logs for the currently logged in @@ -404,14 +416,17 @@ def delete_identity(identity_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [LogList] - def list_logs(queries: nil, total: nil) + def list_logs( + queries: nil, + total: nil + ) api_path = '/account/logs' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -424,7 +439,6 @@ def list_logs(queries: nil, total: nil) params: api_params, response_type: Models::LogList ) - end # Enable or disable MFA on an account. @@ -432,17 +446,19 @@ def list_logs(queries: nil, total: nil) # @param [] mfa Enable or disable MFA. # # @return [User] - def update_mfa(mfa:) + def update_mfa( + mfa: + ) api_path = '/account/mfa' if mfa.nil? - raise Appwrite::Exception.new('Missing required parameter: "mfa"') + raise Appwrite::Exception.new('Missing required parameter: "mfa"') end api_params = { mfa: mfa, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -456,7 +472,6 @@ def update_mfa(mfa:) params: api_params, response_type: Models::User ) - end # Add an authenticator app to be used as an MFA factor. Verify the @@ -467,17 +482,18 @@ def update_mfa(mfa:) # @param [AuthenticatorType] type Type of authenticator. Must be `totp` # # @return [MfaType] - def create_mfa_authenticator(type:) + def create_mfa_authenticator( + type: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -491,7 +507,6 @@ def create_mfa_authenticator(type:) params: api_params, response_type: Models::MfaType ) - end # Verify an authenticator app after adding it using the [add @@ -502,22 +517,25 @@ def create_mfa_authenticator(type:) # @param [String] otp Valid verification token. # # @return [User] - def update_mfa_authenticator(type:, otp:) + def update_mfa_authenticator( + type:, + otp: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -531,7 +549,6 @@ def update_mfa_authenticator(type:, otp:) params: api_params, response_type: Models::User ) - end # Delete an authenticator for a user by ID. @@ -539,17 +556,18 @@ def update_mfa_authenticator(type:, otp:) # @param [AuthenticatorType] type Type of authenticator. # # @return [] - def delete_mfa_authenticator(type:) + def delete_mfa_authenticator( + type: + ) api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', type) if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -561,7 +579,6 @@ def delete_mfa_authenticator(type:) headers: api_headers, params: api_params, ) - end # Begin the process of MFA verification after sign-in. Finish the flow with @@ -571,17 +588,19 @@ def delete_mfa_authenticator(type:) # @param [AuthenticationFactor] factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. # # @return [MfaChallenge] - def create_mfa_challenge(factor:) + def create_mfa_challenge( + factor: + ) api_path = '/account/mfa/challenges' if factor.nil? - raise Appwrite::Exception.new('Missing required parameter: "factor"') + raise Appwrite::Exception.new('Missing required parameter: "factor"') end api_params = { factor: factor, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -595,7 +614,6 @@ def create_mfa_challenge(factor:) params: api_params, response_type: Models::MfaChallenge ) - end # Complete the MFA challenge by providing the one-time password. Finish the @@ -608,22 +626,25 @@ def create_mfa_challenge(factor:) # @param [String] otp Valid verification token. # # @return [Session] - def update_mfa_challenge(challenge_id:, otp:) + def update_mfa_challenge( + challenge_id:, + otp: + ) api_path = '/account/mfa/challenges' if challenge_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "challengeId"') + raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { challengeId: challenge_id, otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -637,7 +658,6 @@ def update_mfa_challenge(challenge_id:, otp:) params: api_params, response_type: Models::Session ) - end # List the factors available on the account to be used as a MFA challange. @@ -647,9 +667,8 @@ def update_mfa_challenge(challenge_id:, otp:) def list_mfa_factors() api_path = '/account/mfa/factors' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -662,7 +681,6 @@ def list_mfa_factors() params: api_params, response_type: Models::MfaFactors ) - end # Get recovery codes that can be used as backup for MFA flow. Before getting @@ -675,9 +693,8 @@ def list_mfa_factors() def get_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -690,10 +707,9 @@ def get_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end - # Generate recovery codes as backup for MFA flow. It's recommended to + # Generate recovery codes as backup for MFA flow. It's recommended to # generate and show then immediately after user successfully adds their # authehticator. Recovery codes can be used as a MFA verification type in # [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) @@ -704,9 +720,8 @@ def get_mfa_recovery_codes() def create_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -720,7 +735,6 @@ def create_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Regenerate recovery codes that can be used as backup for MFA flow. Before @@ -733,9 +747,8 @@ def create_mfa_recovery_codes() def update_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -749,7 +762,6 @@ def update_mfa_recovery_codes() params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Update currently logged in user account name. @@ -757,17 +769,19 @@ def update_mfa_recovery_codes() # @param [String] name User name. Max length: 128 chars. # # @return [User] - def update_name(name:) + def update_name( + name: + ) api_path = '/account/name' if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -781,7 +795,6 @@ def update_name(name:) params: api_params, response_type: Models::User ) - end # Update currently logged in user password. For validation, user is required @@ -792,18 +805,21 @@ def update_name(name:) # @param [String] old_password Current user password. Max length: 256 chars. # # @return [User] - def update_password(password:, old_password: nil) + def update_password( + password:, + old_password: nil + ) api_path = '/account/password' if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { password: password, oldPassword: old_password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -817,35 +833,37 @@ def update_password(password:, old_password: nil) params: api_params, response_type: Models::User ) - end - # Update the currently logged in user's phone number. After updating the + # Update the currently logged in user's phone number. After updating the # phone number, the phone verification status will be reset. A confirmation # SMS is not sent automatically, however you can use the [POST # /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) # endpoint to send a confirmation SMS. # - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] password User password. Must be at least 8 chars. # # @return [User] - def update_phone(phone:, password:) + def update_phone( + phone:, + password: + ) api_path = '/account/phone' if phone.nil? - raise Appwrite::Exception.new('Missing required parameter: "phone"') + raise Appwrite::Exception.new('Missing required parameter: "phone"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { phone: phone, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -859,7 +877,6 @@ def update_phone(phone:, password:) params: api_params, response_type: Models::User ) - end # Get the preferences as a key-value object for the currently logged in user. @@ -869,9 +886,8 @@ def update_phone(phone:, password:) def get_prefs() api_path = '/account/prefs' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -884,7 +900,6 @@ def get_prefs() params: api_params, response_type: Models::Preferences ) - end # Update currently logged in user account preferences. The object you pass is @@ -894,17 +909,19 @@ def get_prefs() # @param [Hash] prefs Prefs key-value JSON object. # # @return [User] - def update_prefs(prefs:) + def update_prefs( + prefs: + ) api_path = '/account/prefs' if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -918,7 +935,6 @@ def update_prefs(prefs:) params: api_params, response_type: Models::User ) - end # Sends the user an email with a temporary secret key for password reset. @@ -927,29 +943,32 @@ def update_prefs(prefs:) # attached to the URL query string. Use the query string params to submit a # request to the [PUT # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) - # endpoint to complete the process. The verification link sent to the user's + # endpoint to complete the process. The verification link sent to the user's # email address is valid for 1 hour. # # @param [String] email User email. # @param [String] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_recovery(email:, url:) + def create_recovery( + email:, + url: + ) api_path = '/account/recovery' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { email: email, url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -963,7 +982,6 @@ def create_recovery(email:, url:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user account password reset. Both the @@ -971,7 +989,7 @@ def create_recovery(email:, url:) # the redirect URL you have provided when sending your request to the [POST # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) # endpoint. - # + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) # the only valid redirect URLs are the ones from domains you have set when @@ -982,19 +1000,23 @@ def create_recovery(email:, url:) # @param [String] password New user password. Must be between 8 and 256 chars. # # @return [Token] - def update_recovery(user_id:, secret:, password:) + def update_recovery( + user_id:, + secret:, + password: + ) api_path = '/account/recovery' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -1002,7 +1024,7 @@ def update_recovery(user_id:, secret:, password:) secret: secret, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1016,7 +1038,6 @@ def update_recovery(user_id:, secret:, password:) params: api_params, response_type: Models::Token ) - end # Get the list of active sessions across different devices for the currently @@ -1027,9 +1048,8 @@ def update_recovery(user_id:, secret:, password:) def list_sessions() api_path = '/account/sessions' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1042,7 +1062,6 @@ def list_sessions() params: api_params, response_type: Models::SessionList ) - end # Delete all sessions from the user account and remove any sessions cookies @@ -1053,9 +1072,8 @@ def list_sessions() def delete_sessions() api_path = '/account/sessions' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1067,7 +1085,6 @@ def delete_sessions() headers: api_headers, params: api_params, ) - end # Use this endpoint to allow a new user to register an anonymous account in @@ -1083,9 +1100,8 @@ def delete_sessions() def create_anonymous_session() api_path = '/account/sessions/anonymous' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1099,12 +1115,11 @@ def create_anonymous_session() params: api_params, response_type: Models::Session ) - end # Allow the user to login into their account by providing a valid email and # password combination. This route will create a new session for the user. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). @@ -1113,22 +1128,25 @@ def create_anonymous_session() # @param [String] password User password. Must be at least 8 chars. # # @return [Session] - def create_email_password_session(email:, password:) + def create_email_password_session( + email:, + password: + ) api_path = '/account/sessions/email' if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { email: email, password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1142,7 +1160,6 @@ def create_email_password_session(email:, password:) params: api_params, response_type: Models::Session ) - end # @@ -1152,26 +1169,29 @@ def create_email_password_session(email:, password:) # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Valid verification token. # # @return [Session] - def update_magic_url_session(user_id:, secret:) + def update_magic_url_session( + user_id:, + secret: + ) api_path = '/account/sessions/magic-url' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1185,7 +1205,6 @@ def update_magic_url_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end # @@ -1195,26 +1214,29 @@ def update_magic_url_session(user_id:, secret:) # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Valid verification token. # # @return [Session] - def update_phone_session(user_id:, secret:) + def update_phone_session( + user_id:, + secret: + ) api_path = '/account/sessions/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1228,33 +1250,35 @@ def update_phone_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end # Use this endpoint to create a session from token. Provide the **userId** # and **secret** parameters from the successful response of authentication # flows initiated by token creation. For example, magic URL and phone login. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] secret Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. # # @return [Session] - def create_session(user_id:, secret:) + def create_session( + user_id:, + secret: + ) api_path = '/account/sessions/token' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1268,26 +1292,26 @@ def create_session(user_id:, secret:) params: api_params, response_type: Models::Session ) - end - # Use this endpoint to get a logged in user's session using a Session ID. - # Inputting 'current' will return the current session being used. + # Use this endpoint to get a logged in user's session using a Session ID. + # Inputting 'current' will return the current session being used. # - # @param [String] session_id Session ID. Use the string 'current' to get the current device session. + # @param [String] session_id Session ID. Use the string 'current' to get the current device session. # # @return [Session] - def get_session(session_id:) + def get_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1300,27 +1324,27 @@ def get_session(session_id:) params: api_params, response_type: Models::Session ) - end - # Use this endpoint to extend a session's length. Extending a session is + # Use this endpoint to extend a session's length. Extending a session is # useful when session expiry is short. If the session was created using an # OAuth provider, this endpoint refreshes the access token from the provider. # - # @param [String] session_id Session ID. Use the string 'current' to update the current device session. + # @param [String] session_id Session ID. Use the string 'current' to update the current device session. # # @return [Session] - def update_session(session_id:) + def update_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1334,29 +1358,29 @@ def update_session(session_id:) params: api_params, response_type: Models::Session ) - end - # Logout the user. Use 'current' as the session ID to logout on this device, - # use a session ID to logout on another device. If you're looking to logout + # Logout the user. Use 'current' as the session ID to logout on this device, + # use a session ID to logout on another device. If you're looking to logout # the user on all devices, use [Delete # Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) # instead. # - # @param [String] session_id Session ID. Use the string 'current' to delete the current device session. + # @param [String] session_id Session ID. Use the string 'current' to delete the current device session. # # @return [] - def delete_session(session_id:) + def delete_session( + session_id: + ) api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', session_id) if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1368,7 +1392,6 @@ def delete_session(session_id:) headers: api_headers, params: api_params, ) - end # Block the currently logged in user account. Behind the scene, the user @@ -1380,9 +1403,8 @@ def delete_session(session_id:) def update_status() api_path = '/account/status' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1396,7 +1418,6 @@ def update_status() params: api_params, response_type: Models::User ) - end # Sends the user an email with a secret key for creating a session. If the @@ -1406,28 +1427,32 @@ def update_status() # email with the one-time password. Use the returned user ID and secret and # submit a request to the [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The secret sent to the user's email + # endpoint to complete the login process. The secret sent to the user's email # is valid for 15 minutes. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). - # # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. + # + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. # @param [String] email User email. # @param [] phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. # # @return [Token] - def create_email_token(user_id:, email:, phrase: nil) + def create_email_token( + user_id:, + email:, + phrase: nil + ) api_path = '/account/tokens/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { @@ -1435,7 +1460,7 @@ def create_email_token(user_id:, email:, phrase: nil) email: email, phrase: phrase, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1449,7 +1474,6 @@ def create_email_token(user_id:, email:, phrase: nil) params: api_params, response_type: Models::Token ) - end # Sends the user an email with a secret key for creating a session. If the @@ -1459,29 +1483,34 @@ def create_email_token(user_id:, email:, phrase: nil) # query string. Use the query string parameters to submit a request to the # [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The link sent to the user's email + # endpoint to complete the login process. The link sent to the user's email # address is valid for 1 hour. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). - # # - # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. + # + # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. # @param [String] email User email. # @param [String] url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [] phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. # # @return [Token] - def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) + def create_magic_url_token( + user_id:, + email:, + url: nil, + phrase: nil + ) api_path = '/account/tokens/magic-url' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { @@ -1490,7 +1519,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) url: url, phrase: phrase, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1504,36 +1533,40 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) params: api_params, response_type: Models::Token ) - end # Allow the user to login to their account using the OAuth2 provider of their # choice. Each OAuth2 provider should be enabled from the Appwrite console - # first. Use the success and failure arguments to provide a redirect URL's - # back to your app when login is completed. - # + # first. Use the success and failure arguments to provide a redirect URL's + # back to your app when login is completed. + # # If authentication succeeds, `userId` and `secret` of a token will be # appended to the success URL as query parameters. These can be used to # create a new session using the [Create # session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) # endpoint. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. # # @return [] - def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) + def create_o_auth2_token( + provider:, + success: nil, + failure: nil, + scopes: nil + ) api_path = '/account/tokens/oauth2/{provider}' .gsub('{provider}', provider) if provider.nil? - raise Appwrite::Exception.new('Missing required parameter: "provider"') + raise Appwrite::Exception.new('Missing required parameter: "provider"') end api_params = { @@ -1541,7 +1574,7 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) failure: failure, scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'text/html', @@ -1554,40 +1587,42 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) params: api_params, response_type: "location" ) - end # Sends the user an SMS with a secret key for creating a session. If the # provided user ID has not be registered, a new user will be created. Use the # returned user ID and secret and submit a request to the [POST # /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - # endpoint to complete the login process. The secret sent to the user's phone + # endpoint to complete the login process. The secret sent to the user's phone # is valid for 15 minutes. - # + # # A user is limited to 10 active sessions at a time by default. [Learn more # about session # limits](https://appwrite.io/docs/authentication-security#limits). # - # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] user_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # # @return [Token] - def create_phone_token(user_id:, phone:) + def create_phone_token( + user_id:, + phone: + ) api_path = '/account/tokens/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if phone.nil? - raise Appwrite::Exception.new('Missing required parameter: "phone"') + raise Appwrite::Exception.new('Missing required parameter: "phone"') end api_params = { userId: user_id, phone: phone, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1601,7 +1636,6 @@ def create_phone_token(user_id:, phone:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to send a verification message to your user email address @@ -1612,28 +1646,30 @@ def create_phone_token(user_id:, phone:) # verification process by verifying both the **userId** and **secret** # parameters. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). - # The verification link sent to the user's email address is valid for 7 days. - # + # The verification link sent to the user's email address is valid for 7 days. + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), # the only valid redirect URLs are the ones from domains you have set when # adding your platforms in the console interface. - # + # # # @param [String] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_email_verification(url:) + def create_email_verification( + url: + ) api_path = '/account/verifications/email' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1647,7 +1683,6 @@ def create_email_verification(url:) params: api_params, response_type: Models::Token ) - end # @@ -1661,28 +1696,30 @@ def create_email_verification(url:) # verification process by verifying both the **userId** and **secret** # parameters. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). - # The verification link sent to the user's email address is valid for 7 days. - # + # The verification link sent to the user's email address is valid for 7 days. + # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), # the only valid redirect URLs are the ones from domains you have set when # adding your platforms in the console interface. - # + # # # @param [String] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # # @return [Token] - def create_verification(url:) + def create_verification( + url: + ) api_path = '/account/verifications/email' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1696,7 +1733,6 @@ def create_verification(url:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user email verification process. Use both @@ -1708,22 +1744,25 @@ def create_verification(url:) # @param [String] secret Valid verification token. # # @return [Token] - def update_email_verification(user_id:, secret:) + def update_email_verification( + user_id:, + secret: + ) api_path = '/account/verifications/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1737,7 +1776,6 @@ def update_email_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end # @@ -1752,22 +1790,25 @@ def update_email_verification(user_id:, secret:) # @param [String] secret Valid verification token. # # @return [Token] - def update_verification(user_id:, secret:) + def update_verification( + user_id:, + secret: + ) api_path = '/account/verifications/email' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1781,16 +1822,15 @@ def update_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end # Use this endpoint to send a verification SMS to the currently logged in - # user. This endpoint is meant for use after updating a user's phone number + # user. This endpoint is meant for use after updating a user's phone number # using the # [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) # endpoint. Learn more about how to [complete the verification # process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). - # The verification code sent to the user's phone number is valid for 15 + # The verification code sent to the user's phone number is valid for 15 # minutes. # # @@ -1798,9 +1838,8 @@ def update_verification(user_id:, secret:) def create_phone_verification() api_path = '/account/verifications/phone' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1814,11 +1853,10 @@ def create_phone_verification() params: api_params, response_type: Models::Token ) - end # Use this endpoint to complete the user phone verification process. Use the - # **userId** and **secret** that were sent to your user's phone number to + # **userId** and **secret** that were sent to your user's phone number to # verify the user email ownership. If confirmed this route will return a 200 # status code. # @@ -1826,22 +1864,25 @@ def create_phone_verification() # @param [String] secret Valid verification token. # # @return [Token] - def update_phone_verification(user_id:, secret:) + def update_phone_verification( + user_id:, + secret: + ) api_path = '/account/verifications/phone' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1855,8 +1896,6 @@ def update_phone_verification(user_id:, secret:) params: api_params, response_type: Models::Token ) - end - - end + end end diff --git a/lib/appwrite/services/activities.rb b/lib/appwrite/services/activities.rb index 27b9124..2c4c457 100644 --- a/lib/appwrite/services/activities.rb +++ b/lib/appwrite/services/activities.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Activities < Service - def initialize(client) @client = client end @@ -12,13 +11,15 @@ def initialize(client) # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. # # @return [ActivityEventList] - def list_events(queries: nil) + def list_events( + queries: nil + ) api_path = '/activities/events' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -31,26 +32,26 @@ def list_events(queries: nil) params: api_params, response_type: Models::ActivityEventList ) - end # Get event by ID. - # + # # # @param [String] event_id Event ID. # # @return [ActivityEvent] - def get_event(event_id:) + def get_event( + event_id: + ) api_path = '/activities/events/{eventId}' .gsub('{eventId}', event_id) if event_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "eventId"') + raise Appwrite::Exception.new('Missing required parameter: "eventId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -63,8 +64,6 @@ def get_event(event_id:) params: api_params, response_type: Models::ActivityEvent ) - end - - end + end end diff --git a/lib/appwrite/services/advisor.rb b/lib/appwrite/services/advisor.rb index 571216c..7efe9fa 100644 --- a/lib/appwrite/services/advisor.rb +++ b/lib/appwrite/services/advisor.rb @@ -1,28 +1,30 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Advisor < Service - def initialize(client) @client = client end - # Get a list of all the project's analyzer reports. You can use the query + # Get a list of all the project's analyzer reports. You can use the query # params to filter your results. - # + # # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ReportList] - def list_reports(queries: nil, total: nil) + def list_reports( + queries: nil, + total: nil + ) api_path = '/reports' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -35,27 +37,27 @@ def list_reports(queries: nil, total: nil) params: api_params, response_type: Models::ReportList ) - end - # Get an analyzer report by its unique ID. The response includes the report's + # Get an analyzer report by its unique ID. The response includes the report's # metadata and the nested insights it produced. - # + # # # @param [String] report_id Report ID. # # @return [Report] - def get_report(report_id:) + def get_report( + report_id: + ) api_path = '/reports/{reportId}' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -68,27 +70,27 @@ def get_report(report_id:) params: api_params, response_type: Models::Report ) - end # Delete an analyzer report by its unique ID. Nested insights and CTA # metadata are removed asynchronously by the deletes worker. - # + # # # @param [String] report_id Report ID. # # @return [] - def delete_report(report_id:) + def delete_report( + report_id: + ) api_path = '/reports/{reportId}' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -100,31 +102,34 @@ def delete_report(report_id:) headers: api_headers, params: api_params, ) - end # List the insights produced under a single analyzer report. You can use the # query params to filter your results further. - # + # # # @param [String] report_id Parent report ID. # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [InsightList] - def list_insights(report_id:, queries: nil, total: nil) + def list_insights( + report_id:, + queries: nil, + total: nil + ) api_path = '/reports/{reportId}/insights' .gsub('{reportId}', report_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -137,32 +142,33 @@ def list_insights(report_id:, queries: nil, total: nil) params: api_params, response_type: Models::InsightList ) - end # Get an insight by its unique ID, scoped to its parent report. - # + # # # @param [String] report_id Parent report ID. # @param [String] insight_id Insight ID. # # @return [Insight] - def get_insight(report_id:, insight_id:) + def get_insight( + report_id:, + insight_id: + ) api_path = '/reports/{reportId}/insights/{insightId}' .gsub('{reportId}', report_id) .gsub('{insightId}', insight_id) if report_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "reportId"') + raise Appwrite::Exception.new('Missing required parameter: "reportId"') end if insight_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "insightId"') + raise Appwrite::Exception.new('Missing required parameter: "insightId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -175,8 +181,6 @@ def get_insight(report_id:, insight_id:) params: api_params, response_type: Models::Insight ) - end - - end + end end diff --git a/lib/appwrite/services/apps.rb b/lib/appwrite/services/apps.rb index b55b8d8..c4c15c1 100644 --- a/lib/appwrite/services/apps.rb +++ b/lib/appwrite/services/apps.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Apps < Service - def initialize(client) @client = client end @@ -13,14 +12,17 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppsList] - def list(queries: nil, total: nil) + def list( + queries: nil, + total: nil + ) api_path = '/apps' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -33,12 +35,11 @@ def list(queries: nil, total: nil) params: api_params, response_type: Models::AppsList ) - end # Create a new application. # - # @param [String] app_id Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] app_id Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Application name. # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. # @param [String] description Application description shown to users during OAuth2 consent. @@ -59,19 +60,39 @@ def list(queries: nil, total: nil) # @param [String] team_id Team unique ID. # # @return [App] - def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil) + def create( + app_id:, + name:, + redirect_uris:, + description: nil, + client_uri: nil, + logo_uri: nil, + privacy_policy_url: nil, + terms_url: nil, + contacts: nil, + tagline: nil, + tags: nil, + images: nil, + support_url: nil, + data_deletion_url: nil, + post_logout_redirect_uris: nil, + enabled: nil, + type: nil, + device_flow: nil, + team_id: nil + ) api_path = '/apps' if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if redirect_uris.nil? - raise Appwrite::Exception.new('Missing required parameter: "redirectUris"') + raise Appwrite::Exception.new('Missing required parameter: "redirectUris"') end api_params = { @@ -95,7 +116,7 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo deviceFlow: device_flow, teamId: team_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -109,7 +130,6 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo params: api_params, response_type: Models::App ) - end # List scopes an application can request when installed on a team. @@ -119,9 +139,8 @@ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, lo def list_installation_scopes() api_path = '/apps/scopes/installations' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -134,7 +153,6 @@ def list_installation_scopes() params: api_params, response_type: Models::AppScopeList ) - end # List scopes an application can request during the OAuth2 flow. @@ -144,9 +162,8 @@ def list_installation_scopes() def list_o_auth2_scopes() api_path = '/apps/scopes/oauth2' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -159,7 +176,6 @@ def list_o_auth2_scopes() params: api_params, response_type: Models::AppScopeList ) - end # Get an application by its unique ID. @@ -167,17 +183,18 @@ def list_o_auth2_scopes() # @param [String] app_id Application unique ID. # # @return [App] - def get(app_id:) + def get( + app_id: + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -190,7 +207,6 @@ def get(app_id:) params: api_params, response_type: Models::App ) - end # Update an application by its unique ID. @@ -213,20 +229,41 @@ def get(app_id:) # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. + # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. # @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. # # @return [App] - def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil) + def update( + app_id:, + name:, + description: nil, + client_uri: nil, + logo_uri: nil, + privacy_policy_url: nil, + terms_url: nil, + contacts: nil, + tagline: nil, + tags: nil, + images: nil, + support_url: nil, + data_deletion_url: nil, + enabled: nil, + redirect_uris: nil, + post_logout_redirect_uris: nil, + type: nil, + device_flow: nil, + installation_scopes: nil, + installation_redirect_url: nil + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -250,7 +287,7 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri installationScopes: installation_scopes, installationRedirectUrl: installation_redirect_url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -264,7 +301,6 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri params: api_params, response_type: Models::App ) - end # Delete an application by its unique ID. @@ -272,17 +308,18 @@ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, pri # @param [String] app_id Application unique ID. # # @return [] - def delete(app_id:) + def delete( + app_id: + ) api_path = '/apps/{appId}' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -295,7 +332,6 @@ def delete(app_id:) headers: api_headers, params: api_params, ) - end # List installations of an application. Requires an app key sent in the @@ -307,19 +343,23 @@ def delete(app_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(app_id:, queries: nil, total: nil) + def list_installations( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/installations' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -332,7 +372,6 @@ def list_installations(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Get an installation of an application by its unique ID. Requires an app key @@ -343,22 +382,24 @@ def list_installations(app_id:, queries: nil, total: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(app_id:, installation_id:) + def get_installation( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -371,7 +412,6 @@ def get_installation(app_id:, installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Delete an installation of an application by its unique ID. Requires a @@ -382,22 +422,24 @@ def get_installation(app_id:, installation_id:) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(app_id:, installation_id:) + def delete_installation( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -410,7 +452,6 @@ def delete_installation(app_id:, installation_id:) headers: api_headers, params: api_params, ) - end # Create a token for an installation of an application. Requires an app key @@ -426,22 +467,24 @@ def delete_installation(app_id:, installation_id:) # @param [String] installation_id Installation unique ID. # # @return [Oauth2Token] - def create_installation_token(app_id:, installation_id:) + def create_installation_token( + app_id:, + installation_id: + ) api_path = '/apps/{appId}/installations/{installationId}/tokens' .gsub('{appId}', app_id) .gsub('{installationId}', installation_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -455,7 +498,6 @@ def create_installation_token(app_id:, installation_id:) params: api_params, response_type: Models::Oauth2Token ) - end # List app keys for an application. @@ -465,19 +507,23 @@ def create_installation_token(app_id:, installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppKeyList] - def list_keys(app_id:, queries: nil, total: nil) + def list_keys( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/keys' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -490,27 +536,27 @@ def list_keys(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppKeyList ) - end # Create a new app key for an application. App keys carry no scopes; send one # in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to - # list the application's installations and create installation access tokens. + # list the application's installations and create installation access tokens. # # @param [String] app_id Application unique ID. # # @return [AppKey] - def create_key(app_id:) + def create_key( + app_id: + ) api_path = '/apps/{appId}/keys' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -524,7 +570,6 @@ def create_key(app_id:) params: api_params, response_type: Models::AppKey ) - end # Get an app key by its unique ID. @@ -533,22 +578,24 @@ def create_key(app_id:) # @param [String] key_id App key unique ID. # # @return [AppKey] - def get_key(app_id:, key_id:) + def get_key( + app_id:, + key_id: + ) api_path = '/apps/{appId}/keys/{keyId}' .gsub('{appId}', app_id) .gsub('{keyId}', key_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -561,7 +608,6 @@ def get_key(app_id:, key_id:) params: api_params, response_type: Models::AppKey ) - end # Delete an app key by its unique ID. @@ -570,22 +616,24 @@ def get_key(app_id:, key_id:) # @param [String] key_id App key unique ID. # # @return [] - def delete_key(app_id:, key_id:) + def delete_key( + app_id:, + key_id: + ) api_path = '/apps/{appId}/keys/{keyId}' .gsub('{appId}', app_id) .gsub('{keyId}', key_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -598,7 +646,6 @@ def delete_key(app_id:, key_id:) headers: api_headers, params: api_params, ) - end # Update the labels of an application. Labels are read-only for clients; only @@ -609,22 +656,25 @@ def delete_key(app_id:, key_id:) # @param [Array] labels Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [App] - def update_labels(app_id:, labels:) + def update_labels( + app_id:, + labels: + ) api_path = '/apps/{appId}/labels' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -638,7 +688,6 @@ def update_labels(app_id:, labels:) params: api_params, response_type: Models::App ) - end # List client secrets for an application. @@ -648,19 +697,23 @@ def update_labels(app_id:, labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppSecretList] - def list_secrets(app_id:, queries: nil, total: nil) + def list_secrets( + app_id:, + queries: nil, + total: nil + ) api_path = '/apps/{appId}/secrets' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -673,7 +726,6 @@ def list_secrets(app_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppSecretList ) - end # Create a new client secret for an application. @@ -681,17 +733,18 @@ def list_secrets(app_id:, queries: nil, total: nil) # @param [String] app_id Application unique ID. # # @return [AppSecretPlaintext] - def create_secret(app_id:) + def create_secret( + app_id: + ) api_path = '/apps/{appId}/secrets' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -705,7 +758,6 @@ def create_secret(app_id:) params: api_params, response_type: Models::AppSecretPlaintext ) - end # Get an application client secret by its unique ID. @@ -714,22 +766,24 @@ def create_secret(app_id:) # @param [String] secret_id Secret unique ID. # # @return [AppSecret] - def get_secret(app_id:, secret_id:) + def get_secret( + app_id:, + secret_id: + ) api_path = '/apps/{appId}/secrets/{secretId}' .gsub('{appId}', app_id) .gsub('{secretId}', secret_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if secret_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "secretId"') + raise Appwrite::Exception.new('Missing required parameter: "secretId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -742,7 +796,6 @@ def get_secret(app_id:, secret_id:) params: api_params, response_type: Models::AppSecret ) - end # Delete an application client secret by its unique ID. @@ -751,22 +804,24 @@ def get_secret(app_id:, secret_id:) # @param [String] secret_id Secret unique ID. # # @return [] - def delete_secret(app_id:, secret_id:) + def delete_secret( + app_id:, + secret_id: + ) api_path = '/apps/{appId}/secrets/{secretId}' .gsub('{appId}', app_id) .gsub('{secretId}', secret_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if secret_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "secretId"') + raise Appwrite::Exception.new('Missing required parameter: "secretId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -779,7 +834,6 @@ def delete_secret(app_id:, secret_id:) headers: api_headers, params: api_params, ) - end # Transfer an application to another team by its unique ID. @@ -788,22 +842,25 @@ def delete_secret(app_id:, secret_id:) # @param [String] team_id Team ID of the team to transfer application to. # # @return [App] - def update_team(app_id:, team_id:) + def update_team( + app_id:, + team_id: + ) api_path = '/apps/{appId}/team' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { teamId: team_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -817,7 +874,6 @@ def update_team(app_id:, team_id:) params: api_params, response_type: Models::App ) - end # Revoke all tokens for an application by its unique ID. @@ -825,17 +881,18 @@ def update_team(app_id:, team_id:) # @param [String] app_id Application unique ID. # # @return [] - def delete_tokens(app_id:) + def delete_tokens( + app_id: + ) api_path = '/apps/{appId}/tokens' .gsub('{appId}', app_id) if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -848,8 +905,6 @@ def delete_tokens(app_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index e4163c7..fb6cafe 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Avatars < Service - def initialize(client) @client = client end @@ -12,7 +11,7 @@ def initialize(client) # /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) # endpoint. Use width, height and quality arguments to change the output # settings. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size @@ -24,12 +23,17 @@ def initialize(client) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_browser(code:, width: nil, height: nil, quality: nil) + def get_browser( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/browsers/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -37,7 +41,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -49,18 +53,17 @@ def get_browser(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # The credit card endpoint will return you the icon of the credit card # provider you need. Use width, height and quality arguments to change the # output settings. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -68,12 +71,17 @@ def get_browser(code:, width: nil, height: nil, quality: nil) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_credit_card(code:, width: nil, height: nil, quality: nil) + def get_credit_card( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/credit-cards/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -81,7 +89,7 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -93,28 +101,29 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to fetch the favorite icon (AKA favicon) of any remote # website URL. - # + # # This endpoint does not follow HTTP redirects. # # @param [String] url Website URL which you want to fetch the favicon from. # # @return [] - def get_favicon(url:) + def get_favicon( + url: + ) api_path = '/avatars/favicon' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { url: url, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -126,19 +135,18 @@ def get_favicon(url:) headers: api_headers, params: api_params, ) - end # You can use this endpoint to show different country flags icons to your # users. The code argument receives the 2 letter country code. Use width, # height and quality arguments to change the output settings. Country codes # follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [Flag] code Country Code. ISO Alpha-2 country code format. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -146,12 +154,17 @@ def get_favicon(url:) # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. # # @return [] - def get_flag(code:, width: nil, height: nil, quality: nil) + def get_flag( + code:, + width: nil, + height: nil, + quality: nil + ) api_path = '/avatars/flags/{code}' .gsub('{code}', code) if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -159,7 +172,7 @@ def get_flag(code:, width: nil, height: nil, quality: nil) height: height, quality: quality, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -171,19 +184,18 @@ def get_flag(code:, width: nil, height: nil, quality: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to fetch a remote image URL and crop it to any image size # you want. This endpoint is very useful if you need to crop and display # remote images in your app or in case you want to make sure a 3rd party # image is properly served using a TLS protocol. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 400x400px. - # + # # This endpoint does not follow HTTP redirects. # # @param [String] url Image URL which you want to crop. @@ -191,11 +203,15 @@ def get_flag(code:, width: nil, height: nil, quality: nil) # @param [Integer] height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. # # @return [] - def get_image(url:, width: nil, height: nil) + def get_image( + url:, + width: nil, + height: nil + ) api_path = '/avatars/image' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { @@ -203,7 +219,7 @@ def get_image(url:, width: nil, height: nil) width: width, height: height, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -215,25 +231,24 @@ def get_image(url:, width: nil, height: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to show your user initials avatar icon on your website or # app. By default, this route will try to print your logged-in user name or - # email initials. You can also overwrite the user name if you pass the 'name' + # email initials. You can also overwrite the user name if you pass the 'name' # parameter. If no name is given and no user is logged, an empty avatar will # be returned. - # + # # You can use the color and background params to change the avatar colors. By # default, a random theme will be selected. The random theme will persist for - # the user's initials when reloading the same theme will always return for + # the user's initials when reloading the same theme will always return for # the same initials. - # + # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an # image at source quality. If dimensions are not specified, the default size # of image returned is 100x100px. - # + # # # @param [String] name Full Name. When empty, current user name or email will be used. Max length: 128 chars. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -241,7 +256,12 @@ def get_image(url:, width: nil, height: nil) # @param [String] background Changes background color. By default a random color will be picked and stay will persistent to the given name. # # @return [] - def get_initials(name: nil, width: nil, height: nil, background: nil) + def get_initials( + name: nil, + width: nil, + height: nil, + background: nil + ) api_path = '/avatars/initials' api_params = { @@ -250,7 +270,7 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) height: height, background: background, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -262,24 +282,87 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) headers: api_headers, params: api_params, ) + end + + # Returns the best available profile photo for a user. The endpoint tries + # each source in priority order and returns the first successful result: + # OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in + # static fallback. + # + # The photo resolves for the currently authenticated user unless `userId` + # points at another user. Passing `emailHash` and/or `name` resolves the + # avatar from those values alone: the hash is looked up on Gravatar and + # Libravatar, the name is rendered as initials, and the user's own identity + # photos, email, and name leave the chain so they never shadow the avatar + # being asked for. Emails are only ever accepted pre-hashed, so no address + # ends up in a URL. + # + # @param [Integer] width Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. + # @param [Integer] height Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. + # @param [Integer] quality Output image quality between 0 and 100. Defaults to 100. + # @param [String] output Output image format. Defaults to 'png'. + # @param [String] rating Maximum image rating to fetch from Gravatar/Libravatar. Defaults to 'g'. + # @param [String] user_id User ID to resolve the photo for. Defaults to 'current()' for the currently authenticated user. + # @param [String] email_hash SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own photo sources. Pass the hash, never the address itself. + # @param [String] name Name to render initials from instead of the user's own photo sources. Max length: 128 chars. + # + # @return [] + def get_photo( + width: nil, + height: nil, + quality: nil, + output: nil, + rating: nil, + user_id: nil, + email_hash: nil, + name: nil + ) + api_path = '/avatars/photo' + + api_params = { + width: width, + height: height, + quality: quality, + output: output, + rating: rating, + userId: user_id, + emailHash: email_hash, + name: name, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'image/*', + } + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + ) end # Converts a given plain text to a QR code image. You can use the query # parameters to change the size and style of the resulting image. - # + # # # @param [String] text Plain text to be converted to QR code image. # @param [Integer] size QR code size. Pass an integer between 1 to 1000. Defaults to 400. # @param [Integer] margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1. - # @param [] download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. + # @param [] download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. # # @return [] - def get_qr(text:, size: nil, margin: nil, download: nil) + def get_qr( + text:, + size: nil, + margin: nil, + download: nil + ) api_path = '/avatars/qr' if text.nil? - raise Appwrite::Exception.new('Missing required parameter: "text"') + raise Appwrite::Exception.new('Missing required parameter: "text"') end api_params = { @@ -288,7 +371,7 @@ def get_qr(text:, size: nil, margin: nil, download: nil) margin: margin, download: download, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -300,16 +383,15 @@ def get_qr(text:, size: nil, margin: nil, download: nil) headers: api_headers, params: api_params, ) - end # Use this endpoint to capture a screenshot of any website URL. This endpoint # uses a headless browser to render the webpage and capture it as an image. - # + # # You can configure the browser viewport size, theme, user agent, # geolocation, permissions, and more. Capture either just the viewport or the # full page scroll. - # + # # When width and height are specified, the image is resized accordingly. If # both dimensions are 0, the API provides an image at original size. If # dimensions are not specified, the default viewport size is 1280x720px. @@ -319,16 +401,16 @@ def get_qr(text:, size: nil, margin: nil, download: nil) # @param [Integer] viewport_width Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. # @param [Integer] viewport_height Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. # @param [Float] scale Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - # @param [BrowserTheme] theme Browser theme. Pass "light" or "dark". Defaults to "light". + # @param [BrowserTheme] theme Browser theme. Pass "light" or "dark". Defaults to "light". # @param [String] user_agent Custom user agent string. Defaults to browser default. # @param [] fullpage Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. - # @param [String] locale Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. - # @param [Timezone] timezone IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. + # @param [String] locale Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. + # @param [Timezone] timezone IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. # @param [Float] latitude Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. # @param [Float] longitude Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. # @param [Float] accuracy Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. # @param [] touch Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - # @param [Array] permissions Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + # @param [Array] permissions Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. # @param [Integer] sleep Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. # @param [Integer] width Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). # @param [Integer] height Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). @@ -336,11 +418,32 @@ def get_qr(text:, size: nil, margin: nil, download: nil) # @param [ImageFormat] output Output format type (jpeg, jpg, png, gif and webp). # # @return [] - def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil, scale: nil, theme: nil, user_agent: nil, fullpage: nil, locale: nil, timezone: nil, latitude: nil, longitude: nil, accuracy: nil, touch: nil, permissions: nil, sleep: nil, width: nil, height: nil, quality: nil, output: nil) + def get_screenshot( + url:, + headers: nil, + viewport_width: nil, + viewport_height: nil, + scale: nil, + theme: nil, + user_agent: nil, + fullpage: nil, + locale: nil, + timezone: nil, + latitude: nil, + longitude: nil, + accuracy: nil, + touch: nil, + permissions: nil, + sleep: nil, + width: nil, + height: nil, + quality: nil, + output: nil + ) api_path = '/avatars/screenshots' if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end api_params = { @@ -365,7 +468,7 @@ def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil quality: quality, output: output, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/png', @@ -377,8 +480,6 @@ def get_screenshot(url:, headers: nil, viewport_width: nil, viewport_height: nil headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/backups.rb b/lib/appwrite/services/backups.rb index 10a8b3e..f74a591 100644 --- a/lib/appwrite/services/backups.rb +++ b/lib/appwrite/services/backups.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Backups < Service - def initialize(client) @client = client end @@ -12,13 +11,15 @@ def initialize(client) # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. # # @return [BackupArchiveList] - def list_archives(queries: nil) + def list_archives( + queries: nil + ) api_path = '/backups/archives' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -31,7 +32,6 @@ def list_archives(queries: nil) params: api_params, response_type: Models::BackupArchiveList ) - end # Create a new archive asynchronously for a project. @@ -40,18 +40,21 @@ def list_archives(queries: nil) # @param [String] resource_id Resource ID. When set, only this single resource will be backed up. # # @return [BackupArchive] - def create_archive(services:, resource_id: nil) + def create_archive( + services:, + resource_id: nil + ) api_path = '/backups/archives' if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { services: services, resourceId: resource_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -65,25 +68,25 @@ def create_archive(services:, resource_id: nil) params: api_params, response_type: Models::BackupArchive ) - end - # Get a backup archive using it's ID. + # Get a backup archive using it's ID. # - # @param [String] archive_id Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] archive_id Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupArchive] - def get_archive(archive_id:) + def get_archive( + archive_id: + ) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -96,25 +99,25 @@ def get_archive(archive_id:) params: api_params, response_type: Models::BackupArchive ) - end # Delete an existing archive for a project. # - # @param [String] archive_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] archive_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [] - def delete_archive(archive_id:) + def delete_archive( + archive_id: + ) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -127,7 +130,6 @@ def delete_archive(archive_id:) headers: api_headers, params: api_params, ) - end # List all policies for a project. @@ -135,13 +137,15 @@ def delete_archive(archive_id:) # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. # # @return [BackupPolicyList] - def list_policies(queries: nil) + def list_policies( + queries: nil + ) api_path = '/backups/policies' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -154,37 +158,44 @@ def list_policies(queries: nil) params: api_params, response_type: Models::BackupPolicyList ) - end # Create a new backup policy. # - # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Array] services Array of services to backup # @param [Integer] retention Days to keep backups before deletion # @param [String] schedule Schedule CRON syntax. # @param [String] name Policy name. Max length: 128 chars. # @param [String] resource_id Resource ID. When set, only this single resource will be backed up. - # @param [] enabled Is policy enabled? When set to 'disabled', no backups will be taken + # @param [] enabled Is policy enabled? When set to 'disabled', no backups will be taken # # @return [BackupPolicy] - def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil) + def create_policy( + policy_id:, + services:, + retention:, + schedule:, + name: nil, + resource_id: nil, + enabled: nil + ) api_path = '/backups/policies' if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end if retention.nil? - raise Appwrite::Exception.new('Missing required parameter: "retention"') + raise Appwrite::Exception.new('Missing required parameter: "retention"') end if schedule.nil? - raise Appwrite::Exception.new('Missing required parameter: "schedule"') + raise Appwrite::Exception.new('Missing required parameter: "schedule"') end api_params = { @@ -196,7 +207,7 @@ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resou retention: retention, schedule: schedule, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -210,25 +221,25 @@ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resou params: api_params, response_type: Models::BackupPolicy ) - end - # Get a backup policy using it's ID. + # Get a backup policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupPolicy] - def get_policy(policy_id:) + def get_policy( + policy_id: + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -241,24 +252,29 @@ def get_policy(policy_id:) params: api_params, response_type: Models::BackupPolicy ) - end - # Update an existing policy using it's ID. + # Update an existing policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Policy name. Max length: 128 chars. # @param [Integer] retention Days to keep backups before deletion # @param [String] schedule Cron expression - # @param [] enabled Is Backup enabled? When set to 'disabled', No backup will be taken + # @param [] enabled Is Backup enabled? When set to 'disabled', No backup will be taken # # @return [BackupPolicy] - def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil) + def update_policy( + policy_id:, + name: nil, + retention: nil, + schedule: nil, + enabled: nil + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end api_params = { @@ -267,7 +283,7 @@ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: schedule: schedule, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -281,25 +297,25 @@ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: params: api_params, response_type: Models::BackupPolicy ) - end - # Delete a policy using it's ID. + # Delete a policy using it's ID. # - # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [] - def delete_policy(policy_id:) + def delete_policy( + policy_id: + ) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -312,24 +328,23 @@ def delete_policy(policy_id:) headers: api_headers, params: api_params, ) - end # Create and trigger a new restoration for a backup on a project. - # + # # For a backup of one database, the restoration resolves its destination # before it is queued. When `newResourceId` is omitted, the archived database # is restored in place and its own ID is returned in `options`. Pass a # different `newResourceId` to restore alongside it as a new database # instead. - # + # # The restoration migration records the archived database in `resourceId` and # `resourceType`, and the resolved database in `destinationResourceId` and # `destinationResourceType`. Database types are stored canonically as # `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave # these fields empty because they do not have a single source or destination # database. - # + # # To list every migration related to one database, use its canonical type in # a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and # destination relation pairs: `(resourceType, resourceId)`, @@ -337,32 +352,37 @@ def delete_policy(policy_id:) # destinationResourceId)`. Legacy and TablesDB databases use `database`; the # operational `resourceType` of a table migration is not rewritten to # `tablesdb`. - # + # # When restoring a DocumentsDB or VectorsDB database from a dedicated source, # the restore provisions a fresh dedicated backing database at the source - # database's own specification and lands the data there. An in-place restore + # database's own specification and lands the data there. An in-place restore # swaps the database onto that backing only once the restore has succeeded, # and retires the backing it displaced only once that swap is confirmed, so # the source keeps serving its own data until the restored data is in place # and any failure leaves it untouched. A serverless source has no dedicated # backing to clone and restores onto the archived database instead. - # + # # # @param [String] archive_id Backup archive ID to restore # @param [Array] services Array of services to restore - # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] new_resource_name Database name. Max length: 128 chars. # # @return [BackupRestoration] - def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) + def create_restoration( + archive_id:, + services:, + new_resource_id: nil, + new_resource_name: nil + ) api_path = '/backups/restoration' if archive_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "archiveId"') + raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end if services.nil? - raise Appwrite::Exception.new('Missing required parameter: "services"') + raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { @@ -371,7 +391,7 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc newResourceId: new_resource_id, newResourceName: new_resource_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -385,7 +405,6 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc params: api_params, response_type: Models::BackupRestoration ) - end # List all backup restorations for a project. @@ -393,13 +412,15 @@ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resourc # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. # # @return [BackupRestorationList] - def list_restorations(queries: nil) + def list_restorations( + queries: nil + ) api_path = '/backups/restorations' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -412,25 +433,25 @@ def list_restorations(queries: nil) params: api_params, response_type: Models::BackupRestorationList ) - end # Get the current status of a backup restoration. # - # @param [String] restoration_id Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] restoration_id Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [BackupRestoration] - def get_restoration(restoration_id:) + def get_restoration( + restoration_id: + ) api_path = '/backups/restorations/{restorationId}' .gsub('{restorationId}', restoration_id) if restoration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -443,8 +464,6 @@ def get_restoration(restoration_id:) params: api_params, response_type: Models::BackupRestoration ) - end - - end + end end diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 5746616..414f91c 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Databases < Service - def initialize(client) @client = client end @@ -18,7 +17,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DatabaseList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/databases' api_params = { @@ -26,7 +29,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -39,29 +42,32 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DatabaseList ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. # # Create a new Database. - # # - # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Database name. Max length: 128 chars. - # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. # # @return [Database] - def create(database_id:, name:, enabled: nil) + def create( + database_id:, + name:, + enabled: nil + ) api_path = '/databases' if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -69,7 +75,7 @@ def create(database_id:, name:, enabled: nil) name: name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -83,7 +89,6 @@ def create(database_id:, name:, enabled: nil) params: api_params, response_type: Models::Database ) - end # @@ -94,13 +99,15 @@ def create(database_id:, name:, enabled: nil) # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). # # @return [TransactionList] - def list_transactions(queries: nil) + def list_transactions( + queries: nil + ) api_path = '/databases/transactions' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -113,7 +120,6 @@ def list_transactions(queries: nil) params: api_params, response_type: Models::TransactionList ) - end # @@ -124,13 +130,15 @@ def list_transactions(queries: nil) # @param [Integer] ttl Seconds before the transaction expires. # # @return [Transaction] - def create_transaction(ttl: nil) + def create_transaction( + ttl: nil + ) api_path = '/databases/transactions' api_params = { ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -144,7 +152,6 @@ def create_transaction(ttl: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -155,17 +162,18 @@ def create_transaction(ttl: nil) # @param [String] transaction_id Transaction ID. # # @return [Transaction] - def get_transaction(transaction_id:) + def get_transaction( + transaction_id: + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -178,7 +186,6 @@ def get_transaction(transaction_id:) params: api_params, response_type: Models::Transaction ) - end # @@ -191,19 +198,23 @@ def get_transaction(transaction_id:) # @param [] rollback Rollback transaction? # # @return [Transaction] - def update_transaction(transaction_id:, commit: nil, rollback: nil) + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { commit: commit, rollback: rollback, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -217,7 +228,6 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -228,17 +238,18 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) # @param [String] transaction_id Transaction ID. # # @return [] - def delete_transaction(transaction_id:) + def delete_transaction( + transaction_id: + ) api_path = '/databases/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -250,7 +261,6 @@ def delete_transaction(transaction_id:) headers: api_headers, params: api_params, ) - end # @@ -262,18 +272,21 @@ def delete_transaction(transaction_id:) # @param [Array] operations Array of staged operations. # # @return [Transaction] - def create_operations(transaction_id:, operations: nil) + def create_operations( + transaction_id:, + operations: nil + ) api_path = '/databases/transactions/{transactionId}/operations' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { operations: operations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -287,7 +300,6 @@ def create_operations(transaction_id:, operations: nil) params: api_params, response_type: Models::Transaction ) - end # @@ -299,17 +311,18 @@ def create_operations(transaction_id:, operations: nil) # @param [String] database_id Database ID. # # @return [Database] - def get(database_id:) + def get( + database_id: + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -322,7 +335,6 @@ def get(database_id:) params: api_params, response_type: Models::Database ) - end # @@ -332,22 +344,26 @@ def get(database_id:) # # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. - # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. # # @return [Database] - def update(database_id:, name: nil, enabled: nil) + def update( + database_id:, + name: nil, + enabled: nil + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { name: name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -361,7 +377,6 @@ def update(database_id:, name: nil, enabled: nil) params: api_params, response_type: Models::Database ) - end # @@ -373,17 +388,18 @@ def update(database_id:, name: nil, enabled: nil) # @param [String] database_id Database ID. # # @return [] - def delete(database_id:) + def delete( + database_id: + ) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -395,7 +411,6 @@ def delete(database_id:) headers: api_headers, params: api_params, ) - end # @@ -410,12 +425,17 @@ def delete(database_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [CollectionList] - def list_collections(database_id:, queries: nil, search: nil, total: nil) + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -423,7 +443,7 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -436,7 +456,6 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::CollectionList ) - end # @@ -448,29 +467,38 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) # API or directly from your database console. # # @param [String] database_id Database ID. - # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Collection name. Max length: 128 chars. # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Collection] - def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil, attributes: nil, indexes: nil) + def create_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + attributes: nil, + indexes: nil + ) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -482,7 +510,7 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc attributes: attributes, indexes: indexes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -496,7 +524,6 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc params: api_params, response_type: Models::Collection ) - end # @@ -509,22 +536,24 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc # @param [String] collection_id Collection ID. # # @return [Collection] - def get_collection(database_id:, collection_id:) + def get_collection( + database_id:, + collection_id: + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -537,7 +566,6 @@ def get_collection(database_id:, collection_id:) params: api_params, response_type: Models::Collection ) - end # @@ -550,21 +578,29 @@ def get_collection(database_id:, collection_id:) # @param [String] name Collection name. Max length: 128 chars. # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. # # @return [Collection] - def update_collection(database_id:, collection_id:, name: nil, permissions: nil, document_security: nil, enabled: nil, purge: nil) + def update_collection( + database_id:, + collection_id:, + name: nil, + permissions: nil, + document_security: nil, + enabled: nil, + purge: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -574,7 +610,7 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, enabled: enabled, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -588,7 +624,6 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, params: api_params, response_type: Models::Collection ) - end # @@ -601,22 +636,24 @@ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, # @param [String] collection_id Collection ID. # # @return [] - def delete_collection(database_id:, collection_id:) + def delete_collection( + database_id:, + collection_id: + ) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -628,7 +665,6 @@ def delete_collection(database_id:, collection_id:) headers: api_headers, params: api_params, ) - end # @@ -642,24 +678,29 @@ def delete_collection(database_id:, collection_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AttributeList] - def list_attributes(database_id:, collection_id:, queries: nil, total: nil) + def list_attributes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -672,7 +713,6 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) params: api_params, response_type: Models::AttributeList ) - end # @@ -680,7 +720,7 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) # # Create a bigint attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -692,25 +732,34 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil) # @param [] array Is attribute an array? # # @return [AttributeBigint] - def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_big_int_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -721,7 +770,7 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -735,7 +784,6 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: params: api_params, response_type: Models::AttributeBigint ) - end # @@ -743,7 +791,7 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: # # Update a bigint attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -755,30 +803,39 @@ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: # @param [String] new_key New Attribute Key. # # @return [AttributeBigint] - def update_big_int_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_big_int_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -788,7 +845,7 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -802,14 +859,13 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBigint ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. # # Create a boolean attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -819,25 +875,32 @@ def update_big_int_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeBoolean] - def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_boolean_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -846,7 +909,7 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -860,7 +923,6 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBoolean ) - end # @@ -877,30 +939,37 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] new_key New attribute key. # # @return [AttributeBoolean] - def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_boolean_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -908,7 +977,7 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -922,7 +991,6 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeBoolean ) - end # @@ -938,25 +1006,32 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeDatetime] - def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_datetime_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -965,7 +1040,7 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -979,7 +1054,6 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeDatetime ) - end # @@ -996,30 +1070,37 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def # @param [String] new_key New attribute key. # # @return [AttributeDatetime] - def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_datetime_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1027,7 +1108,7 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1041,14 +1122,13 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeDatetime ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. # # Create an email attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1058,25 +1138,32 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def # @param [] array Is attribute an array? # # @return [AttributeEmail] - def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_email_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1085,7 +1172,7 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1099,7 +1186,6 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeEmail ) - end # @@ -1107,7 +1193,7 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul # # Update an email attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1117,30 +1203,37 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul # @param [String] new_key New Attribute Key. # # @return [AttributeEmail] - def update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_email_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1148,7 +1241,7 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1162,15 +1255,14 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeEmail ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. # # Create an enum attribute. The `elements` param acts as a white-list of - # accepted values for this attribute. - # + # accepted values for this attribute. + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1181,29 +1273,37 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul # @param [] array Is attribute an array? # # @return [AttributeEnum] - def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil) + def create_enum_attribute( + database_id:, + collection_id:, + key:, + elements:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1213,7 +1313,7 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1227,7 +1327,6 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require params: api_params, response_type: Models::AttributeEnum ) - end # @@ -1235,7 +1334,7 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require # # Update an enum attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1246,34 +1345,42 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require # @param [String] new_key New Attribute Key. # # @return [AttributeEnum] - def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) + def update_enum_attribute( + database_id:, + collection_id:, + key:, + elements:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1282,7 +1389,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1296,7 +1403,6 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require params: api_params, response_type: Models::AttributeEnum ) - end # @@ -1304,7 +1410,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require # # Create a float attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1316,25 +1422,34 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require # @param [] array Is attribute an array? # # @return [AttributeFloat] - def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_float_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1345,7 +1460,7 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1359,7 +1474,6 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n params: api_params, response_type: Models::AttributeFloat ) - end # @@ -1367,7 +1481,7 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n # # Update a float attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1379,30 +1493,39 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n # @param [String] new_key New Attribute Key. # # @return [AttributeFloat] - def update_float_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_float_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1412,7 +1535,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1426,7 +1549,6 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributeFloat ) - end # @@ -1434,7 +1556,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul # # Create an integer attribute. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1446,25 +1568,34 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul # @param [] array Is attribute an array? # # @return [AttributeInteger] - def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_integer_attribute( + database_id:, + collection_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1475,7 +1606,7 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1489,7 +1620,6 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: params: api_params, response_type: Models::AttributeInteger ) - end # @@ -1497,7 +1627,7 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: # # Update an integer attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1509,30 +1639,39 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: # @param [String] new_key New Attribute Key. # # @return [AttributeInteger] - def update_integer_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_integer_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1542,7 +1681,7 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1556,14 +1695,13 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeInteger ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. # # Create IP address attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1573,25 +1711,32 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa # @param [] array Is attribute an array? # # @return [AttributeIp] - def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_ip_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1600,7 +1745,7 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1614,7 +1759,6 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeIp ) - end # @@ -1622,7 +1766,7 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: # # Update an ip attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -1632,30 +1776,37 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: # @param [String] new_key New Attribute Key. # # @return [AttributeIp] - def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_ip_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1663,7 +1814,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1677,7 +1828,6 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, params: api_params, response_type: Models::AttributeIp ) - end # @@ -1692,25 +1842,31 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, # @param [Array] default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. # # @return [AttributeLine] - def create_line_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_line_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1718,7 +1874,7 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1732,7 +1888,6 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeLine ) - end # @@ -1749,26 +1904,33 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default # @param [String] new_key New attribute key. # # @return [AttributeLine] - def update_line_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_line_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1776,7 +1938,7 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1790,14 +1952,13 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeLine ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLongtextColumn` instead. # # Create a longtext attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1808,25 +1969,33 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeLongtext] - def create_longtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_longtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1836,7 +2005,7 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1850,7 +2019,6 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeLongtext ) - end # @@ -1858,7 +2026,7 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def # # Update a longtext attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1868,30 +2036,37 @@ def create_longtext_attribute(database_id:, collection_id:, key:, required:, def # @param [String] new_key New Attribute Key. # # @return [AttributeLongtext] - def update_longtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_longtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1899,7 +2074,7 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1913,14 +2088,13 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def params: api_params, response_type: Models::AttributeLongtext ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createMediumtextColumn` instead. # # Create a mediumtext attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1931,25 +2105,33 @@ def update_longtext_attribute(database_id:, collection_id:, key:, required:, def # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeMediumtext] - def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_mediumtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1959,7 +2141,7 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1973,7 +2155,6 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d params: api_params, response_type: Models::AttributeMediumtext ) - end # @@ -1981,7 +2162,7 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # # Update a mediumtext attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -1991,30 +2172,37 @@ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # @param [String] new_key New Attribute Key. # # @return [AttributeMediumtext] - def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_mediumtext_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2022,7 +2210,7 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2036,7 +2224,6 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d params: api_params, response_type: Models::AttributeMediumtext ) - end # @@ -2051,25 +2238,31 @@ def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, d # @param [Array] default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. # # @return [AttributePoint] - def create_point_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_point_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2077,7 +2270,7 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2091,7 +2284,6 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributePoint ) - end # @@ -2108,26 +2300,33 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul # @param [String] new_key New attribute key. # # @return [AttributePoint] - def update_point_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_point_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2135,7 +2334,7 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2149,7 +2348,6 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul params: api_params, response_type: Models::AttributePoint ) - end # @@ -2164,25 +2362,31 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul # @param [Array] default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. # # @return [AttributePolygon] - def create_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil) + def create_polygon_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2190,7 +2394,7 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2204,7 +2408,6 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributePolygon ) - end # @@ -2221,26 +2424,33 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] new_key New attribute key. # # @return [AttributePolygon] - def update_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + def update_polygon_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2248,7 +2458,7 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2262,7 +2472,6 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributePolygon ) - end # @@ -2270,7 +2479,7 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa # # Create relationship attribute. [Learn more about relationship # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2282,25 +2491,34 @@ def update_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [AttributeRelationship] - def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) + def create_relationship_attribute( + database_id:, + collection_id:, + related_collection_id:, + type:, + two_way: nil, + key: nil, + two_way_key: nil, + on_delete: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if related_collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"') + raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -2311,7 +2529,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti twoWayKey: two_way_key, onDelete: on_delete, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2325,7 +2543,6 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti params: api_params, response_type: Models::AttributeRelationship ) - end # @@ -2333,7 +2550,7 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti # # Update relationship attribute. [Learn more about relationship # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2342,29 +2559,35 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti # @param [String] new_key New Attribute Key. # # @return [AttributeRelationship] - def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) + def update_relationship_attribute( + database_id:, + collection_id:, + key:, + on_delete: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { onDelete: on_delete, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2378,14 +2601,13 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: params: api_params, response_type: Models::AttributeRelationship ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. # # Create a string attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2397,29 +2619,38 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeString] - def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_string_attribute( + database_id:, + collection_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2430,7 +2661,7 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2444,7 +2675,6 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: params: api_params, response_type: Models::AttributeString ) - end # @@ -2452,7 +2682,7 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: # # Update a string attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2463,30 +2693,38 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: # @param [String] new_key New Attribute Key. # # @return [AttributeString] - def update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) + def update_string_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2495,7 +2733,7 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2509,14 +2747,13 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau params: api_params, response_type: Models::AttributeString ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTextColumn` instead. # # Create a text attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2527,25 +2764,33 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeText] - def create_text_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_text_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2555,7 +2800,7 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2569,7 +2814,6 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeText ) - end # @@ -2577,7 +2821,7 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default # # Update a text attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2587,30 +2831,37 @@ def create_text_attribute(database_id:, collection_id:, key:, required:, default # @param [String] new_key New Attribute Key. # # @return [AttributeText] - def update_text_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_text_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2618,7 +2869,7 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2632,14 +2883,13 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default params: api_params, response_type: Models::AttributeText ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. # # Create a URL attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2649,25 +2899,32 @@ def update_text_attribute(database_id:, collection_id:, key:, required:, default # @param [] array Is attribute an array? # # @return [AttributeUrl] - def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) + def create_url_attribute( + database_id:, + collection_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2676,7 +2933,7 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2690,7 +2947,6 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeUrl ) - end # @@ -2698,7 +2954,7 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: # # Update an url attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -2708,30 +2964,37 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: # @param [String] new_key New Attribute Key. # # @return [AttributeUrl] - def update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) + def update_url_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2739,7 +3002,7 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2753,14 +3016,13 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: params: api_params, response_type: Models::AttributeUrl ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createVarcharColumn` instead. # # Create a varchar attribute. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2772,29 +3034,38 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. # # @return [AttributeVarchar] - def create_varchar_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_varchar_attribute( + database_id:, + collection_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2805,7 +3076,7 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2819,7 +3090,6 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required params: api_params, response_type: Models::AttributeVarchar ) - end # @@ -2827,7 +3097,7 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required # # Update a varchar attribute. Changing the `default` value will not update # already existing documents. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2838,30 +3108,38 @@ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required # @param [String] new_key New Attribute Key. # # @return [AttributeVarchar] - def update_varchar_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) + def update_varchar_attribute( + database_id:, + collection_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2870,7 +3148,7 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2884,7 +3162,6 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa params: api_params, response_type: Models::AttributeVarchar ) - end # @@ -2897,27 +3174,30 @@ def update_varchar_attribute(database_id:, collection_id:, key:, required:, defa # @param [String] key Attribute Key. # # @return [AttributeBoolean, AttributeInteger, AttributeFloat, AttributeEmail, AttributeEnum, AttributeUrl, AttributeIp, AttributeDatetime, AttributeRelationship, AttributeString] - def get_attribute(database_id:, collection_id:, key:) + def get_attribute( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2985,7 +3265,6 @@ def get_attribute(database_id:, collection_id:, key:) end raise Exception, "Unable to match response to any expected response model" - end # @@ -2998,27 +3277,30 @@ def get_attribute(database_id:, collection_id:, key:) # @param [String] key Attribute Key. # # @return [] - def delete_attribute(database_id:, collection_id:, key:) + def delete_attribute( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3030,13 +3312,12 @@ def delete_attribute(database_id:, collection_id:, key:) headers: api_headers, params: api_params, ) - end # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. # - # Get a list of all the user's documents in a given collection. You can use + # Get a list of all the user's documents in a given collection. You can use # the query params to filter your results. # # @param [String] database_id Database ID. @@ -3047,17 +3328,24 @@ def delete_attribute(database_id:, collection_id:, key:) # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [DocumentList] - def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil) + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -3066,7 +3354,7 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3079,7 +3367,6 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3092,31 +3379,38 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Document data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil, transaction_id: nil) + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if data.nil? - raise Appwrite::Exception.new('Missing required parameter: "data"') + raise Appwrite::Exception.new('Missing required parameter: "data"') end api_params = { @@ -3125,7 +3419,7 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3139,7 +3433,6 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio params: api_params, response_type: Models::Document ) - end # @@ -3156,28 +3449,33 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def create_documents(database_id:, collection_id:, documents:, transaction_id: nil) + def create_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if documents.nil? - raise Appwrite::Exception.new('Missing required parameter: "documents"') + raise Appwrite::Exception.new('Missing required parameter: "documents"') end api_params = { documents: documents, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3191,7 +3489,6 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3201,7 +3498,7 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n # new collection resource using either a [server # integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) # API or directly from your database console. - # + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. @@ -3209,28 +3506,33 @@ def create_documents(database_id:, collection_id:, documents:, transaction_id: n # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def upsert_documents(database_id:, collection_id:, documents:, transaction_id: nil) + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if documents.nil? - raise Appwrite::Exception.new('Missing required parameter: "documents"') + raise Appwrite::Exception.new('Missing required parameter: "documents"') end api_params = { documents: documents, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3244,7 +3546,6 @@ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: n params: api_params, response_type: Models::DocumentList ) - end # @@ -3261,17 +3562,23 @@ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: n # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def update_documents(database_id:, collection_id:, data: nil, queries: nil, transaction_id: nil) + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { @@ -3279,7 +3586,7 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3293,7 +3600,6 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran params: api_params, response_type: Models::DocumentList ) - end # @@ -3308,24 +3614,29 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil, tran # @param [String] transaction_id Transaction ID for staging the operation. # # @return [DocumentList] - def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: nil) + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3339,7 +3650,6 @@ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: params: api_params, response_type: Models::DocumentList ) - end # @@ -3355,29 +3665,35 @@ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. # # @return [Document] - def get_document(database_id:, collection_id:, document_id:, queries: nil, transaction_id: nil) + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3390,7 +3706,6 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil, trans params: api_params, response_type: Models::Document ) - end # @@ -3409,22 +3724,29 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil, trans # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def upsert_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil) + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { @@ -3432,7 +3754,7 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3446,7 +3768,6 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi params: api_params, response_type: Models::Document ) - end # @@ -3463,22 +3784,29 @@ def upsert_document(database_id:, collection_id:, document_id:, data: nil, permi # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil) + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { @@ -3486,7 +3814,7 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3500,7 +3828,6 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi params: api_params, response_type: Models::Document ) - end # @@ -3514,28 +3841,33 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi # @param [String] transaction_id Transaction ID for staging the operation. # # @return [] - def delete_document(database_id:, collection_id:, document_id:, transaction_id: nil) + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3547,7 +3879,6 @@ def delete_document(database_id:, collection_id:, document_id:, transaction_id: headers: api_headers, params: api_params, ) - end # @@ -3564,7 +3895,15 @@ def delete_document(database_id:, collection_id:, document_id:, transaction_id: # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def decrement_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, min: nil, transaction_id: nil) + def decrement_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + min: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -3572,19 +3911,19 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att .gsub('{attribute}', attribute) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if attribute.nil? - raise Appwrite::Exception.new('Missing required parameter: "attribute"') + raise Appwrite::Exception.new('Missing required parameter: "attribute"') end api_params = { @@ -3592,7 +3931,7 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att min: min, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3606,7 +3945,6 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att params: api_params, response_type: Models::Document ) - end # @@ -3623,7 +3961,15 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Document] - def increment_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, max: nil, transaction_id: nil) + def increment_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + max: nil, + transaction_id: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -3631,19 +3977,19 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att .gsub('{attribute}', attribute) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "documentId"') + raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if attribute.nil? - raise Appwrite::Exception.new('Missing required parameter: "attribute"') + raise Appwrite::Exception.new('Missing required parameter: "attribute"') end api_params = { @@ -3651,7 +3997,7 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att max: max, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3665,7 +4011,6 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att params: api_params, response_type: Models::Document ) - end # @@ -3679,24 +4024,29 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IndexList] - def list_indexes(database_id:, collection_id:, queries: nil, total: nil) + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3709,7 +4059,6 @@ def list_indexes(database_id:, collection_id:, queries: nil, total: nil) params: api_params, response_type: Models::IndexList ) - end # @@ -3728,29 +4077,37 @@ def list_indexes(database_id:, collection_id:, queries: nil, total: nil) # @param [Array] lengths Length of index. Maximum of 100 # # @return [Index] - def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil, lengths: nil) + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if attributes.nil? - raise Appwrite::Exception.new('Missing required parameter: "attributes"') + raise Appwrite::Exception.new('Missing required parameter: "attributes"') end api_params = { @@ -3760,7 +4117,7 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: orders: orders, lengths: lengths, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3774,7 +4131,6 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: params: api_params, response_type: Models::Index ) - end # @@ -3787,27 +4143,30 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: # @param [String] key Index Key. # # @return [Index] - def get_index(database_id:, collection_id:, key:) + def get_index( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3820,7 +4179,6 @@ def get_index(database_id:, collection_id:, key:) params: api_params, response_type: Models::Index ) - end # @@ -3833,27 +4191,30 @@ def get_index(database_id:, collection_id:, key:) # @param [String] key Index Key. # # @return [] - def delete_index(database_id:, collection_id:, key:) + def delete_index( + database_id:, + collection_id:, + key: + ) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3865,8 +4226,6 @@ def delete_index(database_id:, collection_id:, key:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/documents_db.rb b/lib/appwrite/services/documents_db.rb new file mode 100644 index 0000000..4869c1f --- /dev/null +++ b/lib/appwrite/services/documents_db.rb @@ -0,0 +1,1683 @@ +# frozen_string_literal: true + +module Appwrite + class DocumentsDB < Service + def initialize(client) + @client = client + end + + # Get a list of all databases from the current Appwrite project. You can use + # the search parameter to filter your results. + # + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [DatabaseList] + def list( + queries: nil, + total: nil + ) + api_path = '/documentsdb' + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseList + ) + end + + # Create a new Database. + # + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database name. Max length: 128 chars. + # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [String] specification Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + # + # @return [Database] + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/documentsdb' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/documentsdb/specifications' + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseSpecificationList + ) + end + + # List transactions across all databases. + # + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + # + # @return [TransactionList] + def list_transactions( + queries: nil + ) + api_path = '/documentsdb/transactions' + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::TransactionList + ) + end + + # Create a new transaction. + # + # @param [Integer] ttl Seconds before the transaction expires. + # + # @return [Transaction] + def create_transaction( + ttl: nil + ) + api_path = '/documentsdb/transactions' + + api_params = { + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Get a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [Transaction] + def get_transaction( + transaction_id: + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Update a transaction, to either commit or roll back its operations. + # + # @param [String] transaction_id Transaction ID. + # @param [] commit Commit transaction? + # @param [] rollback Rollback transaction? + # + # @return [Transaction] + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + commit: commit, + rollback: rollback, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Delete a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [] + def delete_transaction( + transaction_id: + ) + api_path = '/documentsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Create multiple operations in a single transaction. + # + # @param [String] transaction_id Transaction ID. + # @param [Array] operations Array of staged operations. + # + # @return [Transaction] + def create_operations( + transaction_id:, + operations: nil + ) + api_path = '/documentsdb/transactions/{transactionId}/operations' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + operations: operations, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Get a database by its unique ID. This endpoint response returns a JSON + # object with the database metadata. + # + # @param [String] database_id Database ID. + # + # @return [Database] + def get( + database_id: + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # Update a database by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] name Database name. Max length: 128 chars. + # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [String] specification Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + # + # @return [Database] + def update( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # Delete a database by its unique ID. Only API keys with with databases.write + # scope can delete a database. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/documentsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Get a list of all collections that belong to the provided databaseId. You + # can use the search parameter to filter your results. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [CollectionList] + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) + api_path = '/documentsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + search: search, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::CollectionList + ) + end + + # Create a new Collection. Before using this route, you should create a new + # database resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + # + # @return [Collection] + def create_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + attributes: nil, + indexes: nil + ) + api_path = '/documentsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + collectionId: collection_id, + name: name, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + attributes: attributes, + indexes: indexes, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Collection + ) + end + + # Get a collection by its unique ID. This endpoint response returns a JSON + # object with the collection metadata. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [Collection] + def get_collection( + database_id:, + collection_id: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Collection + ) + end + + # Update a collection by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + # + # @return [Collection] + def update_collection( + database_id:, + collection_id:, + name:, + permissions: nil, + document_security: nil, + enabled: nil, + purge: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + purge: purge, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Collection + ) + end + + # Delete a collection by its unique ID. Only users with write permissions + # have access to delete this resource. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [] + def delete_collection( + database_id:, + collection_id: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Get a list of all the user's documents in a given collection. You can use + # the query params to filter your results. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Create a new Document. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Hash] data Document data as JSON object. + # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # + # @return [Document] + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + documentId: document_id, + data: data, + permissions: permissions, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Create new Documents. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [Array] documents Array of documents data as JSON objects. + # + # @return [DocumentList] + def create_documents( + database_id:, + collection_id:, + documents: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Create or update Documents. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Array] documents Array of document data as JSON objects. May contain partial documents. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Update all documents that match your queries, if no queries are submitted + # then all documents are updated. You can pass only specific fields to be + # updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + data: data, + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Bulk delete documents using queries, if no queries are passed then all + # documents are deleted. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Get a document by its unique ID. This endpoint response returns a JSON + # object with the document data. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # + # @return [Document] + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Create or update a Document. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Update a document by its unique ID. Using the patch method you can pass + # only specific fields that will get updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Delete a document by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [] + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Decrement a specific column of a row by a given value. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [String] attribute Attribute key. + # @param [Float] value Value to decrement the attribute by. The value must be a number. + # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def decrement_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + min: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + min: min, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Increment a specific column of a row by a given value. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [String] attribute Attribute key. + # @param [Float] value Value to increment the attribute by. The value must be a number. + # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def increment_document_attribute( + database_id:, + collection_id:, + document_id:, + attribute:, + value: nil, + max: nil, + transaction_id: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + max: max, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # List indexes in the collection. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [IndexList] + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::IndexList + ) + end + + # Creates an index on the attributes listed. Your index should include all + # the attributes you will query in a single request. + # Attributes can be `key`, `fulltext`, and `unique`. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # @param [DocumentsDBIndexType] type Index type. + # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed. + # @param [Array] lengths Length of index. Maximum of 100 + # + # @return [Index] + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + if attributes.nil? + raise Appwrite::Exception.new('Missing required parameter: "attributes"') + end + + api_params = { + key: key, + type: type, + attributes: attributes, + orders: orders, + lengths: lengths, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Index + ) + end + + # Get index by ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [Index] + def get_index( + database_id:, + collection_id:, + key: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Index + ) + end + + # Delete an index. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [] + def delete_index( + database_id:, + collection_id:, + key: + ) + api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/documentsdb/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/documentsdb/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseOperationList + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/documentsdb/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseReplicas + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/documentsdb/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseStatus + ) + end + end +end diff --git a/lib/appwrite/services/embeddings.rb b/lib/appwrite/services/embeddings.rb index 5056314..3b7003d 100644 --- a/lib/appwrite/services/embeddings.rb +++ b/lib/appwrite/services/embeddings.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Embeddings < Service - def initialize(client) @client = client end @@ -10,24 +9,27 @@ def initialize(client) # Generate vector embeddings for an array of text using the selected # embedding model. Use the returned vectors to power semantic search and # similarity queries against your vector collections. - # + # # # @param [Array] texts Array of text to generate embeddings. # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings. # # @return [EmbeddingList] - def create_text_embeddings(texts:, model: nil) + def create_text_embeddings( + texts:, + model: nil + ) api_path = '/embeddings/text' if texts.nil? - raise Appwrite::Exception.new('Missing required parameter: "texts"') + raise Appwrite::Exception.new('Missing required parameter: "texts"') end api_params = { texts: texts, model: model, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -41,8 +43,6 @@ def create_text_embeddings(texts:, model: nil) params: api_params, response_type: Models::EmbeddingList ) - end - - end + end end diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index c0a16a7..0d51438 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Functions < Service - def initialize(client) @client = client end - # Get a list of all the project's functions. You can use the query params to + # Get a list of all the project's functions. You can use the query params to # filter your results. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [FunctionList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/functions' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,7 +39,6 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::FunctionList ) - end # Create a new function. You can pass a list of @@ -44,16 +46,16 @@ def list(queries: nil, search: nil, total: nil) # project users or team with access to execute the function using the client # API. # - # @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Function name. Max length: 128 chars. # @param [Runtime] runtime Execution runtime. # @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # @param [Array] events Events list. Maximum of 100 events are allowed. # @param [String] schedule Schedule CRON syntax. # @param [Integer] timeout Function maximum execution time in seconds. - # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. - # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". + # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. # @param [Array] scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment. @@ -68,19 +70,42 @@ def list(queries: nil, search: nil, total: nil) # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. # # @return [Function] - def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def create( + function_id:, + name:, + runtime:, + execute: nil, + events: nil, + schedule: nil, + timeout: nil, + enabled: nil, + logging: nil, + entrypoint: nil, + commands: nil, + scopes: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil + ) api_path = '/functions' if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if runtime.nil? - raise Appwrite::Exception.new('Missing required parameter: "runtime"') + raise Appwrite::Exception.new('Missing required parameter: "runtime"') end api_params = { @@ -107,7 +132,7 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -121,7 +146,6 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n params: api_params, response_type: Models::Function ) - end # Get a list of all runtimes that are currently active on your instance. @@ -131,9 +155,8 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n def list_runtimes() api_path = '/functions/runtimes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -146,7 +169,6 @@ def list_runtimes() params: api_params, response_type: Models::RuntimeList ) - end # List allowed function specifications for this instance. @@ -154,13 +176,15 @@ def list_runtimes() # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] - def list_specifications(type: nil) + def list_specifications( + type: nil + ) api_path = '/functions/specifications' api_params = { type: type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -173,7 +197,6 @@ def list_specifications(type: nil) params: api_params, response_type: Models::SpecificationList ) - end # Get a function by its unique ID. @@ -181,17 +204,18 @@ def list_specifications(type: nil) # @param [String] function_id Function ID. # # @return [Function] - def get(function_id:) + def get( + function_id: + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -204,7 +228,6 @@ def get(function_id:) params: api_params, response_type: Models::Function ) - end # Update function by its unique ID. @@ -216,9 +239,9 @@ def get(function_id:) # @param [Array] events Events list. Maximum of 100 events are allowed. # @param [String] schedule Schedule CRON syntax. # @param [Integer] timeout Maximum execution time in seconds. - # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster. - # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". + # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory". # @param [String] commands Build Commands. # @param [Array] scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed. # @param [String] installation_id Appwrite Installation ID for VCS (Version Controle System) deployment. @@ -233,16 +256,39 @@ def get(function_id:) # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. # # @return [Function] - def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def update( + function_id:, + name:, + runtime: nil, + execute: nil, + events: nil, + schedule: nil, + timeout: nil, + enabled: nil, + logging: nil, + entrypoint: nil, + commands: nil, + scopes: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -268,7 +314,7 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -282,7 +328,6 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul params: api_params, response_type: Models::Function ) - end # Delete a function by its unique ID. @@ -290,17 +335,18 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul # @param [String] function_id Function ID. # # @return [] - def delete(function_id:) + def delete( + function_id: + ) api_path = '/functions/{functionId}' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -312,7 +358,6 @@ def delete(function_id:) headers: api_headers, params: api_params, ) - end # Update the function active deployment. Use this endpoint to switch the code @@ -322,22 +367,25 @@ def delete(function_id:) # @param [String] deployment_id Deployment ID. # # @return [Function] - def update_function_deployment(function_id:, deployment_id:) + def update_function_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployment' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -351,10 +399,9 @@ def update_function_deployment(function_id:, deployment_id:) params: api_params, response_type: Models::Function ) - end - # Get a list of all the function's code deployments. You can use the query + # Get a list of all the function's code deployments. You can use the query # params to filter your results. # # @param [String] function_id Function ID. @@ -363,12 +410,17 @@ def update_function_deployment(function_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DeploymentList] - def list_deployments(function_id:, queries: nil, search: nil, total: nil) + def list_deployments( + function_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/functions/{functionId}/deployments' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -376,7 +428,7 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -389,19 +441,18 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DeploymentList ) - end # Create a new function code deployment. Use this endpoint to upload a new - # version of your code function. To execute your newly uploaded code, you'll - # need to update the function's deployment to use your new deployment UID. - # + # version of your code function. To execute your newly uploaded code, you'll + # need to update the function's deployment to use your new deployment UID. + # # This endpoint accepts a tar.gz file compressed with your code. Make sure to # include any dependencies your code has within the compressed file. You can # learn more about code packaging in the [Appwrite Cloud Functions # tutorial](https://appwrite.io/docs/functions). - # - # Use the "command" param to set the entrypoint used to execute your code. + # + # Use the "command" param to set the entrypoint used to execute your code. # # @param [String] function_id Function ID. # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -410,20 +461,27 @@ def list_deployments(function_id:, queries: nil, search: nil, total: nil) # @param [String] commands Build Commands. # # @return [Deployment] - def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: nil, on_progress: nil) + def create_deployment( + function_id:, + code:, + activate:, + entrypoint: nil, + commands: nil, + on_progress: nil + ) api_path = '/functions/{functionId}/deployments' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end if activate.nil? - raise Appwrite::Exception.new('Missing required parameter: "activate"') + raise Appwrite::Exception.new('Missing required parameter: "activate"') end api_params = { @@ -432,7 +490,7 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: code: code, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -451,37 +509,40 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: on_progress: on_progress, response_type: Models::Deployment ) - end # Create a new build for an existing function deployment. This endpoint # allows you to rebuild a deployment with the updated function configuration, # including its entrypoint and build commands if they have been modified. The # build process will be queued and executed asynchronously. The original - # deployment's code will be preserved and used for the new build. + # deployment's code will be preserved and used for the new build. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. # @param [String] build_id Build unique ID. # # @return [Deployment] - def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) + def create_duplicate_deployment( + function_id:, + deployment_id:, + build_id: nil + ) api_path = '/functions/{functionId}/deployments/duplicate' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, buildId: build_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -495,11 +556,10 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) params: api_params, response_type: Models::Deployment ) - end # Create a deployment based on a template. - # + # # Use this endpoint with combination of # [listTemplates](https://appwrite.io/docs/products/functions/templates) to # find the template details. @@ -513,32 +573,40 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_template_deployment(function_id:, repository:, owner:, root_directory:, type:, reference:, activate: nil) + def create_template_deployment( + function_id:, + repository:, + owner:, + root_directory:, + type:, + reference:, + activate: nil + ) api_path = '/functions/{functionId}/deployments/template' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if repository.nil? - raise Appwrite::Exception.new('Missing required parameter: "repository"') + raise Appwrite::Exception.new('Missing required parameter: "repository"') end if owner.nil? - raise Appwrite::Exception.new('Missing required parameter: "owner"') + raise Appwrite::Exception.new('Missing required parameter: "owner"') end if root_directory.nil? - raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') + raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -549,7 +617,7 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -563,11 +631,10 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory params: api_params, response_type: Models::Deployment ) - end # Create a deployment when a function is connected to VCS. - # + # # This endpoint lets you create deployment from a branch, commit, or a tag. # # @param [String] function_id Function ID. @@ -576,20 +643,25 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_vcs_deployment(function_id:, type:, reference:, activate: nil) + def create_vcs_deployment( + function_id:, + type:, + reference:, + activate: nil + ) api_path = '/functions/{functionId}/deployments/vcs' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -597,7 +669,7 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -611,7 +683,6 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) params: api_params, response_type: Models::Deployment ) - end # Get a function deployment by its unique ID. @@ -620,22 +691,24 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def get_deployment(function_id:, deployment_id:) + def get_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -648,7 +721,6 @@ def get_deployment(function_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Delete a code deployment by its unique ID. @@ -657,22 +729,24 @@ def get_deployment(function_id:, deployment_id:) # @param [String] deployment_id Deployment ID. # # @return [] - def delete_deployment(function_id:, deployment_id:) + def delete_deployment( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -684,37 +758,41 @@ def delete_deployment(function_id:, deployment_id:) headers: api_headers, params: api_params, ) - end # Get a function deployment content by its unique ID. The endpoint response - # return with a 'Content-Disposition: attachment' header that tells the + # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. - # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(function_id:, deployment_id:, type: nil, token: nil) + def get_deployment_download( + function_id:, + deployment_id:, + type: nil, + token: nil + ) api_path = '/functions/{functionId}/deployments/{deploymentId}/download' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { type: type, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -726,35 +804,36 @@ def get_deployment_download(function_id:, deployment_id:, type: nil, token: nil) headers: api_headers, params: api_params, ) - end # Cancel an ongoing function deployment build. If the build is already in - # progress, it will be stopped and marked as canceled. If the build hasn't + # progress, it will be stopped and marked as canceled. If the build hasn't # started yet, it will be marked as canceled without executing. You cannot - # cancel builds that have already completed (status 'ready') or failed. The + # cancel builds that have already completed (status 'ready') or failed. The # response includes the final build status and details. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def update_deployment_status(function_id:, deployment_id:) + def update_deployment_status( + function_id:, + deployment_id: + ) api_path = '/functions/{functionId}/deployments/{deploymentId}/status' .gsub('{functionId}', function_id) .gsub('{deploymentId}', deployment_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -768,7 +847,6 @@ def update_deployment_status(function_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Get a list of all the current user function execution logs. You can use the @@ -779,19 +857,23 @@ def update_deployment_status(function_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ExecutionList] - def list_executions(function_id:, queries: nil, total: nil) + def list_executions( + function_id:, + queries: nil, + total: nil + ) api_path = '/functions/{functionId}/executions' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -804,7 +886,6 @@ def list_executions(function_id:, queries: nil, total: nil) params: api_params, response_type: Models::ExecutionList ) - end # Trigger a function execution. The returned object will return you the @@ -821,12 +902,20 @@ def list_executions(function_id:, queries: nil, total: nil) # @param [String] scheduled_at Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. # # @return [Execution] - def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: nil, headers: nil, scheduled_at: nil) + def create_execution( + function_id:, + body: nil, + async: nil, + xpath: nil, + method: nil, + headers: nil, + scheduled_at: nil + ) api_path = '/functions/{functionId}/executions' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -837,7 +926,7 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni headers: headers, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -851,7 +940,6 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni params: api_params, response_type: Models::Execution ) - end # Get a function execution log by its unique ID. @@ -860,22 +948,24 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni # @param [String] execution_id Execution ID. # # @return [Execution] - def get_execution(function_id:, execution_id:) + def get_execution( + function_id:, + execution_id: + ) api_path = '/functions/{functionId}/executions/{executionId}' .gsub('{functionId}', function_id) .gsub('{executionId}', execution_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if execution_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "executionId"') + raise Appwrite::Exception.new('Missing required parameter: "executionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -888,7 +978,6 @@ def get_execution(function_id:, execution_id:) params: api_params, response_type: Models::Execution ) - end # Delete a function execution by its unique ID. @@ -897,22 +986,24 @@ def get_execution(function_id:, execution_id:) # @param [String] execution_id Execution ID. # # @return [] - def delete_execution(function_id:, execution_id:) + def delete_execution( + function_id:, + execution_id: + ) api_path = '/functions/{functionId}/executions/{executionId}' .gsub('{functionId}', function_id) .gsub('{executionId}', execution_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if execution_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "executionId"') + raise Appwrite::Exception.new('Missing required parameter: "executionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -924,7 +1015,6 @@ def delete_execution(function_id:, execution_id:) headers: api_headers, params: api_params, ) - end # Get a list of all variables of a specific function. @@ -934,19 +1024,23 @@ def delete_execution(function_id:, execution_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(function_id:, queries: nil, total: nil) + def list_variables( + function_id:, + queries: nil, + total: nil + ) api_path = '/functions/{functionId}/variables' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -959,37 +1053,42 @@ def list_variables(function_id:, queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new function environment variable. These variables can be accessed # in the function at runtime as environment variables. # # @param [String] function_id Function unique ID. - # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime. # # @return [Variable] - def create_variable(function_id:, variable_id:, key:, value:, secret: nil) + def create_variable( + function_id:, + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/functions/{functionId}/variables' .gsub('{functionId}', function_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -998,7 +1097,7 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1012,7 +1111,6 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end # Get a variable by its unique ID. @@ -1021,22 +1119,24 @@ def create_variable(function_id:, variable_id:, key:, value:, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(function_id:, variable_id:) + def get_variable( + function_id:, + variable_id: + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1049,29 +1149,34 @@ def get_variable(function_id:, variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] function_id Function unique ID. # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime. # # @return [Variable] - def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + function_id:, + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -1079,7 +1184,7 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1093,7 +1198,6 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni params: api_params, response_type: Models::Variable ) - end # Delete a variable by its unique ID. @@ -1102,22 +1206,24 @@ def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: ni # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(function_id:, variable_id:) + def delete_variable( + function_id:, + variable_id: + ) api_path = '/functions/{functionId}/variables/{variableId}' .gsub('{functionId}', function_id) .gsub('{variableId}', variable_id) if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1129,8 +1235,6 @@ def delete_variable(function_id:, variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/graphql.rb b/lib/appwrite/services/graphql.rb index 2ba03f5..210f528 100644 --- a/lib/appwrite/services/graphql.rb +++ b/lib/appwrite/services/graphql.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Graphql < Service - def initialize(client) @client = client end @@ -12,17 +11,19 @@ def initialize(client) # @param [Hash] query The query or queries to execute. # # @return [] - def query(query:) + def query( + query: + ) api_path = '/graphql' if query.nil? - raise Appwrite::Exception.new('Missing required parameter: "query"') + raise Appwrite::Exception.new('Missing required parameter: "query"') end api_params = { query: query, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', @@ -36,7 +37,6 @@ def query(query:) headers: api_headers, params: api_params, ) - end # Execute a GraphQL mutation. @@ -44,17 +44,19 @@ def query(query:) # @param [Hash] query The query or queries to execute. # # @return [] - def mutation(query:) + def mutation( + query: + ) api_path = '/graphql/mutation' if query.nil? - raise Appwrite::Exception.new('Missing required parameter: "query"') + raise Appwrite::Exception.new('Missing required parameter: "query"') end api_params = { query: query, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "x-sdk-graphql": 'true', @@ -68,8 +70,6 @@ def mutation(query:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/locale.rb b/lib/appwrite/services/locale.rb index 6c76a95..3728751 100644 --- a/lib/appwrite/services/locale.rb +++ b/lib/appwrite/services/locale.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Locale < Service - def initialize(client) @client = client end @@ -11,7 +10,7 @@ def initialize(client) # country code, country name, continent name, continent code, ip address and # suggested currency. You can use the locale header to get the data in a # supported language. - # + # # ([IP Geolocation by DB-IP](https://db-ip.com)) # # @@ -19,9 +18,8 @@ def initialize(client) def get() api_path = '/locale' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -34,7 +32,6 @@ def get() params: api_params, response_type: Models::Locale ) - end # List of all locale codes in [ISO @@ -45,9 +42,8 @@ def get() def list_codes() api_path = '/locale/codes' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -60,7 +56,6 @@ def list_codes() params: api_params, response_type: Models::LocaleCodeList ) - end # List of all continents. You can use the locale header to get the data in a @@ -71,9 +66,8 @@ def list_codes() def list_continents() api_path = '/locale/continents' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -86,7 +80,6 @@ def list_continents() params: api_params, response_type: Models::ContinentList ) - end # List of all countries. You can use the locale header to get the data in a @@ -97,9 +90,8 @@ def list_continents() def list_countries() api_path = '/locale/countries' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -112,7 +104,6 @@ def list_countries() params: api_params, response_type: Models::CountryList ) - end # List of all countries that are currently members of the EU. You can use the @@ -123,9 +114,8 @@ def list_countries() def list_countries_eu() api_path = '/locale/countries/eu' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -138,7 +128,6 @@ def list_countries_eu() params: api_params, response_type: Models::CountryList ) - end # List of all countries phone codes. You can use the locale header to get the @@ -149,9 +138,8 @@ def list_countries_eu() def list_countries_phones() api_path = '/locale/countries/phones' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -164,7 +152,6 @@ def list_countries_phones() params: api_params, response_type: Models::PhoneList ) - end # List of all currencies, including currency symbol, name, plural, and @@ -176,9 +163,8 @@ def list_countries_phones() def list_currencies() api_path = '/locale/currencies' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -191,7 +177,6 @@ def list_currencies() params: api_params, response_type: Models::CurrencyList ) - end # List of all languages classified by ISO 639-1 including 2-letter code, name @@ -202,9 +187,8 @@ def list_currencies() def list_languages() api_path = '/locale/languages' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -217,8 +201,6 @@ def list_languages() params: api_params, response_type: Models::LanguageList ) - end - - end + end end diff --git a/lib/appwrite/services/messaging.rb b/lib/appwrite/services/messaging.rb index d982aa1..30ab729 100644 --- a/lib/appwrite/services/messaging.rb +++ b/lib/appwrite/services/messaging.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Messaging < Service - def initialize(client) @client = client end @@ -14,7 +13,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MessageList] - def list_messages(queries: nil, search: nil, total: nil) + def list_messages( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/messages' api_params = { @@ -22,7 +25,7 @@ def list_messages(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -35,12 +38,11 @@ def list_messages(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MessageList ) - end # Create a new email message. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] subject Email Subject. # @param [String] content Email Content. # @param [Array] topics List of Topic IDs. @@ -48,25 +50,38 @@ def list_messages(queries: nil, search: nil, total: nil) # @param [Array] targets List of Targets IDs. # @param [Array] cc Array of target IDs to be added as CC. # @param [Array] bcc Array of target IDs to be added as BCC. - # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. + # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [] draft Is message a draft # @param [] html Is content of type HTML # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def create_email(message_id:, subject:, content:, topics: nil, users: nil, targets: nil, cc: nil, bcc: nil, attachments: nil, draft: nil, html: nil, scheduled_at: nil) + def create_email( + message_id:, + subject:, + content:, + topics: nil, + users: nil, + targets: nil, + cc: nil, + bcc: nil, + attachments: nil, + draft: nil, + html: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/email' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end if subject.nil? - raise Appwrite::Exception.new('Missing required parameter: "subject"') + raise Appwrite::Exception.new('Missing required parameter: "subject"') end if content.nil? - raise Appwrite::Exception.new('Missing required parameter: "content"') + raise Appwrite::Exception.new('Missing required parameter: "content"') end api_params = { @@ -83,7 +98,7 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe html: html, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -97,13 +112,12 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe params: api_params, response_type: Models::Message ) - end # Update an email message by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -116,15 +130,28 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe # @param [Array] cc Array of target IDs to be added as CC. # @param [Array] bcc Array of target IDs to be added as BCC. # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. + # @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. # # @return [Message] - def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil, attachments: nil) + def update_email( + message_id:, + topics: nil, + users: nil, + targets: nil, + subject: nil, + content: nil, + draft: nil, + html: nil, + cc: nil, + bcc: nil, + scheduled_at: nil, + attachments: nil + ) api_path = '/messaging/messages/email/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -140,7 +167,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni scheduledAt: scheduled_at, attachments: attachments, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -154,12 +181,11 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni params: api_params, response_type: Models::Message ) - end # Create a new push notification. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] title Title for push notification. # @param [String] body Body for push notification. # @param [Array] topics List of Topic IDs. @@ -167,7 +193,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni # @param [Array] targets List of Targets IDs. # @param [Hash] data Additional key-value pair data for push notification. # @param [String] action Action for push notification. - # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. + # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [String] icon Icon for push notification. Available only for Android and Web Platform. # @param [String] sound Sound for push notification. Available only for Android and iOS Platform. # @param [String] color Color for push notification. Available only for Android Platform. @@ -177,14 +203,34 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # @param [] content_available If set to true, the notification will be delivered in the background. Available only for iOS Platform. # @param [] critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - # @param [MessagePriority] priority Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + # @param [MessagePriority] priority Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. # # @return [Message] - def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, targets: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil, content_available: nil, critical: nil, priority: nil) + def create_push( + message_id:, + title: nil, + body: nil, + topics: nil, + users: nil, + targets: nil, + data: nil, + action: nil, + image: nil, + icon: nil, + sound: nil, + color: nil, + tag: nil, + badge: nil, + draft: nil, + scheduled_at: nil, + content_available: nil, + critical: nil, + priority: nil + ) api_path = '/messaging/messages/push' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -208,7 +254,7 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar critical: critical, priority: priority, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -222,13 +268,12 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar params: api_params, response_type: Models::Message ) - end # Update a push notification by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -238,7 +283,7 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar # @param [String] body Body for push notification. # @param [Hash] data Additional Data for push notification. # @param [String] action Action for push notification. - # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. + # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. # @param [String] icon Icon for push notification. Available only for Android and Web platforms. # @param [String] sound Sound for push notification. Available only for Android and iOS platforms. # @param [String] color Color for push notification. Available only for Android platforms. @@ -248,15 +293,35 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # @param [] content_available If set to true, the notification will be delivered in the background. Available only for iOS Platform. # @param [] critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - # @param [MessagePriority] priority Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + # @param [MessagePriority] priority Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. # # @return [Message] - def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, body: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil, content_available: nil, critical: nil, priority: nil) + def update_push( + message_id:, + topics: nil, + users: nil, + targets: nil, + title: nil, + body: nil, + data: nil, + action: nil, + image: nil, + icon: nil, + sound: nil, + color: nil, + tag: nil, + badge: nil, + draft: nil, + scheduled_at: nil, + content_available: nil, + critical: nil, + priority: nil + ) api_path = '/messaging/messages/push/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -279,7 +344,7 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, critical: critical, priority: priority, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -293,12 +358,11 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, params: api_params, response_type: Models::Message ) - end # Create a new SMS message. # - # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] content SMS Content. # @param [Array] topics List of Topic IDs. # @param [Array] users List of User IDs. @@ -307,15 +371,23 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, draft: nil, scheduled_at: nil) + def create_sms( + message_id:, + content:, + topics: nil, + users: nil, + targets: nil, + draft: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/sms' if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end if content.nil? - raise Appwrite::Exception.new('Missing required parameter: "content"') + raise Appwrite::Exception.new('Missing required parameter: "content"') end api_params = { @@ -327,7 +399,7 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra draft: draft, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -341,13 +413,12 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra params: api_params, response_type: Models::Message ) - end # Update an SMS message by its unique ID. This endpoint only works on # messages that are in draft status. Messages that are already processing, # sent, or failed cannot be updated. - # + # # # @param [String] message_id Message ID. # @param [Array] topics List of Topic IDs. @@ -358,12 +429,20 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. # # @return [Message] - def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, draft: nil, scheduled_at: nil) + def update_sms( + message_id:, + topics: nil, + users: nil, + targets: nil, + content: nil, + draft: nil, + scheduled_at: nil + ) api_path = '/messaging/messages/sms/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { @@ -374,7 +453,7 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, draft: draft, scheduledAt: scheduled_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -388,26 +467,26 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, params: api_params, response_type: Models::Message ) - end # Get a message by its unique ID. - # + # # # @param [String] message_id Message ID. # # @return [Message] - def get_message(message_id:) + def get_message( + message_id: + ) api_path = '/messaging/messages/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -420,7 +499,6 @@ def get_message(message_id:) params: api_params, response_type: Models::Message ) - end # Delete a message. If the message is not a draft or scheduled, but has been @@ -429,17 +507,18 @@ def get_message(message_id:) # @param [String] message_id Message ID. # # @return [] - def delete(message_id:) + def delete( + message_id: + ) api_path = '/messaging/messages/{messageId}' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -451,7 +530,6 @@ def delete(message_id:) headers: api_headers, params: api_params, ) - end # Get a list of the targets associated with a message. @@ -461,19 +539,23 @@ def delete(message_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TargetList] - def list_targets(message_id:, queries: nil, total: nil) + def list_targets( + message_id:, + queries: nil, + total: nil + ) api_path = '/messaging/messages/{messageId}/targets' .gsub('{messageId}', message_id) if message_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "messageId"') + raise Appwrite::Exception.new('Missing required parameter: "messageId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -486,7 +568,6 @@ def list_targets(message_id:, queries: nil, total: nil) params: api_params, response_type: Models::TargetList ) - end # Get a list of all providers from the current Appwrite project. @@ -496,7 +577,11 @@ def list_targets(message_id:, queries: nil, total: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProviderList] - def list_providers(queries: nil, search: nil, total: nil) + def list_providers( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/providers' api_params = { @@ -504,7 +589,7 @@ def list_providers(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -517,12 +602,11 @@ def list_providers(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::ProviderList ) - end # Create a new Apple Push Notification service provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] auth_key APNS authentication key. # @param [String] auth_key_id APNS authentication key ID. @@ -532,15 +616,24 @@ def list_providers(queries: nil, search: nil, total: nil) # @param [] enabled Set as enabled. # # @return [Provider] - def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil, enabled: nil) + def create_apns_provider( + provider_id:, + name:, + auth_key: nil, + auth_key_id: nil, + team_id: nil, + bundle_id: nil, + sandbox: nil, + enabled: nil + ) api_path = '/messaging/providers/apns' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -553,7 +646,7 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t sandbox: sandbox, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -567,7 +660,6 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t params: api_params, response_type: Models::Provider ) - end # Update a Apple Push Notification service provider by its unique ID. @@ -582,12 +674,21 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t # @param [] sandbox Use APNS sandbox environment. # # @return [Provider] - def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil) + def update_apns_provider( + provider_id:, + name: nil, + enabled: nil, + auth_key: nil, + auth_key_id: nil, + team_id: nil, + bundle_id: nil, + sandbox: nil + ) api_path = '/messaging/providers/apns/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -599,7 +700,7 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a bundleId: bundle_id, sandbox: sandbox, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -613,26 +714,30 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a params: api_params, response_type: Models::Provider ) - end # Create a new Firebase Cloud Messaging provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [Hash] service_account_json FCM service account JSON. # @param [] enabled Set as enabled. # # @return [Provider] - def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: nil) + def create_fcm_provider( + provider_id:, + name:, + service_account_json: nil, + enabled: nil + ) api_path = '/messaging/providers/fcm' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -641,7 +746,7 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: serviceAccountJSON: service_account_json, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -655,7 +760,6 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: params: api_params, response_type: Models::Provider ) - end # Update a Firebase Cloud Messaging provider by its unique ID. @@ -666,12 +770,17 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: # @param [Hash] service_account_json FCM service account JSON. # # @return [Provider] - def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_json: nil) + def update_fcm_provider( + provider_id:, + name: nil, + enabled: nil, + service_account_json: nil + ) api_path = '/messaging/providers/fcm/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -679,7 +788,7 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j enabled: enabled, serviceAccountJSON: service_account_json, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -693,12 +802,11 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j params: api_params, response_type: Models::Provider ) - end # Create a new Mailgun provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Mailgun API Key. # @param [String] domain Mailgun Domain. @@ -710,15 +818,26 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j # @param [] enabled Set as enabled. # # @return [Provider] - def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_eu_region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_mailgun_provider( + provider_id:, + name:, + api_key: nil, + domain: nil, + is_eu_region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/mailgun' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -733,7 +852,7 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -747,7 +866,6 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e params: api_params, response_type: Models::Provider ) - end # Update a Mailgun provider by its unique ID. @@ -764,12 +882,23 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email. # # @return [Provider] - def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, is_eu_region: nil, enabled: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_mailgun_provider( + provider_id:, + name: nil, + api_key: nil, + domain: nil, + is_eu_region: nil, + enabled: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/mailgun/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -783,7 +912,7 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -797,12 +926,11 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, params: api_params, response_type: Models::Provider ) - end # Create a new MSG91 provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] template_id Msg91 template ID # @param [String] sender_id Msg91 sender ID. @@ -810,15 +938,22 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, auth_key: nil, enabled: nil) + def create_msg91_provider( + provider_id:, + name:, + template_id: nil, + sender_id: nil, + auth_key: nil, + enabled: nil + ) api_path = '/messaging/providers/msg91' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -829,7 +964,7 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, authKey: auth_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -843,7 +978,6 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, params: api_params, response_type: Models::Provider ) - end # Update a MSG91 provider by its unique ID. @@ -856,12 +990,19 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, # @param [String] auth_key Msg91 auth key. # # @return [Provider] - def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: nil, sender_id: nil, auth_key: nil) + def update_msg91_provider( + provider_id:, + name: nil, + enabled: nil, + template_id: nil, + sender_id: nil, + auth_key: nil + ) api_path = '/messaging/providers/msg91/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -871,7 +1012,7 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni senderId: sender_id, authKey: auth_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -885,12 +1026,11 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni params: api_params, response_type: Models::Provider ) - end # Create a new Resend provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Resend API key. # @param [String] from_name Sender Name. @@ -900,15 +1040,24 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni # @param [] enabled Set as enabled. # # @return [Provider] - def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_resend_provider( + provider_id:, + name:, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/resend' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -921,7 +1070,7 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -935,7 +1084,6 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr params: api_params, response_type: Models::Provider ) - end # Update a Resend provider by its unique ID. @@ -950,12 +1098,21 @@ def create_resend_provider(provider_id:, name:, api_key: nil, from_name: nil, fr # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_resend_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/resend/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -967,7 +1124,7 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -981,12 +1138,11 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, params: api_params, response_type: Models::Provider ) - end # Create a new Sendgrid provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] api_key Sendgrid API key. # @param [String] from_name Sender Name. @@ -996,15 +1152,24 @@ def update_resend_provider(provider_id:, name: nil, enabled: nil, api_key: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_sendgrid_provider( + provider_id:, + name:, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/sendgrid' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1017,7 +1182,7 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1031,7 +1196,6 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, params: api_params, response_type: Models::Provider ) - end # Update a Sendgrid provider by its unique ID. @@ -1046,12 +1210,21 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_sendgrid_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/sendgrid/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1063,7 +1236,7 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1077,12 +1250,11 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil params: api_params, response_type: Models::Provider ) - end # Create a new Amazon SES provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. # @param [String] access_key AWS access key ID. # @param [String] secret_key AWS secret access key. @@ -1094,15 +1266,26 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil # @param [] enabled Set as enabled. # # @return [Provider] - def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_ses_provider( + provider_id:, + name:, + access_key: nil, + secret_key: nil, + region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/ses' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1117,7 +1300,7 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1131,7 +1314,6 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r params: api_params, response_type: Models::Provider ) - end # Update an Amazon SES provider by its unique ID. @@ -1148,12 +1330,23 @@ def create_ses_provider(provider_id:, name:, access_key: nil, secret_key: nil, r # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email. # # @return [Provider] - def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, secret_key: nil, region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil) + def update_ses_provider( + provider_id:, + name: nil, + enabled: nil, + access_key: nil, + secret_key: nil, + region: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil + ) api_path = '/messaging/providers/ses/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1167,7 +1360,7 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, replyToName: reply_to_name, replyToEmail: reply_to_email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1181,18 +1374,17 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, params: api_params, response_type: Models::Provider ) - end # Create a new SMTP provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. # @param [Integer] port The default SMTP server port. # @param [String] username Authentication username. # @param [String] password Authentication password. - # @param [SmtpEncryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls' + # @param [SmtpEncryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls' # @param [] auto_tls Enable SMTP AutoTLS feature. # @param [String] mailer The value to use for the X-Mailer header. # @param [String] from_name Sender Name. @@ -1202,19 +1394,34 @@ def update_ses_provider(provider_id:, name: nil, enabled: nil, access_key: nil, # @param [] enabled Set as enabled. # # @return [Provider] - def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def create_smtp_provider( + provider_id:, + name:, + host:, + port: nil, + username: nil, + password: nil, + encryption: nil, + auto_tls: nil, + mailer: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/smtp' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if host.nil? - raise Appwrite::Exception.new('Missing required parameter: "host"') + raise Appwrite::Exception.new('Missing required parameter: "host"') end api_params = { @@ -1233,7 +1440,7 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1247,18 +1454,17 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p params: api_params, response_type: Models::Provider ) - end # Update a SMTP provider by its unique ID. # # @param [String] provider_id Provider ID. # @param [String] name Provider name. - # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. # @param [Integer] port SMTP port. # @param [String] username Authentication username. # @param [String] password Authentication password. - # @param [SmtpEncryption] encryption Encryption type. Can be 'ssl' or 'tls' + # @param [SmtpEncryption] encryption Encryption type. Can be 'ssl' or 'tls' # @param [] auto_tls Enable SMTP AutoTLS feature. # @param [String] mailer The value to use for the X-Mailer header. # @param [String] from_name Sender Name. @@ -1268,12 +1474,27 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p # @param [] enabled Set as enabled. # # @return [Provider] - def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil) + def update_smtp_provider( + provider_id:, + name: nil, + host: nil, + port: nil, + username: nil, + password: nil, + encryption: nil, + auto_tls: nil, + mailer: nil, + from_name: nil, + from_email: nil, + reply_to_name: nil, + reply_to_email: nil, + enabled: nil + ) api_path = '/messaging/providers/smtp/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1291,7 +1512,7 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username replyToEmail: reply_to_email, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1305,28 +1526,34 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username params: api_params, response_type: Models::Provider ) - end # Create a new Telesign provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] customer_id Telesign customer ID. # @param [String] api_key Telesign API key. # @param [] enabled Set as enabled. # # @return [Provider] - def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, api_key: nil, enabled: nil) + def create_telesign_provider( + provider_id:, + name:, + from: nil, + customer_id: nil, + api_key: nil, + enabled: nil + ) api_path = '/messaging/providers/telesign' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1337,7 +1564,7 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a apiKey: api_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1351,7 +1578,6 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a params: api_params, response_type: Models::Provider ) - end # Update a Telesign provider by its unique ID. @@ -1364,12 +1590,19 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a # @param [String] from Sender number. # # @return [Provider] - def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: nil, api_key: nil, from: nil) + def update_telesign_provider( + provider_id:, + name: nil, + enabled: nil, + customer_id: nil, + api_key: nil, + from: nil + ) api_path = '/messaging/providers/telesign/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1379,7 +1612,7 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: apiKey: api_key, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1393,28 +1626,34 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: params: api_params, response_type: Models::Provider ) - end # Create a new Textmagic provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] username Textmagic username. # @param [String] api_key Textmagic apiKey. # @param [] enabled Set as enabled. # # @return [Provider] - def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api_key: nil, enabled: nil) + def create_textmagic_provider( + provider_id:, + name:, + from: nil, + username: nil, + api_key: nil, + enabled: nil + ) api_path = '/messaging/providers/textmagic' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1425,7 +1664,7 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api apiKey: api_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1439,7 +1678,6 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api params: api_params, response_type: Models::Provider ) - end # Update a Textmagic provider by its unique ID. @@ -1452,12 +1690,19 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api # @param [String] from Sender number. # # @return [Provider] - def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: nil, api_key: nil, from: nil) + def update_textmagic_provider( + provider_id:, + name: nil, + enabled: nil, + username: nil, + api_key: nil, + from: nil + ) api_path = '/messaging/providers/textmagic/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1467,7 +1712,7 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n apiKey: api_key, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1481,28 +1726,34 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n params: api_params, response_type: Models::Provider ) - end # Create a new Twilio provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] account_sid Twilio account secret ID. # @param [String] auth_token Twilio authentication token. # @param [] enabled Set as enabled. # # @return [Provider] - def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, auth_token: nil, enabled: nil) + def create_twilio_provider( + provider_id:, + name:, + from: nil, + account_sid: nil, + auth_token: nil, + enabled: nil + ) api_path = '/messaging/providers/twilio' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1513,7 +1764,7 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut authToken: auth_token, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1527,7 +1778,6 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut params: api_params, response_type: Models::Provider ) - end # Update a Twilio provider by its unique ID. @@ -1540,12 +1790,19 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut # @param [String] from Sender number. # # @return [Provider] - def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: nil, auth_token: nil, from: nil) + def update_twilio_provider( + provider_id:, + name: nil, + enabled: nil, + account_sid: nil, + auth_token: nil, + from: nil + ) api_path = '/messaging/providers/twilio/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1555,7 +1812,7 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n authToken: auth_token, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1569,28 +1826,34 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n params: api_params, response_type: Models::Provider ) - end # Create a new Vonage provider. # - # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Provider name. - # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] api_key Vonage API key. # @param [String] api_secret Vonage API secret. # @param [] enabled Set as enabled. # # @return [Provider] - def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_secret: nil, enabled: nil) + def create_vonage_provider( + provider_id:, + name:, + from: nil, + api_key: nil, + api_secret: nil, + enabled: nil + ) api_path = '/messaging/providers/vonage' if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1601,7 +1864,7 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec apiSecret: api_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1615,7 +1878,6 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec params: api_params, response_type: Models::Provider ) - end # Update a Vonage provider by its unique ID. @@ -1628,12 +1890,19 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec # @param [String] from Sender number. # # @return [Provider] - def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_secret: nil, from: nil) + def update_vonage_provider( + provider_id:, + name: nil, + enabled: nil, + api_key: nil, + api_secret: nil, + from: nil + ) api_path = '/messaging/providers/vonage/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end api_params = { @@ -1643,7 +1912,7 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, apiSecret: api_secret, from: from, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1657,26 +1926,26 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, params: api_params, response_type: Models::Provider ) - end # Get a provider by its unique ID. - # + # # # @param [String] provider_id Provider ID. # # @return [Provider] - def get_provider(provider_id:) + def get_provider( + provider_id: + ) api_path = '/messaging/providers/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1689,7 +1958,6 @@ def get_provider(provider_id:) params: api_params, response_type: Models::Provider ) - end # Delete a provider by its unique ID. @@ -1697,17 +1965,18 @@ def get_provider(provider_id:) # @param [String] provider_id Provider ID. # # @return [] - def delete_provider(provider_id:) + def delete_provider( + provider_id: + ) api_path = '/messaging/providers/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1719,7 +1988,6 @@ def delete_provider(provider_id:) headers: api_headers, params: api_params, ) - end # Get a list of all topics from the current Appwrite project. @@ -1729,7 +1997,11 @@ def delete_provider(provider_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TopicList] - def list_topics(queries: nil, search: nil, total: nil) + def list_topics( + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/topics' api_params = { @@ -1737,7 +2009,7 @@ def list_topics(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1750,7 +2022,6 @@ def list_topics(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TopicList ) - end # Create a new topic. @@ -1760,15 +2031,19 @@ def list_topics(queries: nil, search: nil, total: nil) # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # # @return [Topic] - def create_topic(topic_id:, name:, subscribe: nil) + def create_topic( + topic_id:, + name:, + subscribe: nil + ) api_path = '/messaging/topics' if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -1776,7 +2051,7 @@ def create_topic(topic_id:, name:, subscribe: nil) name: name, subscribe: subscribe, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1790,26 +2065,26 @@ def create_topic(topic_id:, name:, subscribe: nil) params: api_params, response_type: Models::Topic ) - end # Get a topic by its unique ID. - # + # # # @param [String] topic_id Topic ID. # # @return [Topic] - def get_topic(topic_id:) + def get_topic( + topic_id: + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1822,30 +2097,33 @@ def get_topic(topic_id:) params: api_params, response_type: Models::Topic ) - end # Update a topic by its unique ID. - # + # # # @param [String] topic_id Topic ID. # @param [String] name Topic Name. # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. # # @return [Topic] - def update_topic(topic_id:, name: nil, subscribe: nil) + def update_topic( + topic_id:, + name: nil, + subscribe: nil + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end api_params = { name: name, subscribe: subscribe, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1859,7 +2137,6 @@ def update_topic(topic_id:, name: nil, subscribe: nil) params: api_params, response_type: Models::Topic ) - end # Delete a topic by its unique ID. @@ -1867,17 +2144,18 @@ def update_topic(topic_id:, name: nil, subscribe: nil) # @param [String] topic_id Topic ID. # # @return [] - def delete_topic(topic_id:) + def delete_topic( + topic_id: + ) api_path = '/messaging/topics/{topicId}' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1889,7 +2167,6 @@ def delete_topic(topic_id:) headers: api_headers, params: api_params, ) - end # Get a list of all subscribers from the current Appwrite project. @@ -1900,12 +2177,17 @@ def delete_topic(topic_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SubscriberList] - def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) + def list_subscribers( + topic_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/messaging/topics/{topicId}/subscribers' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end api_params = { @@ -1913,7 +2195,7 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1926,7 +2208,6 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::SubscriberList ) - end # Create a new subscriber. @@ -1936,27 +2217,31 @@ def list_subscribers(topic_id:, queries: nil, search: nil, total: nil) # @param [String] target_id Target ID. The target ID to link to the specified Topic ID. # # @return [Subscriber] - def create_subscriber(topic_id:, subscriber_id:, target_id:) + def create_subscriber( + topic_id:, + subscriber_id:, + target_id: + ) api_path = '/messaging/topics/{topicId}/subscribers' .gsub('{topicId}', topic_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end api_params = { subscriberId: subscriber_id, targetId: target_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1970,32 +2255,33 @@ def create_subscriber(topic_id:, subscriber_id:, target_id:) params: api_params, response_type: Models::Subscriber ) - end # Get a subscriber by its unique ID. - # + # # # @param [String] topic_id Topic ID. The topic ID subscribed to. # @param [String] subscriber_id Subscriber ID. # # @return [Subscriber] - def get_subscriber(topic_id:, subscriber_id:) + def get_subscriber( + topic_id:, + subscriber_id: + ) api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' .gsub('{topicId}', topic_id) .gsub('{subscriberId}', subscriber_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2008,7 +2294,6 @@ def get_subscriber(topic_id:, subscriber_id:) params: api_params, response_type: Models::Subscriber ) - end # Delete a subscriber by its unique ID. @@ -2017,22 +2302,24 @@ def get_subscriber(topic_id:, subscriber_id:) # @param [String] subscriber_id Subscriber ID. # # @return [] - def delete_subscriber(topic_id:, subscriber_id:) + def delete_subscriber( + topic_id:, + subscriber_id: + ) api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' .gsub('{topicId}', topic_id) .gsub('{subscriberId}', subscriber_id) if topic_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "topicId"') + raise Appwrite::Exception.new('Missing required parameter: "topicId"') end if subscriber_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') + raise Appwrite::Exception.new('Missing required parameter: "subscriberId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2044,8 +2331,6 @@ def delete_subscriber(topic_id:, subscriber_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/mongo.rb b/lib/appwrite/services/mongo.rb new file mode 100644 index 0000000..b745310 --- /dev/null +++ b/lib/appwrite/services/mongo.rb @@ -0,0 +1,1359 @@ +# frozen_string_literal: true + +module Appwrite + class Mongo < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/mongo' + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/mongo' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/mongo/specifications' + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/mongo/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/mongo/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/mongo/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/mongo/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/mongo/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mongo/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/mongo/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/mongo/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/mongo/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/mongo/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/mongo/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/mongo/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/mongo/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/mongo/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/mongo/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/mongo/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/mongo/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/mongo/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePITRWindows + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/mongo/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/mongo/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/mongo/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/mongo/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/mongo/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/mongo/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/mysql.rb b/lib/appwrite/services/mysql.rb new file mode 100644 index 0000000..1a9cf25 --- /dev/null +++ b/lib/appwrite/services/mysql.rb @@ -0,0 +1,1503 @@ +# frozen_string_literal: true + +module Appwrite + class Mysql < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/mysql' + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/mysql' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/mysql/specifications' + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/mysql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/mysql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/mysql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/mysql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/mysql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/mysql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/mysql/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/mysql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/mysql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/mysql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/mysql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/mysql/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/mysql/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Execute SQL through the console-facing Cloud endpoint. Cloud proxies + # through the edge platform to the per-database SQL API sidecar. Application + # traffic should bypass cloud entirely and POST directly to the per-database + # hostname: + # `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + # an `X-Appwrite-Key` header — that path scales to the whole DB fleet + # without a per-query cloud round-trip. The statement type must be on the + # database's configured allow-list. Use bound parameters for any + # user-supplied values — the API does not interpolate raw strings. + # + # @param [String] database_id Database ID. + # @param [String] sql SQL statement to execute. Exactly one statement per request. + # @param [Hash] bindings Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + # @param [Integer] timeout_seconds Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + # + # @return [DedicatedDatabaseExecution] + def create_execution( + database_id:, + sql:, + bindings: nil, + timeout_seconds: nil + ) + api_path = '/mysql/{databaseId}/executions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if sql.nil? + raise Appwrite::Exception.new('Missing required parameter: "sql"') + end + + api_params = { + sql: sql, + bindings: bindings, + timeoutSeconds: timeout_seconds, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseExecution + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/mysql/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/mysql/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/mysql/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/mysql/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/mysql/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePITRWindows + ) + end + + # Get the connection pooler configuration for a dedicated database. Returns + # pooler mode, max connections, and pool size settings. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePooler] + def get_pooler( + database_id: + ) + api_path = '/mysql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePooler + ) + end + + # Update the connection pooler configuration for a dedicated database. + # Configure pool mode, max connections, and pool sizes. + # + # @param [String] database_id Database ID. + # @param [String] mode Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + # @param [Integer] max_connections Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + # @param [Integer] default_pool_size Default pool size per user. + # @param [] read_write_splitting Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + # @param [String] pooler_cpu_request Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + # @param [String] pooler_cpu_limit Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + # @param [String] pooler_memory_request Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + # @param [String] pooler_memory_limit Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + # + # @return [DedicatedDatabasePooler] + def update_pooler( + database_id:, + mode: nil, + max_connections: nil, + default_pool_size: nil, + read_write_splitting: nil, + pooler_cpu_request: nil, + pooler_cpu_limit: nil, + pooler_memory_request: nil, + pooler_memory_limit: nil + ) + api_path = '/mysql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + mode: mode, + maxConnections: max_connections, + defaultPoolSize: default_pool_size, + readWriteSplitting: read_write_splitting, + poolerCpuRequest: pooler_cpu_request, + poolerCpuLimit: pooler_cpu_limit, + poolerMemoryRequest: pooler_memory_request, + poolerMemoryLimit: pooler_memory_limit, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePooler + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/mysql/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/mysql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/mysql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/mysql/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/mysql/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/mysql/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/oauth2.rb b/lib/appwrite/services/oauth2.rb index 0f72a90..0080fe0 100644 --- a/lib/appwrite/services/oauth2.rb +++ b/lib/appwrite/services/oauth2.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Oauth2 < Service - def initialize(client) @client = client end @@ -18,12 +17,16 @@ def initialize(client) # @param [String] scope Space-separated scopes the user consented to. Must be a subset of the scopes originally requested; identity scopes such as `openid` are always retained. Optional; omit to keep the originally requested scopes. # # @return [Oauth2Approve] - def approve(grant_id:, authorization_details: nil, scope: nil) + def approve( + grant_id:, + authorization_details: nil, + scope: nil + ) api_path = '/oauth2/{project_id}/approve' .gsub('{project_id}', @client.get_config('project')) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end api_params = { @@ -31,7 +34,7 @@ def approve(grant_id:, authorization_details: nil, scope: nil) authorization_details: authorization_details, scope: scope, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -44,7 +47,6 @@ def approve(grant_id:, authorization_details: nil, scope: nil) params: api_params, response_type: Models::Oauth2Approve ) - end # Begin the OAuth2 authorization flow. When called without a session, the @@ -69,7 +71,22 @@ def approve(grant_id:, authorization_details: nil, scope: nil) # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. # # @return [Oauth2Authorize] - def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + def authorize( + client_id: nil, + redirect_uri: nil, + response_type: nil, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil, + request_uri: nil + ) api_path = '/oauth2/{project_id}/authorize' .gsub('{project_id}', @client.get_config('project')) @@ -89,7 +106,7 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, audience: audience, request_uri: request_uri, } - + api_headers = { "accept": 'application/json', } @@ -101,7 +118,6 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, params: api_params, response_type: Models::Oauth2Authorize ) - end # Begin the OAuth2 authorization flow. When called without a session, the @@ -126,7 +142,22 @@ def authorize(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, # @param [String] request_uri OAuth2 authorization request handle returned by the pushed authorization request endpoint. # # @return [Oauth2Authorize] - def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil, request_uri: nil) + def authorize_post( + client_id: nil, + redirect_uri: nil, + response_type: nil, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil, + request_uri: nil + ) api_path = '/oauth2/{project_id}/authorize' .gsub('{project_id}', @client.get_config('project')) @@ -146,7 +177,7 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: audience: audience, request_uri: request_uri, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -159,7 +190,6 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: params: api_params, response_type: Models::Oauth2Authorize ) - end # Start the OAuth2 Device Authorization Grant. Returns the device code, user @@ -172,7 +202,13 @@ def authorize_post(client_id: nil, redirect_uri: nil, response_type: nil, scope: # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2DeviceAuthorization] - def create_device_authorization(client_id: nil, scope: nil, authorization_details: nil, resource: nil, audience: nil) + def create_device_authorization( + client_id: nil, + scope: nil, + authorization_details: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/device_authorization' .gsub('{project_id}', @client.get_config('project')) @@ -183,7 +219,7 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -196,7 +232,6 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail params: api_params, response_type: Models::Oauth2DeviceAuthorization ) - end # Exchange a device flow user code for an OAuth2 grant. The authenticated @@ -207,18 +242,20 @@ def create_device_authorization(client_id: nil, scope: nil, authorization_detail # @param [String] user_code User code displayed on the device. # # @return [Oauth2Grant] - def create_grant(user_code:) + def create_grant( + user_code: + ) api_path = '/oauth2/{project_id}/grants' .gsub('{project_id}', @client.get_config('project')) if user_code.nil? - raise Appwrite::Exception.new('Missing required parameter: "userCode"') + raise Appwrite::Exception.new('Missing required parameter: "userCode"') end api_params = { user_code: user_code, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -231,7 +268,6 @@ def create_grant(user_code:) params: api_params, response_type: Models::Oauth2Grant ) - end # Get an OAuth2 grant by its ID. Used by the consent screen to display the @@ -241,18 +277,19 @@ def create_grant(user_code:) # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. # # @return [Oauth2Grant] - def get_grant(grant_id:) + def get_grant( + grant_id: + ) api_path = '/oauth2/{project_id}/grants/{grant_id}' .gsub('{project_id}', @client.get_config('project')) .gsub('{grant_id}', grant_id) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end - api_params = { - } - + api_params = {} + api_headers = { "accept": 'application/json', } @@ -264,11 +301,10 @@ def get_grant(grant_id:) params: api_params, response_type: Models::Oauth2Grant ) - end # List the organizations the OAuth2 access token can access. Resolves the - # token's `organization` authorization details, expanding the `*` wildcard + # token's `organization` authorization details, expanding the `*` wildcard # into the concrete set of organizations the user can see. # # @param [Integer] limit Maximum number of organizations to return. Between 1 and 5000. @@ -276,7 +312,11 @@ def get_grant(grant_id:) # @param [String] search Search term to filter your list results. Max length: 256 chars. # # @return [Oauth2OrganizationList] - def list_organizations(limit: nil, offset: nil, search: nil) + def list_organizations( + limit: nil, + offset: nil, + search: nil + ) api_path = '/oauth2/{project_id}/organizations' .gsub('{project_id}', @client.get_config('project')) @@ -285,7 +325,7 @@ def list_organizations(limit: nil, offset: nil, search: nil) offset: offset, search: search, } - + api_headers = { "accept": 'application/json', } @@ -297,7 +337,6 @@ def list_organizations(limit: nil, offset: nil, search: nil) params: api_params, response_type: Models::Oauth2OrganizationList ) - end # Store an OAuth2 authorization request server-side and receive a short-lived @@ -318,20 +357,34 @@ def list_organizations(limit: nil, offset: nil, search: nil) # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2PAR] - def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil, nonce: nil, code_challenge: nil, code_challenge_method: nil, prompt: nil, max_age: nil, authorization_details: nil, resource: nil, audience: nil) + def create_par( + client_id:, + redirect_uri:, + response_type:, + scope: nil, + state: nil, + nonce: nil, + code_challenge: nil, + code_challenge_method: nil, + prompt: nil, + max_age: nil, + authorization_details: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/par' .gsub('{project_id}', @client.get_config('project')) if client_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "clientId"') + raise Appwrite::Exception.new('Missing required parameter: "clientId"') end if redirect_uri.nil? - raise Appwrite::Exception.new('Missing required parameter: "redirectUri"') + raise Appwrite::Exception.new('Missing required parameter: "redirectUri"') end if response_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "responseType"') + raise Appwrite::Exception.new('Missing required parameter: "responseType"') end api_params = { @@ -349,7 +402,7 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -362,10 +415,9 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil params: api_params, response_type: Models::Oauth2PAR ) - end - # List the projects the OAuth2 access token can access. Resolves the token's + # List the projects the OAuth2 access token can access. Resolves the token's # `project` authorization details, expanding the `*` wildcard into the # concrete set of projects the user can see. # @@ -374,7 +426,11 @@ def create_par(client_id:, redirect_uri:, response_type:, scope: nil, state: nil # @param [String] search Search term to filter your list results. Max length: 256 chars. # # @return [Oauth2ProjectList] - def list_projects(limit: nil, offset: nil, search: nil) + def list_projects( + limit: nil, + offset: nil, + search: nil + ) api_path = '/oauth2/{project_id}/projects' .gsub('{project_id}', @client.get_config('project')) @@ -383,7 +439,7 @@ def list_projects(limit: nil, offset: nil, search: nil) offset: offset, search: search, } - + api_headers = { "accept": 'application/json', } @@ -395,7 +451,6 @@ def list_projects(limit: nil, offset: nil, search: nil) params: api_params, response_type: Models::Oauth2ProjectList ) - end # Reject an OAuth2 grant when the user denies consent. Returns the @@ -406,18 +461,20 @@ def list_projects(limit: nil, offset: nil, search: nil) # @param [String] grant_id Grant ID made during authorization, provided to consent screen in URL search params. # # @return [Oauth2Reject] - def reject(grant_id:) + def reject( + grant_id: + ) api_path = '/oauth2/{project_id}/reject' .gsub('{project_id}', @client.get_config('project')) if grant_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantId"') + raise Appwrite::Exception.new('Missing required parameter: "grantId"') end api_params = { grant_id: grant_id, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -430,7 +487,6 @@ def reject(grant_id:) params: api_params, response_type: Models::Oauth2Reject ) - end # Revoke an OAuth2 access token or refresh token. @@ -441,12 +497,17 @@ def reject(grant_id:) # @param [String] client_secret OAuth2 client secret. Required for confidential apps; omitted for public apps. # # @return [] - def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) + def revoke( + token:, + token_type_hint: nil, + client_id: nil, + client_secret: nil + ) api_path = '/oauth2/{project_id}/revoke' .gsub('{project_id}', @client.get_config('project')) if token.nil? - raise Appwrite::Exception.new('Missing required parameter: "token"') + raise Appwrite::Exception.new('Missing required parameter: "token"') end api_params = { @@ -455,7 +516,7 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) client_id: client_id, client_secret: client_secret, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -467,7 +528,6 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) headers: api_headers, params: api_params, ) - end # Exchange an OAuth2 authorization code, refresh token, or device code for @@ -485,12 +545,23 @@ def revoke(token:, token_type_hint: nil, client_id: nil, client_secret: nil) # @param [String] audience Compatibility alias for a single OAuth2 resource indicator URI. # # @return [Oauth2Token] - def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, client_id: nil, client_secret: nil, code_verifier: nil, redirect_uri: nil, resource: nil, audience: nil) + def create_token( + grant_type:, + code: nil, + refresh_token: nil, + device_code: nil, + client_id: nil, + client_secret: nil, + code_verifier: nil, + redirect_uri: nil, + resource: nil, + audience: nil + ) api_path = '/oauth2/{project_id}/token' .gsub('{project_id}', @client.get_config('project')) if grant_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "grantType"') + raise Appwrite::Exception.new('Missing required parameter: "grantType"') end api_params = { @@ -505,7 +576,7 @@ def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, c resource: resource, audience: audience, } - + api_headers = { "content-type": 'application/json', "accept": 'application/json', @@ -518,8 +589,6 @@ def create_token(grant_type:, code: nil, refresh_token: nil, device_code: nil, c params: api_params, response_type: Models::Oauth2Token ) - end - - end + end end diff --git a/lib/appwrite/services/organization.rb b/lib/appwrite/services/organization.rb index 71a003f..83c2817 100644 --- a/lib/appwrite/services/organization.rb +++ b/lib/appwrite/services/organization.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Organization < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/organization' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -29,25 +27,26 @@ def get() params: api_params, response_type: Models::Organization ) - end - # Update the current organization's name. + # Update the current organization's name. # # @param [String] name New organization name. Max length: 128 chars. # # @return [Organization] - def update(name:) + def update( + name: + ) api_path = '/organization' if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -61,7 +60,6 @@ def update(name:) params: api_params, response_type: Models::Organization ) - end # Delete the current organization. All projects that belong to the @@ -72,9 +70,8 @@ def update(name:) def delete() api_path = '/organization' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -86,7 +83,6 @@ def delete() headers: api_headers, params: api_params, ) - end # List app installations on the organization. Any organization member can @@ -96,14 +92,17 @@ def delete() # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(queries: nil, total: nil) + def list_installations( + queries: nil, + total: nil + ) api_path = '/organization/installations' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -116,7 +115,6 @@ def list_installations(queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Install an app on the organization. Only organization members with the @@ -127,18 +125,21 @@ def list_installations(queries: nil, total: nil) # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. # # @return [AppInstallation] - def create_installation(app_id:, authorization_details: nil) + def create_installation( + app_id:, + authorization_details: nil + ) api_path = '/organization/installations' if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { appId: app_id, authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -152,7 +153,6 @@ def create_installation(app_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Get an app installation on the organization by its unique ID. Any @@ -161,17 +161,18 @@ def create_installation(app_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(installation_id:) + def get_installation( + installation_id: + ) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -184,11 +185,10 @@ def get_installation(installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Update an app installation on the organization. Only organization members - # with the owner role can update installations. The installation's granted + # with the owner role can update installations. The installation's granted # scopes are refreshed to the scopes the app currently requests; previously # issued installation access tokens are revoked. # @@ -196,18 +196,21 @@ def get_installation(installation_id:) # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. # # @return [AppInstallation] - def update_installation(installation_id:, authorization_details: nil) + def update_installation( + installation_id:, + authorization_details: nil + ) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -221,7 +224,6 @@ def update_installation(installation_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Uninstall an app from the organization by its installation ID. Only @@ -231,17 +233,18 @@ def update_installation(installation_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(installation_id:) + def delete_installation( + installation_id: + ) api_path = '/organization/installations/{installationId}' .gsub('{installationId}', installation_id) if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -254,7 +257,6 @@ def delete_installation(installation_id:) headers: api_headers, params: api_params, ) - end # Get a list of all API keys from the current organization. @@ -263,14 +265,17 @@ def delete_installation(installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [KeyList] - def list_keys(queries: nil, total: nil) + def list_keys( + queries: nil, + total: nil + ) api_path = '/organization/keys' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -283,30 +288,34 @@ def list_keys(queries: nil, total: nil) params: api_params, response_type: Models::KeyList ) - end # Create a new organization API key. # - # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key_id Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Key name. Max length: 128 chars. # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed. # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def create_key(key_id:, name:, scopes:, expire: nil) + def create_key( + key_id:, + name:, + scopes:, + expire: nil + ) api_path = '/organization/keys' if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -315,7 +324,7 @@ def create_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -329,7 +338,6 @@ def create_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Get a key by its unique ID. This endpoint returns details about a specific @@ -338,17 +346,18 @@ def create_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key unique ID. # # @return [Key] - def get_key(key_id:) + def get_key( + key_id: + ) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -361,7 +370,6 @@ def get_key(key_id:) params: api_params, response_type: Models::Key ) - end # Update a key by its unique ID. Use this endpoint to update the name, @@ -373,20 +381,25 @@ def get_key(key_id:) # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def update_key(key_id:, name:, scopes:, expire: nil) + def update_key( + key_id:, + name:, + scopes:, + expire: nil + ) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -394,7 +407,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -408,7 +421,6 @@ def update_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Delete a key by its unique ID. Once deleted, the key can no longer be used @@ -417,17 +429,18 @@ def update_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key unique ID. # # @return [] - def delete_key(key_id:) + def delete_key( + key_id: + ) api_path = '/organization/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -439,7 +452,6 @@ def delete_key(key_id:) headers: api_headers, params: api_params, ) - end # Get a list of all memberships from the current organization. @@ -449,7 +461,11 @@ def delete_key(key_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(queries: nil, search: nil, total: nil) + def list_memberships( + queries: nil, + search: nil, + total: nil + ) api_path = '/organization/memberships' api_params = { @@ -457,7 +473,7 @@ def list_memberships(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -470,26 +486,32 @@ def list_memberships(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # Invite a new member to join the current organization. An email with a link - # to join the organization will be sent to the new member's email address. If - # member doesn't exist in the project it will be automatically created. + # to join the organization will be sent to the new member's email address. If + # member doesn't exist in the project it will be automatically created. # # @param [Array] roles Array of strings. Use this param to set the user roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # @param [String] email Email of the new organization member. # @param [String] user_id ID of the user to be added to the organization. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. # @param [String] name Name of the new organization member. Max length: 128 chars. # # @return [Membership] - def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) + def create_membership( + roles:, + email: nil, + user_id: nil, + phone: nil, + url: nil, + name: nil + ) api_path = '/organization/memberships' if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { @@ -500,7 +522,7 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na url: url, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -514,7 +536,6 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na params: api_params, response_type: Models::Membership ) - end # Get a membership from the current organization by its unique ID. @@ -522,17 +543,18 @@ def create_membership(roles:, email: nil, user_id: nil, phone: nil, url: nil, na # @param [String] membership_id Membership ID. # # @return [Membership] - def get_membership(membership_id:) + def get_membership( + membership_id: + ) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -545,31 +567,33 @@ def get_membership(membership_id:) params: api_params, response_type: Models::Membership ) - end # Modify the roles of a member in the current organization. # # @param [String] membership_id Membership ID. - # @param [Array] roles An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # @param [Array] roles An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # # @return [Membership] - def update_membership(membership_id:, roles:) + def update_membership( + membership_id:, + roles: + ) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { roles: roles, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -583,7 +607,6 @@ def update_membership(membership_id:, roles:) params: api_params, response_type: Models::Membership ) - end # Remove a member from the current organization. The member is removed @@ -593,17 +616,18 @@ def update_membership(membership_id:, roles:) # @param [String] membership_id Membership ID. # # @return [] - def delete_membership(membership_id:) + def delete_membership( + membership_id: + ) api_path = '/organization/memberships/{membershipId}' .gsub('{membershipId}', membership_id) if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -615,7 +639,6 @@ def delete_membership(membership_id:) headers: api_headers, params: api_params, ) - end # Get a list of all projects. You can use the query params to filter your @@ -626,7 +649,11 @@ def delete_membership(membership_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProjectList] - def list_projects(queries: nil, search: nil, total: nil) + def list_projects( + queries: nil, + search: nil, + total: nil + ) api_path = '/organization/projects' api_params = { @@ -634,7 +661,7 @@ def list_projects(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -647,25 +674,28 @@ def list_projects(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::ProjectList ) - end # Create a new project. # - # @param [String] project_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. + # @param [String] project_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. # @param [String] name Project name. Max length: 128 chars. # @param [Region] region Project Region. # # @return [Project] - def create_project(project_id:, name:, region: nil) + def create_project( + project_id:, + name:, + region: nil + ) api_path = '/organization/projects' if project_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "projectId"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -673,7 +703,7 @@ def create_project(project_id:, name:, region: nil) name: name, region: region, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -687,7 +717,6 @@ def create_project(project_id:, name:, region: nil) params: api_params, response_type: Models::Project ) - end # Get a project. @@ -695,17 +724,18 @@ def create_project(project_id:, name:, region: nil) # @param [String] project_id Project unique ID. # # @return [Project] - def get_project(project_id:) + def get_project( + project_id: + ) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "projectId"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), } @@ -717,7 +747,6 @@ def get_project(project_id:) params: api_params, response_type: Models::Project ) - end # Update a project by its unique ID. @@ -726,22 +755,25 @@ def get_project(project_id:) # @param [String] name Project name. Max length: 128 chars. # # @return [Project] - def update_project(project_id:, name:) + def update_project( + project_id:, + name: + ) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "projectId"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -755,7 +787,6 @@ def update_project(project_id:, name:) params: api_params, response_type: Models::Project ) - end # Delete a project by its unique ID. @@ -763,17 +794,18 @@ def update_project(project_id:, name:) # @param [String] project_id Project unique ID. # # @return [] - def delete_project(project_id:) + def delete_project( + project_id: + ) api_path = '/organization/projects/{projectId}' .gsub('{projectId}', project_id) if project_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "projectId"') + raise Appwrite::Exception.new('Missing required parameter: "projectId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -785,8 +817,6 @@ def delete_project(project_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/postgresql.rb b/lib/appwrite/services/postgresql.rb new file mode 100644 index 0000000..24c1ceb --- /dev/null +++ b/lib/appwrite/services/postgresql.rb @@ -0,0 +1,1615 @@ +# frozen_string_literal: true + +module Appwrite + class Postgresql < Service + def initialize(client) + @client = client + end + + # List all dedicated databases. Results support pagination. + # + # @param [Array] queries Array of query strings. + # + # @return [DedicatedDatabaseList] + def list( + queries: nil + ) + api_path = '/postgresql' + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseList + ) + end + + # Create a new dedicated database with the chosen engine and configuration. + # Status will be 'provisioning' until the database is ready. + # + # @param [String] database_id Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database display name. Max length: 128 chars. + # @param [String] version Database engine version. Defaults to latest for selected engine. + # @param [String] specification Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds. + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes of inactivity before container scales to zero. + # @param [] pitr Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + # @param [Integer] pitr_retention_days Number of days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # + # @return [DedicatedDatabase] + def create( + database_id:, + name:, + version: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil + ) + api_path = '/postgresql' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + version: version, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/postgresql/specifications' + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseSpecificationList + ) + end + + # Get a dedicated database by its unique ID. Returns the database + # configuration and current status. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def get( + database_id: + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update a dedicated database configuration. All changes are applied with + # zero downtime. Specification changes (cpu, memory, storage) are handled via + # rolling cutover. Storage expansion is done online. All other settings are + # applied in-place. + # + # @param [String] database_id Database ID. + # @param [String] name Database display name. + # @param [String] status Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + # @param [String] specification Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + # @param [Integer] replicas Number of high availability replicas (0-5). High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode preference. Allowed values: async, sync, quorum. + # @param [Integer] network_idle_timeout_seconds Connection idle timeout in seconds (60-86400). + # @param [Array] network_ip_allowlist IP addresses/CIDR ranges allowed to connect. + # @param [Integer] idle_timeout_minutes Minutes before container scales to zero. + # @param [] pitr Enable or disable point-in-time recovery (PITR). + # @param [Integer] pitr_retention_days Days to retain PITR data. + # @param [] storage_autoscaling Enable automatic storage expansion when usage exceeds threshold. + # @param [Integer] storage_autoscaling_threshold_percent Storage usage percentage (50-95) that triggers automatic expansion. + # @param [Integer] storage_autoscaling_max_gb Maximum storage size in GB for autoscaling. 0 means no limit. + # @param [Float] metrics_trace_sample_rate Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + # @param [Integer] metrics_slow_query_log_threshold_ms Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + # @param [] sql_api_enabled Enable the SQL API sidecar for this database. + # @param [Array] sql_api_allowed_statements Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + # @param [Integer] sql_api_max_rows Maximum rows returned per SQL API execution (1-1000000). + # @param [Integer] sql_api_max_bytes Maximum serialised SQL API result payload in bytes (1024-104857600). + # @param [Integer] sql_api_timeout_seconds Per-call SQL API execution timeout in seconds (1-300). + # + # @return [DedicatedDatabase] + def update( + database_id:, + name: nil, + status: nil, + specification: nil, + replicas: nil, + sync_mode: nil, + network_idle_timeout_seconds: nil, + network_ip_allowlist: nil, + idle_timeout_minutes: nil, + pitr: nil, + pitr_retention_days: nil, + storage_autoscaling: nil, + storage_autoscaling_threshold_percent: nil, + storage_autoscaling_max_gb: nil, + metrics_trace_sample_rate: nil, + metrics_slow_query_log_threshold_ms: nil, + sql_api_enabled: nil, + sql_api_allowed_statements: nil, + sql_api_max_rows: nil, + sql_api_max_bytes: nil, + sql_api_timeout_seconds: nil + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + name: name, + status: status, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + networkIdleTimeoutSeconds: network_idle_timeout_seconds, + networkIPAllowlist: network_ip_allowlist, + idleTimeoutMinutes: idle_timeout_minutes, + pitr: pitr, + pitrRetentionDays: pitr_retention_days, + storageAutoscaling: storage_autoscaling, + storageAutoscalingThresholdPercent: storage_autoscaling_threshold_percent, + storageAutoscalingMaxGb: storage_autoscaling_max_gb, + metricsTraceSampleRate: metrics_trace_sample_rate, + metricsSlowQueryLogThresholdMs: metrics_slow_query_log_threshold_ms, + sqlApiEnabled: sql_api_enabled, + sqlApiAllowedStatements: sql_api_allowed_statements, + sqlApiMaxRows: sql_api_max_rows, + sqlApiMaxBytes: sql_api_max_bytes, + sqlApiTimeoutSeconds: sql_api_timeout_seconds, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete a dedicated database. This action is irreversible. The database + # status will be set to 'deleting' and all resources will be cleaned up. + # Deletion is allowed from any state, and repeating the call re-dispatches + # the cleanup. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/postgresql/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all backups for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + # + # @return [DedicatedDatabaseBackupList] + def list_backups( + database_id:, + queries: nil + ) + api_path = '/postgresql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupList + ) + end + + # Create a manual backup of a dedicated database. The backup will be created + # asynchronously and its status can be checked via the get backup endpoint. + # + # @param [String] database_id Database ID. + # @param [String] type Backup type: full or incremental. + # + # @return [DedicatedDatabaseBackup] + def create_backup( + database_id:, + type: nil + ) + api_path = '/postgresql/{databaseId}/backups' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # List scheduled backup policies for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # + # @return [BackupPolicyList] + def list_backup_policies( + database_id:, + queries: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicyList + ) + end + + # Create a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [String] type Backup type: full or incremental. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def create_backup_policy( + database_id:, + policy_id:, + name:, + schedule:, + retention:, + type: nil, + enabled: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if schedule.nil? + raise Appwrite::Exception.new('Missing required parameter: "schedule"') + end + + if retention.nil? + raise Appwrite::Exception.new('Missing required parameter: "retention"') + end + + api_params = { + policyId: policy_id, + name: name, + schedule: schedule, + retention: retention, + type: type, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Get a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [BackupPolicy] + def get_backup_policy( + database_id:, + policy_id: + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Update a scheduled backup policy for a dedicated database. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # @param [String] name Policy name. Max length: 128 chars. + # @param [String] schedule Schedule CRON syntax. + # @param [Integer] retention Days to keep backups before deletion. + # @param [] enabled Is policy enabled? When disabled, no backups will be taken. + # + # @return [BackupPolicy] + def update_backup_policy( + database_id:, + policy_id:, + name: nil, + schedule: nil, + retention: nil, + enabled: nil + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = { + name: name, + schedule: schedule, + retention: retention, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::BackupPolicy + ) + end + + # Delete a scheduled backup policy for a dedicated database. Backups already + # taken by the policy are kept until their retention expires. + # + # @param [String] database_id Database ID. + # @param [String] policy_id Policy ID. + # + # @return [] + def delete_backup_policy( + database_id:, + policy_id: + ) + api_path = '/postgresql/{databaseId}/backups/policies/{policyId}' + .gsub('{databaseId}', database_id) + .gsub('{policyId}', policy_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if policy_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "policyId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Configure off-cluster backup storage for a dedicated database. Supports S3, + # GCS, and Azure Blob Storage destinations. Backups will be stored to the + # configured destination in addition to on-cluster storage. + # + # @param [String] database_id Database ID. + # @param [String] provider Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + # @param [String] bucket Storage bucket or container name. + # @param [String] access_key Access key or client ID for authentication. + # @param [String] secret_key Secret key or service account JSON for authentication. + # @param [String] region Storage region. + # @param [String] prefix Object key prefix for backups. + # @param [String] endpoint Custom endpoint for S3-compatible storage (e.g. MinIO). + # + # @return [DedicatedDatabaseBackupStorage] + def update_backup_storage( + database_id:, + provider:, + bucket:, + access_key:, + secret_key:, + region: nil, + prefix: nil, + endpoint: nil + ) + api_path = '/postgresql/{databaseId}/backups/storage' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if provider.nil? + raise Appwrite::Exception.new('Missing required parameter: "provider"') + end + + if bucket.nil? + raise Appwrite::Exception.new('Missing required parameter: "bucket"') + end + + if access_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "accessKey"') + end + + if secret_key.nil? + raise Appwrite::Exception.new('Missing required parameter: "secretKey"') + end + + api_params = { + provider: provider, + bucket: bucket, + region: region, + prefix: prefix, + endpoint: endpoint, + accessKey: access_key, + secretKey: secret_key, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackupStorage + ) + end + + # Get details of a specific database backup including its status, size, and + # timestamps. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [DedicatedDatabaseBackup] + def get_backup( + database_id:, + backup_id: + ) + api_path = '/postgresql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBackup + ) + end + + # Delete a database backup. This will permanently remove the backup from + # storage and cannot be undone. + # + # @param [String] database_id Database ID. + # @param [String] backup_id Backup ID. + # + # @return [] + def delete_backup( + database_id:, + backup_id: + ) + api_path = '/postgresql/{databaseId}/backups/{backupId}' + .gsub('{databaseId}', database_id) + .gsub('{backupId}', backup_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if backup_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "backupId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List all ephemeral branches for a dedicated database. Returns branch + # metadata including ID, name, namespace, and expiration time. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseBranchList] + def list_branches( + database_id: + ) + api_path = '/postgresql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseBranchList + ) + end + + # Create an ephemeral database branch from the primary via PVC snapshot. The + # branch is a full copy of the database at the current point in time, useful + # for testing schema migrations or running experiments without affecting + # production data. Branches expire after the configured TTL (default 24 + # hours). The branch is created asynchronously. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Integer] ttl Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + # + # @return [DedicatedDatabase] + def create_branch( + database_id:, + branch_id: nil, + ttl: nil + ) + api_path = '/postgresql/{databaseId}/branches' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + branchId: branch_id, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Delete an ephemeral database branch. This removes the branch namespace, its + # PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + # and is irreversible. + # + # @param [String] database_id Database ID. + # @param [String] branch_id Branch ID. + # + # @return [DedicatedDatabase] + def delete_branch( + database_id:, + branch_id: + ) + api_path = '/postgresql/{databaseId}/branches/{branchId}' + .gsub('{databaseId}', database_id) + .gsub('{branchId}', branch_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if branch_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "branchId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Rotate the primary connection credentials for a dedicated database. + # Generates a new password and updates the database atomically. Previous + # credentials stop working immediately. Returns the database with a refreshed + # connection string carrying the new password. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabase] + def update_credentials( + database_id: + ) + api_path = '/postgresql/{databaseId}/credentials' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Execute SQL through the console-facing Cloud endpoint. Cloud proxies + # through the edge platform to the per-database SQL API sidecar. Application + # traffic should bypass cloud entirely and POST directly to the per-database + # hostname: + # `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + # an `X-Appwrite-Key` header — that path scales to the whole DB fleet + # without a per-query cloud round-trip. The statement type must be on the + # database's configured allow-list. Use bound parameters for any + # user-supplied values — the API does not interpolate raw strings. + # + # @param [String] database_id Database ID. + # @param [String] sql SQL statement to execute. Exactly one statement per request. + # @param [Hash] bindings Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + # @param [Integer] timeout_seconds Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + # + # @return [DedicatedDatabaseExecution] + def create_execution( + database_id:, + sql:, + bindings: nil, + timeout_seconds: nil + ) + api_path = '/postgresql/{databaseId}/executions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if sql.nil? + raise Appwrite::Exception.new('Missing required parameter: "sql"') + end + + api_params = { + sql: sql, + bindings: bindings, + timeoutSeconds: timeout_seconds, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseExecution + ) + end + + # List installed and available extensions for a PostgreSQL database. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseExtensions] + def list_extensions( + database_id: + ) + api_path = '/postgresql/{databaseId}/extensions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseExtensions + ) + end + + # Install a database extension. Only available for PostgreSQL databases. The + # install runs asynchronously; poll the extensions list endpoint for status. + # + # @param [String] database_id Database ID. + # @param [String] name Extension name (e.g., pgvector, postgis, uuid-ossp). + # + # @return [DedicatedDatabase] + def create_extension( + database_id:, + name: + ) + api_path = '/postgresql/{databaseId}/extensions' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Uninstall a database extension from a PostgreSQL database. The uninstall + # runs asynchronously; poll the extensions list endpoint for status. + # + # @param [String] database_id Database ID. + # @param [String] extension_name Extension name to uninstall. + # + # @return [DedicatedDatabase] + def delete_extension( + database_id:, + extension_name: + ) + api_path = '/postgresql/{databaseId}/extensions/{extensionName}' + .gsub('{databaseId}', database_id) + .gsub('{extensionName}', extension_name) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if extension_name.nil? + raise Appwrite::Exception.new('Missing required parameter: "extensionName"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/postgresql/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Update the maintenance window for a dedicated database. Maintenance + # operations like minor version upgrades will be performed during this + # window. + # + # @param [String] database_id Database ID. + # @param [String] day Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + # @param [Integer] hour_utc Hour in UTC (0-23) for maintenance window start. + # + # @return [DedicatedDatabase] + def update_maintenance( + database_id:, + day:, + hour_utc: + ) + api_path = '/postgresql/{databaseId}/maintenance' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if day.nil? + raise Appwrite::Exception.new('Missing required parameter: "day"') + end + + if hour_utc.nil? + raise Appwrite::Exception.new('Missing required parameter: "hourUtc"') + end + + api_params = { + day: day, + hourUtc: hour_utc, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # Migrate a database between shared and dedicated types. Shared to dedicated + # provisions an always-on dedicated instance; dedicated to shared converts to + # a serverless instance that scales to zero when idle. Data is copied to the + # target with a brief read-only window during cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_type Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + # @param [String] specification Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + # + # @return [DedicatedDatabase] + def create_migration( + database_id:, + target_type:, + specification: nil + ) + api_path = '/postgresql/{databaseId}/migrations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_type.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetType"') + end + + api_params = { + targetType: target_type, + specification: specification, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/postgresql/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseOperationList + ) + end + + # Get available point-in-time recovery windows for a dedicated database. + # Returns the earliest and latest recovery points. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePITRWindows] + def get_pitr( + database_id: + ) + api_path = '/postgresql/{databaseId}/pitr' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePITRWindows + ) + end + + # Get the connection pooler configuration for a dedicated database. Returns + # pooler mode, max connections, and pool size settings. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabasePooler] + def get_pooler( + database_id: + ) + api_path = '/postgresql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePooler + ) + end + + # Update the connection pooler configuration for a dedicated database. + # Configure pool mode, max connections, and pool sizes. + # + # @param [String] database_id Database ID. + # @param [String] mode Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + # @param [Integer] max_connections Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + # @param [Integer] default_pool_size Default pool size per user. + # @param [] read_write_splitting Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + # @param [String] pooler_cpu_request Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + # @param [String] pooler_cpu_limit Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + # @param [String] pooler_memory_request Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + # @param [String] pooler_memory_limit Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + # + # @return [DedicatedDatabasePooler] + def update_pooler( + database_id:, + mode: nil, + max_connections: nil, + default_pool_size: nil, + read_write_splitting: nil, + pooler_cpu_request: nil, + pooler_cpu_limit: nil, + pooler_memory_request: nil, + pooler_memory_limit: nil + ) + api_path = '/postgresql/{databaseId}/pooler' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + mode: mode, + maxConnections: max_connections, + defaultPoolSize: default_pool_size, + readWriteSplitting: read_write_splitting, + poolerCpuRequest: pooler_cpu_request, + poolerCpuLimit: pooler_cpu_limit, + poolerMemoryRequest: pooler_memory_request, + poolerMemoryLimit: pooler_memory_limit, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabasePooler + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/postgresql/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseReplicas + ) + end + + # List all restorations for a dedicated database. Results can be filtered by + # status and type. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by restoration status. + # @param [String] type Filter by restoration type. + # @param [Integer] limit Maximum number of restorations to return. + # @param [Integer] offset Number of restorations to skip. + # + # @return [DedicatedDatabaseRestorationList] + def list_restorations( + database_id:, + status: nil, + type: nil, + limit: nil, + offset: nil + ) + api_path = '/postgresql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + type: type, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestorationList + ) + end + + # Restore a database from a backup or to a specific point in time (PITR). For + # backup restoration, provide a backupId. For PITR, provide a targetTime as + # an ISO 8601 datetime. PITR requires the database to have PITR enabled and + # is only available for enterprise databases. + # + # @param [String] database_id Database ID. + # @param [String] type Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + # @param [String] backup_id Backup ID to restore from (required for backup type). + # @param [String] target_database_id Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + # @param [String] target_time Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + # + # @return [DedicatedDatabaseRestoration] + def create_restoration( + database_id:, + type: nil, + backup_id: nil, + target_database_id: nil, + target_time: nil + ) + api_path = '/postgresql/{databaseId}/restorations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + type: type, + backupId: backup_id, + targetDatabaseId: target_database_id, + targetTime: target_time, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get details of a specific database restoration including its status, type, + # and timestamps. + # + # @param [String] database_id Database ID. + # @param [String] restoration_id Restoration ID. + # + # @return [DedicatedDatabaseRestoration] + def get_restoration( + database_id:, + restoration_id: + ) + api_path = '/postgresql/{databaseId}/restorations/{restorationId}' + .gsub('{databaseId}', database_id) + .gsub('{restorationId}', restoration_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if restoration_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "restorationId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseRestoration + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/postgresql/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseStatus + ) + end + + # Upgrade a dedicated database to a new engine version. Uses blue-green + # deployment for zero-downtime cutover. + # + # @param [String] database_id Database ID. + # @param [String] target_version Target engine version to upgrade to. + # + # @return [DedicatedDatabase] + def create_upgrade( + database_id:, + target_version: + ) + api_path = '/postgresql/{databaseId}/upgrades' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if target_version.nil? + raise Appwrite::Exception.new('Missing required parameter: "targetVersion"') + end + + api_params = { + targetVersion: target_version, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + end +end diff --git a/lib/appwrite/services/presences.rb b/lib/appwrite/services/presences.rb index d5f1c30..01a022e 100644 --- a/lib/appwrite/services/presences.rb +++ b/lib/appwrite/services/presences.rb @@ -1,21 +1,24 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Presences < Service - def initialize(client) @client = client end # List presence logs. Expired entries are filtered out automatically. - # + # # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [PresenceList] - def list(queries: nil, total: nil, ttl: nil) + def list( + queries: nil, + total: nil, + ttl: nil + ) api_path = '/presences' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, total: nil, ttl: nil) total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,27 +39,27 @@ def list(queries: nil, total: nil, ttl: nil) params: api_params, response_type: Models::PresenceList ) - end # Get a presence log by its unique ID. Entries whose `expiresAt` is in the # past are treated as not found. - # + # # # @param [String] presence_id Presence unique ID. # # @return [Presence] - def get(presence_id:) + def get( + presence_id: + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -69,11 +72,10 @@ def get(presence_id:) params: api_params, response_type: Models::Presence ) - end # Create or update a presence log by its user ID. - # + # # # @param [String] presence_id Presence unique ID. # @param [String] user_id User ID. @@ -83,20 +85,27 @@ def get(presence_id:) # @param [Hash] metadata Presence metadata object. # # @return [Presence] - def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, metadata: nil) + def upsert( + presence_id:, + user_id:, + status:, + permissions: nil, + expires_at: nil, + metadata: nil + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if status.nil? - raise Appwrite::Exception.new('Missing required parameter: "status"') + raise Appwrite::Exception.new('Missing required parameter: "status"') end api_params = { @@ -106,7 +115,7 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m expiresAt: expires_at, metadata: metadata, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -120,12 +129,11 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m params: api_params, response_type: Models::Presence ) - end # Update a presence log by its unique ID. Using the patch method you can pass # only specific fields that will get updated. - # + # # # @param [String] presence_id Presence unique ID. # @param [String] user_id User ID. @@ -136,16 +144,24 @@ def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, m # @param [] purge When true, purge cached responses used by list presences endpoint. # # @return [Presence] - def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: nil, purge: nil) + def update( + presence_id:, + user_id:, + status: nil, + expires_at: nil, + metadata: nil, + permissions: nil, + purge: nil + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -156,7 +172,7 @@ def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: permissions, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -170,26 +186,26 @@ def update(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, params: api_params, response_type: Models::Presence ) - end # Delete a presence log by its unique ID. - # + # # # @param [String] presence_id Presence unique ID. # # @return [] - def delete(presence_id:) + def delete( + presence_id: + ) api_path = '/presences/{presenceId}' .gsub('{presenceId}', presence_id) if presence_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -201,8 +217,6 @@ def delete(presence_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index ada3392..fa543cf 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Project < Service - def initialize(client) @client = client end @@ -14,9 +13,8 @@ def initialize(client) def get() api_path = '/project' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), } @@ -28,7 +26,6 @@ def get() params: api_params, response_type: Models::Project ) - end # Delete a project. @@ -38,9 +35,8 @@ def get() def delete() api_path = '/project' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -52,32 +48,34 @@ def delete() headers: api_headers, params: api_params, ) - end # Update properties of a specific auth method. Use this endpoint to enable or - # disable a method in your project. + # disable a method in your project. # # @param [ProjectAuthMethodId] method_id Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone # @param [] enabled Auth method status. # # @return [Project] - def update_auth_method(method_id:, enabled:) + def update_auth_method( + method_id:, + enabled: + ) api_path = '/project/auth-methods/{methodId}' .gsub('{methodId}', method_id) if method_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "methodId"') + raise Appwrite::Exception.new('Missing required parameter: "methodId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -91,7 +89,6 @@ def update_auth_method(method_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Get a list of all API keys from the current project. @@ -100,14 +97,17 @@ def update_auth_method(method_id:, enabled:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [KeyList] - def list_keys(queries: nil, total: nil) + def list_keys( + queries: nil, + total: nil + ) api_path = '/project/keys' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -120,12 +120,11 @@ def list_keys(queries: nil, total: nil) params: api_params, response_type: Models::KeyList ) - end - # Create a new ephemeral API key. It's recommended to have multiple API keys + # Create a new ephemeral API key. It's recommended to have multiple API keys # with strict scopes for separate functions within your project. - # + # # You can also create a standard API key if you need a longer-lived key # instead. # @@ -133,22 +132,25 @@ def list_keys(queries: nil, total: nil) # @param [Integer] duration Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. # # @return [EphemeralKey] - def create_ephemeral_key(scopes:, duration:) + def create_ephemeral_key( + scopes:, + duration: + ) api_path = '/project/keys/ephemeral' if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end if duration.nil? - raise Appwrite::Exception.new('Missing required parameter: "duration"') + raise Appwrite::Exception.new('Missing required parameter: "duration"') end api_params = { scopes: scopes, duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -162,25 +164,25 @@ def create_ephemeral_key(scopes:, duration:) params: api_params, response_type: Models::EphemeralKey ) - end - # Get a key by its unique ID. + # Get a key by its unique ID. # # @param [String] key_id Key ID. # # @return [Key] - def get_key(key_id:) + def get_key( + key_id: + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -193,7 +195,6 @@ def get_key(key_id:) params: api_params, response_type: Models::Key ) - end # Update a key by its unique ID. Use this endpoint to update the name, @@ -205,20 +206,25 @@ def get_key(key_id:) # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. # # @return [Key] - def update_key(key_id:, name:, scopes:, expire: nil) + def update_key( + key_id:, + name:, + scopes:, + expire: nil + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if scopes.nil? - raise Appwrite::Exception.new('Missing required parameter: "scopes"') + raise Appwrite::Exception.new('Missing required parameter: "scopes"') end api_params = { @@ -226,7 +232,7 @@ def update_key(key_id:, name:, scopes:, expire: nil) scopes: scopes, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -240,7 +246,6 @@ def update_key(key_id:, name:, scopes:, expire: nil) params: api_params, response_type: Models::Key ) - end # Delete a key by its unique ID. Once deleted, the key can no longer be used @@ -249,17 +254,18 @@ def update_key(key_id:, name:, scopes:, expire: nil) # @param [String] key_id Key ID. # # @return [] - def delete_key(key_id:) + def delete_key( + key_id: + ) api_path = '/project/keys/{keyId}' .gsub('{keyId}', key_id) if key_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "keyId"') + raise Appwrite::Exception.new('Missing required parameter: "keyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -271,7 +277,6 @@ def delete_key(key_id:) headers: api_headers, params: api_params, ) - end # Update the project labels. Labels can be used to easily filter projects in @@ -280,17 +285,19 @@ def delete_key(key_id:) # @param [Array] labels Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [Project] - def update_labels(labels:) + def update_labels( + labels: + ) api_path = '/project/labels' if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -304,7 +311,6 @@ def update_labels(labels:) params: api_params, response_type: Models::Project ) - end # Get a list of all mock phones in the project. This endpoint returns an @@ -314,14 +320,17 @@ def update_labels(labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MockNumberList] - def list_mock_phones(queries: nil, total: nil) + def list_mock_phones( + queries: nil, + total: nil + ) api_path = '/project/mock-phones' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -334,7 +343,6 @@ def list_mock_phones(queries: nil, total: nil) params: api_params, response_type: Models::MockNumberList ) - end # Create a new mock phone for your project. Use this endpoint to register a @@ -344,22 +352,25 @@ def list_mock_phones(queries: nil, total: nil) # @param [String] otp One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. # # @return [MockNumber] - def create_mock_phone(number:, otp:) + def create_mock_phone( + number:, + otp: + ) api_path = '/project/mock-phones' if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { number: number, otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -373,26 +384,26 @@ def create_mock_phone(number:, otp:) params: api_params, response_type: Models::MockNumber ) - end # Get a mock phone by its unique number. This endpoint returns the mock - # phone's OTP. + # phone's OTP. # # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # # @return [MockNumber] - def get_mock_phone(number:) + def get_mock_phone( + number: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -405,32 +416,34 @@ def get_mock_phone(number:) params: api_params, response_type: Models::MockNumber ) - end # Update a mock phone by its unique number. Use this endpoint to update the - # mock phone's OTP. + # mock phone's OTP. # # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # @param [String] otp One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. # # @return [MockNumber] - def update_mock_phone(number:, otp:) + def update_mock_phone( + number:, + otp: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end if otp.nil? - raise Appwrite::Exception.new('Missing required parameter: "otp"') + raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_params = { otp: otp, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -444,7 +457,6 @@ def update_mock_phone(number:, otp:) params: api_params, response_type: Models::MockNumber ) - end # Delete a mock phone by its unique number. This endpoint removes the mock @@ -453,17 +465,18 @@ def update_mock_phone(number:, otp:) # @param [String] number Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. # # @return [] - def delete_mock_phone(number:) + def delete_mock_phone( + number: + ) api_path = '/project/mock-phones/{number}' .gsub('{number}', number) if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -475,25 +488,27 @@ def delete_mock_phone(number:) headers: api_headers, params: api_params, ) - end # Get a list of all OAuth2 providers supported by the server, along with the - # project's configuration for each. Credential fields are write-only and + # project's configuration for each. Credential fields are write-only and # always returned empty. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [OAuth2ProviderList] - def list_o_auth2_providers(queries: nil, total: nil) + def list_o_auth2_providers( + queries: nil, + total: nil + ) api_path = '/project/oauth2' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -506,7 +521,6 @@ def list_o_auth2_providers(queries: nil, total: nil) params: api_params, response_type: Models::OAuth2ProviderList ) - end # Update the OAuth2 server (OIDC provider) configuration. @@ -529,15 +543,32 @@ def list_o_auth2_providers(queries: nil, total: nil) # @param [Array] installation_scopes List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long. # # @return [Project] - def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil, installation_scopes: nil) + def update_o_auth2_server( + enabled:, + authorization_url:, + scopes: nil, + authorization_details_types: nil, + access_token_duration: nil, + refresh_token_duration: nil, + public_access_token_duration: nil, + public_refresh_token_duration: nil, + installation_access_token_duration: nil, + confidential_pkce: nil, + verification_url: nil, + user_code_length: nil, + user_code_format: nil, + device_code_duration: nil, + default_scopes: nil, + installation_scopes: nil + ) api_path = '/project/oauth2-server' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end if authorization_url.nil? - raise Appwrite::Exception.new('Missing required parameter: "authorizationUrl"') + raise Appwrite::Exception.new('Missing required parameter: "authorizationUrl"') end api_params = { @@ -558,7 +589,7 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati defaultScopes: default_scopes, installationScopes: installation_scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -572,17 +603,20 @@ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorizati params: api_params, response_type: Models::Project ) - end # Update the project OAuth2 Amazon configuration. # - # @param [String] client_id 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + # @param [String] client_id 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Amazon] - def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_amazon( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/amazon' api_params = { @@ -590,7 +624,7 @@ def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -604,19 +638,24 @@ def update_o_auth2_amazon(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Amazon ) - end # Update the project OAuth2 Apple configuration. # - # @param [String] service_id 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - # @param [String] key_id 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - # @param [String] team_id 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + # @param [String] service_id 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + # @param [String] key_id 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + # @param [String] team_id 'Team ID' of Apple OAuth2 app. For example: D4000000R6 # @param [String] p8_file Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Apple] - def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: nil, enabled: nil) + def update_o_auth2_apple( + service_id: nil, + key_id: nil, + team_id: nil, + p8_file: nil, + enabled: nil + ) api_path = '/project/oauth2/apple' api_params = { @@ -626,7 +665,7 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni p8File: p8_file, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -640,17 +679,20 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni params: api_params, response_type: Models::OAuth2Apple ) - end # Update the project OAuth2 Appwrite configuration. # - # @param [String] client_id 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 - # @param [String] client_secret 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 + # @param [String] client_id 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 + # @param [String] client_secret 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Appwrite] - def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_appwrite( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/appwrite' api_params = { @@ -658,7 +700,7 @@ def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -672,18 +714,22 @@ def update_o_auth2_appwrite(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Appwrite ) - end # Update the project OAuth2 Auth0 configuration. # - # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF # @param [String] endpoint Domain of Auth0 instance. For example: example.us.auth0.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Auth0] - def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_auth0( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/auth0' api_params = { @@ -692,7 +738,7 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -706,18 +752,22 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab params: api_params, response_type: Models::OAuth2Auth0 ) - end # Update the project OAuth2 Authentik configuration. # - # @param [String] client_id 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + # @param [String] client_id 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK # @param [String] endpoint Domain of Authentik instance. For example: example.authentik.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Authentik] - def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_authentik( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/authentik' api_params = { @@ -726,7 +776,7 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -740,17 +790,20 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, params: api_params, response_type: Models::OAuth2Authentik ) - end # Update the project OAuth2 Autodesk configuration. # - # @param [String] client_id 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + # @param [String] client_id 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Autodesk] - def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_autodesk( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/autodesk' api_params = { @@ -758,7 +811,7 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -772,17 +825,20 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Autodesk ) - end # Update the project OAuth2 Bitbucket configuration. # - # @param [String] key 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + # @param [String] key 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitbucket] - def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) + def update_o_auth2_bitbucket( + key: nil, + secret: nil, + enabled: nil + ) api_path = '/project/oauth2/bitbucket' api_params = { @@ -790,7 +846,7 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) secret: secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -804,17 +860,20 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Bitbucket ) - end # Update the project OAuth2 Bitly configuration. # - # @param [String] client_id 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + # @param [String] client_id 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitly] - def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_bitly( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/bitly' api_params = { @@ -822,7 +881,7 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -836,17 +895,20 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Bitly ) - end # Update the project OAuth2 Box configuration. # - # @param [String] client_id 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + # @param [String] client_id 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Box] - def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_box( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/box' api_params = { @@ -854,7 +916,7 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -868,17 +930,20 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Box ) - end # Update the project OAuth2 Dailymotion configuration. # - # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dailymotion] - def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) + def update_o_auth2_dailymotion( + api_key: nil, + api_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/dailymotion' api_params = { @@ -886,7 +951,7 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) apiSecret: api_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -900,17 +965,20 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Dailymotion ) - end # Update the project OAuth2 Discord configuration. # - # @param [String] client_id 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + # @param [String] client_id 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Discord] - def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_discord( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/discord' api_params = { @@ -918,7 +986,7 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -932,17 +1000,20 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Discord ) - end # Update the project OAuth2 Disqus configuration. # - # @param [String] public_key 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + # @param [String] public_key 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Disqus] - def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) + def update_o_auth2_disqus( + public_key: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/disqus' api_params = { @@ -950,7 +1021,7 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -964,17 +1035,20 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Disqus ) - end # Update the project OAuth2 Dropbox configuration. # - # @param [String] app_key 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + # @param [String] app_key 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dropbox] - def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) + def update_o_auth2_dropbox( + app_key: nil, + app_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/dropbox' api_params = { @@ -982,7 +1056,7 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) appSecret: app_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -996,17 +1070,20 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Dropbox ) - end # Update the project OAuth2 Etsy configuration. # - # @param [String] key_string 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + # @param [String] key_string 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Etsy] - def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) + def update_o_auth2_etsy( + key_string: nil, + shared_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/etsy' api_params = { @@ -1014,7 +1091,7 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) sharedSecret: shared_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1028,17 +1105,20 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Etsy ) - end # Update the project OAuth2 Facebook configuration. # - # @param [String] app_id 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + # @param [String] app_id 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Facebook] - def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) + def update_o_auth2_facebook( + app_id: nil, + app_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/facebook' api_params = { @@ -1046,7 +1126,7 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) appSecret: app_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1060,17 +1140,20 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Facebook ) - end # Update the project OAuth2 Figma configuration. # - # @param [String] client_id 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + # @param [String] client_id 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Figma] - def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_figma( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/figma' api_params = { @@ -1078,7 +1161,7 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1092,18 +1175,22 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Figma ) - end # Update the project OAuth2 FusionAuth configuration. # - # @param [String] client_id 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + # @param [String] client_id 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc # @param [String] endpoint Domain of FusionAuth instance. For example: example.fusionauth.io # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2FusionAuth] - def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_fusion_auth( + client_id: nil, + client_secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/fusionauth' api_params = { @@ -1112,7 +1199,7 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1126,17 +1213,20 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil params: api_params, response_type: Models::OAuth2FusionAuth ) - end # Update the project OAuth2 GitHub configuration. # - # @param [String] client_id 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + # @param [String] client_id 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Github] - def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_git_hub( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/github' api_params = { @@ -1144,7 +1234,7 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1158,18 +1248,22 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Github ) - end # Update the project OAuth2 Gitlab configuration. # - # @param [String] application_id 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + # @param [String] application_id 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 # @param [String] endpoint Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Gitlab] - def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabled: nil) + def update_o_auth2_gitlab( + application_id: nil, + secret: nil, + endpoint: nil, + enabled: nil + ) api_path = '/project/oauth2/gitlab' api_params = { @@ -1178,7 +1272,7 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl endpoint: endpoint, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1192,18 +1286,22 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl params: api_params, response_type: Models::OAuth2Gitlab ) - end # Update the project OAuth2 Google configuration. # - # @param [String] client_id 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj - # @param [Array] prompt Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + # @param [String] client_id 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + # @param [Array] prompt Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Google] - def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabled: nil) + def update_o_auth2_google( + client_id: nil, + client_secret: nil, + prompt: nil, + enabled: nil + ) api_path = '/project/oauth2/google' api_params = { @@ -1212,7 +1310,7 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabl prompt: prompt, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1226,19 +1324,59 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabl params: api_params, response_type: Models::OAuth2Google ) + end + + # Update the project OAuth2 Hugging Face configuration. + # + # @param [String] client_id 'Client ID' of Hugging Face OAuth2 app. For example: 2ab9cff9-d711-40ad-a91e-b08a49c42d24 + # @param [String] client_secret 'Client Secret' of Hugging Face OAuth2 app. For example: oauth_app_secret_wcLhRtl000000000000000000000xbNdLt + # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + # + # @return [OAuth2HuggingFace] + def update_o_auth2_hugging_face( + client_id: nil, + client_secret: nil, + enabled: nil + ) + api_path = '/project/oauth2/huggingface' + + api_params = { + clientId: client_id, + clientSecret: client_secret, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::OAuth2HuggingFace + ) end # Update the project OAuth2 Keycloak configuration. # - # @param [String] client_id 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + # @param [String] client_id 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO # @param [String] endpoint Domain of Keycloak instance. For example: keycloak.example.com # @param [String] realm_name Keycloak realm name. For example: appwrite-realm # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Keycloak] - def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, realm_name: nil, enabled: nil) + def update_o_auth2_keycloak( + client_id: nil, + client_secret: nil, + endpoint: nil, + realm_name: nil, + enabled: nil + ) api_path = '/project/oauth2/keycloak' api_params = { @@ -1248,7 +1386,7 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r realmName: realm_name, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1262,17 +1400,20 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r params: api_params, response_type: Models::OAuth2Keycloak ) - end # Update the project OAuth2 Kick configuration. # - # @param [String] client_id 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + # @param [String] client_id 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Kick] - def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_kick( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/kick' api_params = { @@ -1280,7 +1421,7 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1294,17 +1435,20 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Kick ) - end # Update the project OAuth2 Linkedin configuration. # - # @param [String] client_id 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + # @param [String] client_id 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Linkedin] - def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: nil) + def update_o_auth2_linkedin( + client_id: nil, + primary_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/linkedin' api_params = { @@ -1312,7 +1456,7 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: primaryClientSecret: primary_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1326,18 +1470,22 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: params: api_params, response_type: Models::OAuth2Linkedin ) - end # Update the project OAuth2 Microsoft configuration. # - # @param [String] application_id 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - # @param [String] tenant Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + # @param [String] application_id 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + # @param [String] tenant Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Microsoft] - def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenant: nil, enabled: nil) + def update_o_auth2_microsoft( + application_id: nil, + application_secret: nil, + tenant: nil, + enabled: nil + ) api_path = '/project/oauth2/microsoft' api_params = { @@ -1346,7 +1494,7 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan tenant: tenant, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1360,17 +1508,20 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan params: api_params, response_type: Models::OAuth2Microsoft ) - end # Update the project OAuth2 Notion configuration. # - # @param [String] oauth_client_id 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + # @param [String] oauth_client_id 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Notion] - def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enabled: nil) + def update_o_auth2_notion( + oauth_client_id: nil, + oauth_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/notion' api_params = { @@ -1378,7 +1529,7 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable oauthClientSecret: oauth_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1392,23 +1543,32 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable params: api_params, response_type: Models::OAuth2Notion ) - end # Update the project OAuth2 Oidc configuration. # - # @param [String] client_id 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + # @param [String] client_id 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV # @param [String] well_known_url OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration # @param [String] authorization_url OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize # @param [String] token_url OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token # @param [String] user_info_url OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - # @param [Array] prompt Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + # @param [Array] prompt Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. # @param [Integer] max_age Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds, otherwise they are prompted to re-authenticate. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Oidc] - def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, authorization_url: nil, token_url: nil, user_info_url: nil, prompt: nil, max_age: nil, enabled: nil) + def update_o_auth2_oidc( + client_id: nil, + client_secret: nil, + well_known_url: nil, + authorization_url: nil, + token_url: nil, + user_info_url: nil, + prompt: nil, + max_age: nil, + enabled: nil + ) api_path = '/project/oauth2/oidc' api_params = { @@ -1422,7 +1582,7 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, maxAge: max_age, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1436,19 +1596,24 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, params: api_params, response_type: Models::OAuth2Oidc ) - end # Update the project OAuth2 Okta configuration. # - # @param [String] client_id 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + # @param [String] client_id 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV # @param [String] domain Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ # @param [String] authorization_server_id Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Okta] - def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authorization_server_id: nil, enabled: nil) + def update_o_auth2_okta( + client_id: nil, + client_secret: nil, + domain: nil, + authorization_server_id: nil, + enabled: nil + ) api_path = '/project/oauth2/okta' api_params = { @@ -1458,7 +1623,7 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori authorizationServerId: authorization_server_id, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1472,17 +1637,20 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori params: api_params, response_type: Models::OAuth2Okta ) - end # Update the project OAuth2 Paypal configuration. # - # @param [String] client_id 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + # @param [String] client_id 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] - def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) + def update_o_auth2_paypal( + client_id: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/paypal' api_params = { @@ -1490,7 +1658,7 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1504,17 +1672,20 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Paypal ) - end # Update the project OAuth2 PaypalSandbox configuration. # - # @param [String] client_id 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + # @param [String] client_id 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] - def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) + def update_o_auth2_paypal_sandbox( + client_id: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/paypalSandbox' api_params = { @@ -1522,7 +1693,7 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1536,17 +1707,20 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Paypal ) - end # Update the project OAuth2 Podio configuration. # - # @param [String] client_id 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + # @param [String] client_id 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Podio] - def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_podio( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/podio' api_params = { @@ -1554,7 +1728,7 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1568,17 +1742,20 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Podio ) - end # Update the project OAuth2 Salesforce configuration. # - # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Salesforce] - def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: nil) + def update_o_auth2_salesforce( + customer_key: nil, + customer_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/salesforce' api_params = { @@ -1586,7 +1763,7 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: customerSecret: customer_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1600,17 +1777,20 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: params: api_params, response_type: Models::OAuth2Salesforce ) - end # Update the project OAuth2 Slack configuration. # - # @param [String] client_id 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + # @param [String] client_id 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Slack] - def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_slack( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/slack' api_params = { @@ -1618,7 +1798,7 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1632,17 +1812,20 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Slack ) - end # Update the project OAuth2 Spotify configuration. # - # @param [String] client_id 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + # @param [String] client_id 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Spotify] - def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_spotify( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/spotify' api_params = { @@ -1650,7 +1833,7 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1664,17 +1847,20 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Spotify ) - end # Update the project OAuth2 Stripe configuration. # - # @param [String] client_id 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + # @param [String] client_id 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Stripe] - def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) + def update_o_auth2_stripe( + client_id: nil, + api_secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/stripe' api_params = { @@ -1682,7 +1868,7 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) apiSecretKey: api_secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1696,17 +1882,20 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Stripe ) - end # Update the project OAuth2 Tradeshift configuration. # - # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] - def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, enabled: nil) + def update_o_auth2_tradeshift( + oauth2_client_id: nil, + oauth2_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/tradeshift' api_params = { @@ -1714,7 +1903,7 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, oauth2ClientSecret: oauth2_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1728,17 +1917,20 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, params: api_params, response_type: Models::OAuth2Tradeshift ) - end # Update the project OAuth2 Tradeshift Sandbox configuration. # - # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] - def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secret: nil, enabled: nil) + def update_o_auth2_tradeshift_sandbox( + oauth2_client_id: nil, + oauth2_client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/tradeshiftBox' api_params = { @@ -1746,7 +1938,7 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre oauth2ClientSecret: oauth2_client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1760,17 +1952,20 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre params: api_params, response_type: Models::OAuth2Tradeshift ) - end # Update the project OAuth2 Twitch configuration. # - # @param [String] client_id 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + # @param [String] client_id 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Twitch] - def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_twitch( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/twitch' api_params = { @@ -1778,7 +1973,7 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1792,17 +1987,20 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Twitch ) - end # Update the project OAuth2 WordPress configuration. # - # @param [String] client_id 'Client ID' of WordPress OAuth2 app. For example: 130005 - # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + # @param [String] client_id 'Client ID' of WordPress OAuth2 app. For example: 130005 + # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2WordPress] - def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_word_press( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/wordpress' api_params = { @@ -1810,7 +2008,7 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1824,17 +2022,20 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2WordPress ) - end # Update the project OAuth2 X configuration. # - # @param [String] customer_key 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + # @param [String] customer_key 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2X] - def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) + def update_o_auth2_x( + customer_key: nil, + secret_key: nil, + enabled: nil + ) api_path = '/project/oauth2/x' api_params = { @@ -1842,7 +2043,7 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) secretKey: secret_key, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1856,17 +2057,20 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) params: api_params, response_type: Models::OAuth2X ) - end # Update the project OAuth2 Yahoo configuration. # - # @param [String] client_id 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + # @param [String] client_id 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yahoo] - def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_yahoo( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/yahoo' api_params = { @@ -1874,7 +2078,7 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1888,17 +2092,20 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Yahoo ) - end # Update the project OAuth2 Yandex configuration. # - # @param [String] client_id 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + # @param [String] client_id 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yandex] - def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_yandex( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/yandex' api_params = { @@ -1906,7 +2113,7 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1920,17 +2127,20 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Yandex ) - end # Update the project OAuth2 Zoho configuration. # - # @param [String] client_id 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + # @param [String] client_id 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoho] - def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_zoho( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/zoho' api_params = { @@ -1938,7 +2148,7 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1952,17 +2162,20 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Zoho ) - end # Update the project OAuth2 Zoom configuration. # - # @param [String] client_id 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + # @param [String] client_id 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoom] - def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_zoom( + client_id: nil, + client_secret: nil, + enabled: nil + ) api_path = '/project/oauth2/zoom' api_params = { @@ -1970,7 +2183,7 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) clientSecret: client_secret, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1984,7 +2197,6 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) params: api_params, response_type: Models::OAuth2Zoom ) - end # Get a single OAuth2 provider configuration. Credential fields (client @@ -1992,18 +2204,19 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) # # @param [ProjectOAuthProviderId] provider_id OAuth2 provider key. For example: github, google, apple. # - # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] - def get_o_auth2_provider(provider_id:) + # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] + def get_o_auth2_provider( + provider_id: + ) api_path = '/project/oauth2/{providerId}' .gsub('{providerId}', provider_id) if provider_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerId"') + raise Appwrite::Exception.new('Missing required parameter: "providerId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2135,6 +2348,11 @@ def get_o_auth2_provider(provider_id:) return Models::OAuth2Yahoo.from(map: response) end + if response['$id'] == 'huggingface' + + return Models::OAuth2HuggingFace.from(map: response) + end + if response['$id'] == 'linkedin' return Models::OAuth2Linkedin.from(map: response) @@ -2221,7 +2439,6 @@ def get_o_auth2_provider(provider_id:) end raise Exception, "Unable to match response to any expected response model" - end # Get a list of all platforms in the project. This endpoint returns an array @@ -2231,14 +2448,17 @@ def get_o_auth2_provider(provider_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [PlatformList] - def list_platforms(queries: nil, total: nil) + def list_platforms( + queries: nil, + total: nil + ) api_path = '/project/platforms' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2251,31 +2471,34 @@ def list_platforms(queries: nil, total: nil) params: api_params, response_type: Models::PlatformList ) - end # Create a new Android platform for your project. Use this endpoint to # register a new Android platform where your users will run your application # which will interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] application_id Android application ID. Max length: 256 chars. # # @return [PlatformAndroid] - def create_android_platform(platform_id:, name:, application_id:) + def create_android_platform( + platform_id:, + name:, + application_id: + ) api_path = '/project/platforms/android' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if application_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "applicationId"') + raise Appwrite::Exception.new('Missing required parameter: "applicationId"') end api_params = { @@ -2283,7 +2506,7 @@ def create_android_platform(platform_id:, name:, application_id:) name: name, applicationId: application_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2297,38 +2520,41 @@ def create_android_platform(platform_id:, name:, application_id:) params: api_params, response_type: Models::PlatformAndroid ) - end # Update an Android platform by its unique ID. Use this endpoint to update - # the platform's name or application ID. + # the platform's name or application ID. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] application_id Android application ID. Max length: 256 chars. # # @return [PlatformAndroid] - def update_android_platform(platform_id:, name:, application_id:) + def update_android_platform( + platform_id:, + name:, + application_id: + ) api_path = '/project/platforms/android/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if application_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "applicationId"') + raise Appwrite::Exception.new('Missing required parameter: "applicationId"') end api_params = { name: name, applicationId: application_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2342,31 +2568,34 @@ def update_android_platform(platform_id:, name:, application_id:) params: api_params, response_type: Models::PlatformAndroid ) - end # Create a new Apple platform for your project. Use this endpoint to register # a new Apple platform where your users will run your application which will # interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] bundle_identifier Apple bundle identifier. Max length: 256 chars. # # @return [PlatformApple] - def create_apple_platform(platform_id:, name:, bundle_identifier:) + def create_apple_platform( + platform_id:, + name:, + bundle_identifier: + ) api_path = '/project/platforms/apple' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if bundle_identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') + raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') end api_params = { @@ -2374,7 +2603,7 @@ def create_apple_platform(platform_id:, name:, bundle_identifier:) name: name, bundleIdentifier: bundle_identifier, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2388,38 +2617,41 @@ def create_apple_platform(platform_id:, name:, bundle_identifier:) params: api_params, response_type: Models::PlatformApple ) - end # Update an Apple platform by its unique ID. Use this endpoint to update the - # platform's name or bundle identifier. + # platform's name or bundle identifier. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] bundle_identifier Apple bundle identifier. Max length: 256 chars. # # @return [PlatformApple] - def update_apple_platform(platform_id:, name:, bundle_identifier:) + def update_apple_platform( + platform_id:, + name:, + bundle_identifier: + ) api_path = '/project/platforms/apple/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if bundle_identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') + raise Appwrite::Exception.new('Missing required parameter: "bundleIdentifier"') end api_params = { name: name, bundleIdentifier: bundle_identifier, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2433,31 +2665,34 @@ def update_apple_platform(platform_id:, name:, bundle_identifier:) params: api_params, response_type: Models::PlatformApple ) - end # Create a new Linux platform for your project. Use this endpoint to register # a new Linux platform where your users will run your application which will # interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_name Linux package name. Max length: 256 chars. # # @return [PlatformLinux] - def create_linux_platform(platform_id:, name:, package_name:) + def create_linux_platform( + platform_id:, + name:, + package_name: + ) api_path = '/project/platforms/linux' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageName"') + raise Appwrite::Exception.new('Missing required parameter: "packageName"') end api_params = { @@ -2465,7 +2700,7 @@ def create_linux_platform(platform_id:, name:, package_name:) name: name, packageName: package_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2479,38 +2714,41 @@ def create_linux_platform(platform_id:, name:, package_name:) params: api_params, response_type: Models::PlatformLinux ) - end # Update a Linux platform by its unique ID. Use this endpoint to update the - # platform's name or package name. + # platform's name or package name. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_name Linux package name. Max length: 256 chars. # # @return [PlatformLinux] - def update_linux_platform(platform_id:, name:, package_name:) + def update_linux_platform( + platform_id:, + name:, + package_name: + ) api_path = '/project/platforms/linux/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageName"') + raise Appwrite::Exception.new('Missing required parameter: "packageName"') end api_params = { name: name, packageName: package_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2524,31 +2762,34 @@ def update_linux_platform(platform_id:, name:, package_name:) params: api_params, response_type: Models::PlatformLinux ) - end # Create a new web platform for your project. Use this endpoint to register a # new platform where your users will run your application which will interact # with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] hostname Platform web hostname. Max length: 256 chars. # # @return [PlatformWeb] - def create_web_platform(platform_id:, name:, hostname:) + def create_web_platform( + platform_id:, + name:, + hostname: + ) api_path = '/project/platforms/web' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if hostname.nil? - raise Appwrite::Exception.new('Missing required parameter: "hostname"') + raise Appwrite::Exception.new('Missing required parameter: "hostname"') end api_params = { @@ -2556,7 +2797,7 @@ def create_web_platform(platform_id:, name:, hostname:) name: name, hostname: hostname, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2570,38 +2811,41 @@ def create_web_platform(platform_id:, name:, hostname:) params: api_params, response_type: Models::PlatformWeb ) - end # Update a web platform by its unique ID. Use this endpoint to update the - # platform's name or hostname. + # platform's name or hostname. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] hostname Platform web hostname. Max length: 256 chars. # # @return [PlatformWeb] - def update_web_platform(platform_id:, name:, hostname:) + def update_web_platform( + platform_id:, + name:, + hostname: + ) api_path = '/project/platforms/web/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if hostname.nil? - raise Appwrite::Exception.new('Missing required parameter: "hostname"') + raise Appwrite::Exception.new('Missing required parameter: "hostname"') end api_params = { name: name, hostname: hostname, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2615,31 +2859,34 @@ def update_web_platform(platform_id:, name:, hostname:) params: api_params, response_type: Models::PlatformWeb ) - end # Create a new Windows platform for your project. Use this endpoint to # register a new Windows platform where your users will run your application # which will interact with the Appwrite API. # - # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] platform_id Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_identifier_name Windows package identifier name. Max length: 256 chars. # # @return [PlatformWindows] - def create_windows_platform(platform_id:, name:, package_identifier_name:) + def create_windows_platform( + platform_id:, + name:, + package_identifier_name: + ) api_path = '/project/platforms/windows' if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_identifier_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') + raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') end api_params = { @@ -2647,7 +2894,7 @@ def create_windows_platform(platform_id:, name:, package_identifier_name:) name: name, packageIdentifierName: package_identifier_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2661,38 +2908,41 @@ def create_windows_platform(platform_id:, name:, package_identifier_name:) params: api_params, response_type: Models::PlatformWindows ) - end # Update a Windows platform by its unique ID. Use this endpoint to update the - # platform's name or package identifier name. + # platform's name or package identifier name. # # @param [String] platform_id Platform ID. # @param [String] name Platform name. Max length: 128 chars. # @param [String] package_identifier_name Windows package identifier name. Max length: 256 chars. # # @return [PlatformWindows] - def update_windows_platform(platform_id:, name:, package_identifier_name:) + def update_windows_platform( + platform_id:, + name:, + package_identifier_name: + ) api_path = '/project/platforms/windows/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if package_identifier_name.nil? - raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') + raise Appwrite::Exception.new('Missing required parameter: "packageIdentifierName"') end api_params = { name: name, packageIdentifierName: package_identifier_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2706,26 +2956,26 @@ def update_windows_platform(platform_id:, name:, package_identifier_name:) params: api_params, response_type: Models::PlatformWindows ) - end - # Get a platform by its unique ID. This endpoint returns the platform's + # Get a platform by its unique ID. This endpoint returns the platform's # details, including its name, type, and key configurations. # # @param [String] platform_id Platform ID. # # @return [PlatformWeb, PlatformApple, PlatformAndroid, PlatformWindows, PlatformLinux] - def get_platform(platform_id:) + def get_platform( + platform_id: + ) api_path = '/project/platforms/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2768,7 +3018,6 @@ def get_platform(platform_id:) end raise Exception, "Unable to match response to any expected response model" - end # Delete a platform by its unique ID. This endpoint removes the platform and @@ -2777,17 +3026,18 @@ def get_platform(platform_id:) # @param [String] platform_id Platform ID. # # @return [] - def delete_platform(platform_id:) + def delete_platform( + platform_id: + ) api_path = '/project/platforms/{platformId}' .gsub('{platformId}', platform_id) if platform_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "platformId"') + raise Appwrite::Exception.new('Missing required parameter: "platformId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2799,7 +3049,6 @@ def delete_platform(platform_id:) headers: api_headers, params: api_params, ) - end # Get a list of all project policies and their current configuration. @@ -2808,14 +3057,17 @@ def delete_platform(platform_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [PolicyList] - def list_policies(queries: nil, total: nil) + def list_policies( + queries: nil, + total: nil + ) api_path = '/project/policies' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -2828,7 +3080,6 @@ def list_policies(queries: nil, total: nil) params: api_params, response_type: Models::PolicyList ) - end # Configures if aliased emails such as subaddresses and emails with suffixes @@ -2837,17 +3088,19 @@ def list_policies(queries: nil, total: nil) # @param [] enabled Set whether or not to block aliased emails during signup and email updates. # # @return [Project] - def update_deny_aliased_email_policy(enabled:) + def update_deny_aliased_email_policy( + enabled: + ) api_path = '/project/policies/deny-aliased-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2861,7 +3114,6 @@ def update_deny_aliased_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if only corporate email addresses (non-free and non-disposable @@ -2870,17 +3122,19 @@ def update_deny_aliased_email_policy(enabled:) # @param [] enabled Set whether or not to restrict sign-ups and email updates to corporate email addresses only. # # @return [Project] - def update_deny_corporate_email_policy(enabled:) + def update_deny_corporate_email_policy( + enabled: + ) api_path = '/project/policies/deny-corporate-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2894,7 +3148,6 @@ def update_deny_corporate_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if disposable emails from known temporary domains are denied @@ -2903,17 +3156,19 @@ def update_deny_corporate_email_policy(enabled:) # @param [] enabled Set whether or not to block disposable email addresses during signup and email updates. # # @return [Project] - def update_deny_disposable_email_policy(enabled:) + def update_deny_disposable_email_policy( + enabled: + ) api_path = '/project/policies/deny-disposable-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2927,7 +3182,6 @@ def update_deny_disposable_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Configures if emails from free providers such as Gmail or Yahoo are denied @@ -2936,17 +3190,19 @@ def update_deny_disposable_email_policy(enabled:) # @param [] enabled Set whether or not to block free email addresses during signup and email updates. # # @return [Project] - def update_deny_free_email_policy(enabled:) + def update_deny_free_email_policy( + enabled: + ) api_path = '/project/policies/deny-free-email' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2960,7 +3216,6 @@ def update_deny_free_email_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if team members can see other @@ -2975,7 +3230,14 @@ def update_deny_free_email_policy(enabled:) # @param [] user_accessed_at Set to true if you want make user last access time visible to all team members, or false to hide it. # # @return [Project] - def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: nil, user_name: nil, user_mfa: nil, user_accessed_at: nil) + def update_membership_privacy_policy( + user_id: nil, + user_email: nil, + user_phone: nil, + user_name: nil, + user_mfa: nil, + user_accessed_at: nil + ) api_path = '/project/policies/membership-privacy' api_params = { @@ -2986,7 +3248,7 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: userMFA: user_mfa, userAccessedAt: user_accessed_at, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3000,7 +3262,6 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control which factors users can use to @@ -3015,7 +3276,12 @@ def update_membership_privacy_policy(user_id: nil, user_email: nil, user_phone: # @param [] custom Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. # # @return [Project] - def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) + def update_mfa_factors_policy( + totp: nil, + email: nil, + phone: nil, + custom: nil + ) api_path = '/project/policies/mfa-factors' api_params = { @@ -3024,7 +3290,7 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) phone: phone, custom: custom, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3038,7 +3304,6 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if new passwords are checked @@ -3048,17 +3313,19 @@ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil) # @param [] enabled Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. # # @return [Project] - def update_password_dictionary_policy(enabled:) + def update_password_dictionary_policy( + enabled: + ) api_path = '/project/policies/password-dictionary' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3072,14 +3339,13 @@ def update_password_dictionary_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Updates one of password strength policies. Based on total length # configured, previous password hashes are stored, and users cannot choose a # new password that is already stored in the passwird history list, when # updating an user password, or setting new one through password recovery. - # + # # Keep in mind, while password history policy is disabled, the history is not # being stored. Enabling the policy will not have any history on existing # users, and it will only start to collect and enforce the policy on password @@ -3088,17 +3354,19 @@ def update_password_dictionary_policy(enabled:) # @param [Integer] total Set the password history length per user. Value can be between 1 and 20, or null to disable the limit. # # @return [Project] - def update_password_history_policy(total:) + def update_password_history_policy( + total: + ) api_path = '/project/policies/password-history' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3112,7 +3380,6 @@ def update_password_history_policy(total:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if password strength is checked @@ -3120,20 +3387,22 @@ def update_password_history_policy(total:) # password, the password must not contain user ID, name, email or phone # number. # - # @param [] enabled Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + # @param [] enabled Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. # # @return [Project] - def update_password_personal_data_policy(enabled:) + def update_password_personal_data_policy( + enabled: + ) api_path = '/project/policies/password-personal-data' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3147,7 +3416,6 @@ def update_password_personal_data_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update the password strength requirements for users in the project. @@ -3159,7 +3427,13 @@ def update_password_personal_data_policy(enabled:) # @param [] symbols Whether passwords must include at least one symbol. # # @return [PolicyPasswordStrength] - def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, number: nil, symbols: nil) + def update_password_strength_policy( + min: nil, + uppercase: nil, + lowercase: nil, + number: nil, + symbols: nil + ) api_path = '/project/policies/password-strength' api_params = { @@ -3169,7 +3443,7 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu number: number, symbols: symbols, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3183,7 +3457,6 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu params: api_params, response_type: Models::PolicyPasswordStrength ) - end # Updating this policy allows you to control if email alert is sent upon @@ -3195,17 +3468,19 @@ def update_password_strength_policy(min: nil, uppercase: nil, lowercase: nil, nu # @param [] enabled Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. # # @return [Project] - def update_session_alert_policy(enabled:) + def update_session_alert_policy( + enabled: + ) api_path = '/project/policies/session-alert' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3219,7 +3494,6 @@ def update_session_alert_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update maximum duration how long sessions created within a project should @@ -3228,17 +3502,19 @@ def update_session_alert_policy(enabled:) # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds. # # @return [Project] - def update_session_duration_policy(duration:) + def update_session_duration_policy( + duration: + ) api_path = '/project/policies/session-duration' if duration.nil? - raise Appwrite::Exception.new('Missing required parameter: "duration"') + raise Appwrite::Exception.new('Missing required parameter: "duration"') end api_params = { duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3252,7 +3528,6 @@ def update_session_duration_policy(duration:) params: api_params, response_type: Models::Project ) - end # Updating this policy allows you to control if existing sessions should be @@ -3262,17 +3537,19 @@ def update_session_duration_policy(duration:) # @param [] enabled Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. # # @return [Project] - def update_session_invalidation_policy(enabled:) + def update_session_invalidation_policy( + enabled: + ) api_path = '/project/policies/session-invalidation' if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3286,7 +3563,6 @@ def update_session_invalidation_policy(enabled:) params: api_params, response_type: Models::Project ) - end # Update the maximum number of sessions allowed per user. When the limit is @@ -3295,17 +3571,19 @@ def update_session_invalidation_policy(enabled:) # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 100. # # @return [Project] - def update_session_limit_policy(total:) + def update_session_limit_policy( + total: + ) api_path = '/project/policies/session-limit' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3319,7 +3597,6 @@ def update_session_limit_policy(total:) params: api_params, response_type: Models::Project ) - end # Update the maximum number of users in the project. When the limit is hit or @@ -3329,17 +3606,19 @@ def update_session_limit_policy(total:) # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit. # # @return [Project] - def update_user_limit_policy(total:) + def update_user_limit_policy( + total: + ) api_path = '/project/policies/user-limit' if total.nil? - raise Appwrite::Exception.new('Missing required parameter: "total"') + raise Appwrite::Exception.new('Missing required parameter: "total"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3353,7 +3632,6 @@ def update_user_limit_policy(total:) params: api_params, response_type: Models::Project ) - end # Get a policy by its unique ID. This endpoint returns the current @@ -3362,17 +3640,18 @@ def update_user_limit_policy(total:) # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. # # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail] - def get_policy(policy_id:) + def get_policy( + policy_id: + ) api_path = '/project/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "policyId"') + raise Appwrite::Exception.new('Missing required parameter: "policyId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3465,32 +3744,34 @@ def get_policy(policy_id:) end raise Exception, "Unable to match response to any expected response model" - end # Update properties of a specific protocol. Use this endpoint to enable or - # disable a protocol in your project. + # disable a protocol in your project. # # @param [ProjectProtocolId] protocol_id Protocol name. Can be one of: rest, graphql, websocket # @param [] enabled Protocol status. # # @return [Project] - def update_protocol(protocol_id:, enabled:) + def update_protocol( + protocol_id:, + enabled: + ) api_path = '/project/protocols/{protocolId}' .gsub('{protocolId}', protocol_id) if protocol_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "protocolId"') + raise Appwrite::Exception.new('Missing required parameter: "protocolId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3504,32 +3785,34 @@ def update_protocol(protocol_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Update properties of a specific service. Use this endpoint to enable or - # disable a service in your project. + # disable a service in your project. # # @param [ProjectServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 # @param [] enabled Service status. # # @return [Project] - def update_service(service_id:, enabled:) + def update_service( + service_id:, + enabled: + ) api_path = '/project/services/{serviceId}' .gsub('{serviceId}', service_id) if service_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "serviceId"') + raise Appwrite::Exception.new('Missing required parameter: "serviceId"') end if enabled.nil? - raise Appwrite::Exception.new('Missing required parameter: "enabled"') + raise Appwrite::Exception.new('Missing required parameter: "enabled"') end api_params = { enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3543,11 +3826,10 @@ def update_service(service_id:, enabled:) params: api_params, response_type: Models::Project ) - end # Update the SMTP configuration for your project. Use this endpoint to - # configure your project's SMTP provider with your custom settings for + # configure your project's SMTP provider with your custom settings for # sending transactional emails. # # @param [String] host SMTP server hostname (domain) @@ -3562,7 +3844,18 @@ def update_service(service_id:, enabled:) # @param [] enabled Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. # # @return [Project] - def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email: nil, sender_name: nil, reply_to_email: nil, reply_to_name: nil, secure: nil, enabled: nil) + def update_smtp( + host: nil, + port: nil, + username: nil, + password: nil, + sender_email: nil, + sender_name: nil, + reply_to_email: nil, + reply_to_name: nil, + secure: nil, + enabled: nil + ) api_path = '/project/smtp' api_params = { @@ -3577,7 +3870,7 @@ def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email secure: secure, enabled: enabled, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3591,25 +3884,26 @@ def update_smtp(host: nil, port: nil, username: nil, password: nil, sender_email params: api_params, response_type: Models::Project ) - end - # Send a test email to verify SMTP configuration. + # Send a test email to verify SMTP configuration. # # @param [Array] emails Array of emails to send test email to. Maximum of 10 emails are allowed. # # @return [] - def create_smtp_test(emails:) + def create_smtp_test( + emails: + ) api_path = '/project/smtp/tests' if emails.nil? - raise Appwrite::Exception.new('Missing required parameter: "emails"') + raise Appwrite::Exception.new('Missing required parameter: "emails"') end api_params = { emails: emails, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3621,7 +3915,6 @@ def create_smtp_test(emails:) headers: api_headers, params: api_params, ) - end # Get a list of all custom email templates configured for the project. This @@ -3632,14 +3925,17 @@ def create_smtp_test(emails:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [EmailTemplateList] - def list_email_templates(queries: nil, total: nil) + def list_email_templates( + queries: nil, + total: nil + ) api_path = '/project/templates/email' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3652,7 +3948,6 @@ def list_email_templates(queries: nil, total: nil) params: api_params, response_type: Models::EmailTemplateList ) - end # Update a custom email template for the specified locale and type. Use this @@ -3668,11 +3963,20 @@ def list_email_templates(queries: nil, total: nil) # @param [String] reply_to_name Reply to name. # # @return [EmailTemplate] - def update_email_template(template_id:, locale: nil, subject: nil, message: nil, sender_name: nil, sender_email: nil, reply_to_email: nil, reply_to_name: nil) + def update_email_template( + template_id:, + locale: nil, + subject: nil, + message: nil, + sender_name: nil, + sender_email: nil, + reply_to_email: nil, + reply_to_name: nil + ) api_path = '/project/templates/email' if template_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "templateId"') + raise Appwrite::Exception.new('Missing required parameter: "templateId"') end api_params = { @@ -3685,7 +3989,7 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, replyToEmail: reply_to_email, replyToName: reply_to_name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3699,7 +4003,6 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, params: api_params, response_type: Models::EmailTemplate ) - end # Get a custom email template for the specified locale and type. This @@ -3710,18 +4013,21 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, # @param [ProjectEmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. # # @return [EmailTemplate] - def get_email_template(template_id:, locale: nil) + def get_email_template( + template_id:, + locale: nil + ) api_path = '/project/templates/email/{templateId}' .gsub('{templateId}', template_id) if template_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "templateId"') + raise Appwrite::Exception.new('Missing required parameter: "templateId"') end api_params = { locale: locale, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3734,7 +4040,6 @@ def get_email_template(template_id:, locale: nil) params: api_params, response_type: Models::EmailTemplate ) - end # Get a list of all project environment variables. @@ -3743,14 +4048,17 @@ def get_email_template(template_id:, locale: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(queries: nil, total: nil) + def list_variables( + queries: nil, + total: nil + ) api_path = '/project/variables' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3763,31 +4071,35 @@ def list_variables(queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new project environment variable. These variables can be accessed # by all functions and sites in the project. # - # @param [String] variable_id Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime. # # @return [Variable] - def create_variable(variable_id:, key:, value:, secret: nil) + def create_variable( + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/project/variables' if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -3796,7 +4108,7 @@ def create_variable(variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3810,25 +4122,25 @@ def create_variable(variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end - # Get a variable by its unique ID. + # Get a variable by its unique ID. # # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(variable_id:) + def get_variable( + variable_id: + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3841,23 +4153,27 @@ def get_variable(variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime. # # @return [Variable] - def update_variable(variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -3865,7 +4181,7 @@ def update_variable(variable_id:, key: nil, value: nil, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3879,25 +4195,25 @@ def update_variable(variable_id:, key: nil, value: nil, secret: nil) params: api_params, response_type: Models::Variable ) - end - # Delete a variable by its unique ID. + # Delete a variable by its unique ID. # # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(variable_id:) + def delete_variable( + variable_id: + ) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3909,8 +4225,6 @@ def delete_variable(variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/proxy.rb b/lib/appwrite/services/proxy.rb index 206c395..48d11c6 100644 --- a/lib/appwrite/services/proxy.rb +++ b/lib/appwrite/services/proxy.rb @@ -1,15 +1,14 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Proxy < Service - def initialize(client) @client = client end # Create a new CDN cache invalidation for a domain. Executes a hard purge of # cached content. - # + # # Depending on type, the invalidation purges a single cache tag, a single URL # path, or all cached content for the domain. # @@ -18,15 +17,19 @@ def initialize(client) # @param [String] reference Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. # # @return [ProxyInvalidation] - def create_invalidation(domain:, type:, reference: nil) + def create_invalidation( + domain:, + type:, + reference: nil + ) api_path = '/proxy/invalidations' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -34,7 +37,7 @@ def create_invalidation(domain:, type:, reference: nil) type: type, reference: reference, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -48,7 +51,6 @@ def create_invalidation(domain:, type:, reference: nil) params: api_params, response_type: Models::ProxyInvalidation ) - end # Get a list of all the proxy rules. You can use the query params to filter @@ -58,14 +60,17 @@ def create_invalidation(domain:, type:, reference: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ProxyRuleList] - def list_rules(queries: nil, total: nil) + def list_rules( + queries: nil, + total: nil + ) api_path = '/proxy/rules' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -78,28 +83,29 @@ def list_rules(queries: nil, total: nil) params: api_params, response_type: Models::ProxyRuleList ) - end - # Create a new proxy rule for serving Appwrite's API on custom domain. - # + # Create a new proxy rule for serving Appwrite's API on custom domain. + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # # @param [String] domain Domain name. # # @return [ProxyRule] - def create_api_rule(domain:) + def create_api_rule( + domain: + ) api_path = '/proxy/rules/api' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end api_params = { domain: domain, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -113,11 +119,10 @@ def create_api_rule(domain:) params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for executing Appwrite Function on custom domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -126,15 +131,19 @@ def create_api_rule(domain:) # @param [String] branch Name of VCS branch to deploy changes automatically # # @return [ProxyRule] - def create_function_rule(domain:, function_id:, branch: nil) + def create_function_rule( + domain:, + function_id:, + branch: nil + ) api_path = '/proxy/rules/function' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if function_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "functionId"') + raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { @@ -142,7 +151,7 @@ def create_function_rule(domain:, function_id:, branch: nil) functionId: function_id, branch: branch, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -156,12 +165,11 @@ def create_function_rule(domain:, function_id:, branch: nil) params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for to redirect from custom domain to another # domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -172,27 +180,33 @@ def create_function_rule(domain:, function_id:, branch: nil) # @param [ProxyResourceType] resource_type Type of parent resource. # # @return [ProxyRule] - def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_type:) + def create_redirect_rule( + domain:, + url:, + status_code:, + resource_id:, + resource_type: + ) api_path = '/proxy/rules/redirect' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if status_code.nil? - raise Appwrite::Exception.new('Missing required parameter: "statusCode"') + raise Appwrite::Exception.new('Missing required parameter: "statusCode"') end if resource_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "resourceId"') + raise Appwrite::Exception.new('Missing required parameter: "resourceId"') end if resource_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "resourceType"') + raise Appwrite::Exception.new('Missing required parameter: "resourceType"') end api_params = { @@ -202,7 +216,7 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ resourceId: resource_id, resourceType: resource_type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -216,11 +230,10 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ params: api_params, response_type: Models::ProxyRule ) - end # Create a new proxy rule for serving Appwrite Site on custom domain. - # + # # Rule ID is automatically generated as MD5 hash of a rule domain for # performance purposes. # @@ -229,15 +242,19 @@ def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_typ # @param [String] branch Name of VCS branch to deploy changes automatically # # @return [ProxyRule] - def create_site_rule(domain:, site_id:, branch: nil) + def create_site_rule( + domain:, + site_id:, + branch: nil + ) api_path = '/proxy/rules/site' if domain.nil? - raise Appwrite::Exception.new('Missing required parameter: "domain"') + raise Appwrite::Exception.new('Missing required parameter: "domain"') end if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { @@ -245,7 +262,7 @@ def create_site_rule(domain:, site_id:, branch: nil) siteId: site_id, branch: branch, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -259,7 +276,6 @@ def create_site_rule(domain:, site_id:, branch: nil) params: api_params, response_type: Models::ProxyRule ) - end # Get a proxy rule by its unique ID. @@ -267,17 +283,18 @@ def create_site_rule(domain:, site_id:, branch: nil) # @param [String] rule_id Rule ID. # # @return [ProxyRule] - def get_rule(rule_id:) + def get_rule( + rule_id: + ) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -290,7 +307,6 @@ def get_rule(rule_id:) params: api_params, response_type: Models::ProxyRule ) - end # Delete a proxy rule by its unique ID. @@ -298,17 +314,18 @@ def get_rule(rule_id:) # @param [String] rule_id Rule ID. # # @return [] - def delete_rule(rule_id:) + def delete_rule( + rule_id: + ) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -320,7 +337,6 @@ def delete_rule(rule_id:) headers: api_headers, params: api_params, ) - end # If not succeeded yet, retry verification process of a proxy rule domain. @@ -331,17 +347,18 @@ def delete_rule(rule_id:) # @param [String] rule_id Rule ID. # # @return [ProxyRule] - def update_rule_status(rule_id:) + def update_rule_status( + rule_id: + ) api_path = '/proxy/rules/{ruleId}/status' .gsub('{ruleId}', rule_id) if rule_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "ruleId"') + raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -355,8 +372,6 @@ def update_rule_status(rule_id:) params: api_params, response_type: Models::ProxyRule ) - end - - end + end end diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index b6028f0..8c19180 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Sites < Service - def initialize(client) @client = client end - # Get a list of all the project's sites. You can use the query params to + # Get a list of all the project's sites. You can use the query params to # filter your results. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SiteList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/sites' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,16 +39,15 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::SiteList ) - end # Create a new site. # - # @param [String] site_id Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] site_id Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Site name. Max length: 128 chars. # @param [Framework] framework Sites framework. # @param [BuildRuntime] build_runtime Runtime to use during build step. - # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. # @param [Integer] timeout Maximum request time in seconds. # @param [String] install_command Install Command. @@ -64,25 +66,51 @@ def list(queries: nil, search: nil, total: nil) # @param [String] build_specification Build specification for the site deployments. # @param [String] runtime_specification Runtime specification for the SSR executions. # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + # @param [Array] scopes List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. # # @return [Site] - def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_command: nil, output_directory: nil, adapter: nil, installation_id: nil, fallback_file: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def create( + site_id:, + name:, + framework:, + build_runtime:, + enabled: nil, + logging: nil, + timeout: nil, + install_command: nil, + build_command: nil, + start_command: nil, + output_directory: nil, + adapter: nil, + installation_id: nil, + fallback_file: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil, + scopes: nil + ) api_path = '/sites' if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if framework.nil? - raise Appwrite::Exception.new('Missing required parameter: "framework"') + raise Appwrite::Exception.new('Missing required parameter: "framework"') end if build_runtime.nil? - raise Appwrite::Exception.new('Missing required parameter: "buildRuntime"') + raise Appwrite::Exception.new('Missing required parameter: "buildRuntime"') end api_params = { @@ -109,8 +137,9 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n buildSpecification: build_specification, runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, + scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -124,7 +153,6 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n params: api_params, response_type: Models::Site ) - end # Get a list of all frameworks that are currently available on the server @@ -135,9 +163,8 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n def list_frameworks() api_path = '/sites/frameworks' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -150,7 +177,6 @@ def list_frameworks() params: api_params, response_type: Models::FrameworkList ) - end # List allowed site specifications for this instance. @@ -158,13 +184,15 @@ def list_frameworks() # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. # # @return [SpecificationList] - def list_specifications(type: nil) + def list_specifications( + type: nil + ) api_path = '/sites/specifications' api_params = { type: type, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -177,7 +205,6 @@ def list_specifications(type: nil) params: api_params, response_type: Models::SpecificationList ) - end # Get a site by its unique ID. @@ -185,17 +212,18 @@ def list_specifications(type: nil) # @param [String] site_id Site ID. # # @return [Site] - def get(site_id:) + def get( + site_id: + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -208,7 +236,6 @@ def get(site_id:) params: api_params, response_type: Models::Site ) - end # Update site by its unique ID. @@ -216,7 +243,7 @@ def get(site_id:) # @param [String] site_id Site ID. # @param [String] name Site name. Max length: 128 chars. # @param [Framework] framework Sites framework. - # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. # @param [Integer] timeout Maximum request time in seconds. # @param [String] install_command Install Command. @@ -236,22 +263,48 @@ def get(site_id:) # @param [String] build_specification Build specification for the site deployments. # @param [String] runtime_specification Runtime specification for the SSR executions. # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + # @param [Array] scopes List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. # # @return [Site] - def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_command: nil, output_directory: nil, build_runtime: nil, adapter: nil, fallback_file: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, provider_branches: nil, provider_paths: nil, build_specification: nil, runtime_specification: nil, deployment_retention: nil) + def update( + site_id:, + name:, + framework:, + enabled: nil, + logging: nil, + timeout: nil, + install_command: nil, + build_command: nil, + start_command: nil, + output_directory: nil, + build_runtime: nil, + adapter: nil, + fallback_file: nil, + installation_id: nil, + provider_repository_id: nil, + provider_branch: nil, + provider_silent_mode: nil, + provider_root_directory: nil, + provider_branches: nil, + provider_paths: nil, + build_specification: nil, + runtime_specification: nil, + deployment_retention: nil, + scopes: nil + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if framework.nil? - raise Appwrite::Exception.new('Missing required parameter: "framework"') + raise Appwrite::Exception.new('Missing required parameter: "framework"') end api_params = { @@ -277,8 +330,9 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil buildSpecification: build_specification, runtimeSpecification: runtime_specification, deploymentRetention: deployment_retention, + scopes: scopes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -292,7 +346,6 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil params: api_params, response_type: Models::Site ) - end # Delete a site by its unique ID. @@ -300,17 +353,18 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil # @param [String] site_id Site ID. # # @return [] - def delete(site_id:) + def delete( + site_id: + ) api_path = '/sites/{siteId}' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -322,7 +376,6 @@ def delete(site_id:) headers: api_headers, params: api_params, ) - end # Update the site active deployment. Use this endpoint to switch the code @@ -332,22 +385,25 @@ def delete(site_id:) # @param [String] deployment_id Deployment ID. # # @return [Site] - def update_site_deployment(site_id:, deployment_id:) + def update_site_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployment' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -361,10 +417,9 @@ def update_site_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Site ) - end - # Get a list of all the site's code deployments. You can use the query params + # Get a list of all the site's code deployments. You can use the query params # to filter your results. # # @param [String] site_id Site ID. @@ -373,12 +428,17 @@ def update_site_deployment(site_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DeploymentList] - def list_deployments(site_id:, queries: nil, search: nil, total: nil) + def list_deployments( + site_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/sites/{siteId}/deployments' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { @@ -386,7 +446,7 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -399,12 +459,11 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DeploymentList ) - end # Create a new site code deployment. Use this endpoint to upload a new - # version of your site code. To activate your newly uploaded code, you'll - # need to update the site's deployment to use your new deployment ID. + # version of your site code. To activate your newly uploaded code, you'll + # need to update the site's deployment to use your new deployment ID. # # @param [String] site_id Site ID. # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -414,16 +473,24 @@ def list_deployments(site_id:, queries: nil, search: nil, total: nil) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_deployment(site_id:, code:, install_command: nil, build_command: nil, output_directory: nil, activate: nil, on_progress: nil) + def create_deployment( + site_id:, + code:, + install_command: nil, + build_command: nil, + output_directory: nil, + activate: nil, + on_progress: nil + ) api_path = '/sites/{siteId}/deployments' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if code.nil? - raise Appwrite::Exception.new('Missing required parameter: "code"') + raise Appwrite::Exception.new('Missing required parameter: "code"') end api_params = { @@ -433,7 +500,7 @@ def create_deployment(site_id:, code:, install_command: nil, build_command: nil, code: code, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -452,35 +519,37 @@ def create_deployment(site_id:, code:, install_command: nil, build_command: nil, on_progress: on_progress, response_type: Models::Deployment ) - end # Create a new build for an existing site deployment. This endpoint allows # you to rebuild a deployment with the updated site configuration, including # its commands and output directory if they have been modified. The build # process will be queued and executed asynchronously. The original - # deployment's code will be preserved and used for the new build. + # deployment's code will be preserved and used for the new build. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def create_duplicate_deployment(site_id:, deployment_id:) + def create_duplicate_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/duplicate' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { deploymentId: deployment_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -494,11 +563,10 @@ def create_duplicate_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Create a deployment based on a template. - # + # # Use this endpoint with combination of # [listTemplates](https://appwrite.io/docs/products/sites/templates) to find # the template details. @@ -512,32 +580,40 @@ def create_duplicate_deployment(site_id:, deployment_id:) # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_template_deployment(site_id:, repository:, owner:, root_directory:, type:, reference:, activate: nil) + def create_template_deployment( + site_id:, + repository:, + owner:, + root_directory:, + type:, + reference:, + activate: nil + ) api_path = '/sites/{siteId}/deployments/template' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if repository.nil? - raise Appwrite::Exception.new('Missing required parameter: "repository"') + raise Appwrite::Exception.new('Missing required parameter: "repository"') end if owner.nil? - raise Appwrite::Exception.new('Missing required parameter: "owner"') + raise Appwrite::Exception.new('Missing required parameter: "owner"') end if root_directory.nil? - raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') + raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -548,7 +624,7 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -562,11 +638,10 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t params: api_params, response_type: Models::Deployment ) - end # Create a deployment when a site is connected to VCS. - # + # # This endpoint lets you create deployment from a branch, commit, or a tag. # # @param [String] site_id Site ID. @@ -575,20 +650,25 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, t # @param [] activate Automatically activate the deployment when it is finished building. # # @return [Deployment] - def create_vcs_deployment(site_id:, type:, reference:, activate: nil) + def create_vcs_deployment( + site_id:, + type:, + reference:, + activate: nil + ) api_path = '/sites/{siteId}/deployments/vcs' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if reference.nil? - raise Appwrite::Exception.new('Missing required parameter: "reference"') + raise Appwrite::Exception.new('Missing required parameter: "reference"') end api_params = { @@ -596,7 +676,7 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) reference: reference, activate: activate, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -610,7 +690,6 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) params: api_params, response_type: Models::Deployment ) - end # Get a site deployment by its unique ID. @@ -619,22 +698,24 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def get_deployment(site_id:, deployment_id:) + def get_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -647,7 +728,6 @@ def get_deployment(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Delete a site deployment by its unique ID. @@ -656,22 +736,24 @@ def get_deployment(site_id:, deployment_id:) # @param [String] deployment_id Deployment ID. # # @return [] - def delete_deployment(site_id:, deployment_id:) + def delete_deployment( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -683,37 +765,41 @@ def delete_deployment(site_id:, deployment_id:) headers: api_headers, params: api_params, ) - end # Get a site deployment content by its unique ID. The endpoint response - # return with a 'Content-Disposition: attachment' header that tells the + # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. - # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". + # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output". # @param [String] token Presigned source-download token for accessing this deployment without a session (jobs-service). # # @return [] - def get_deployment_download(site_id:, deployment_id:, type: nil, token: nil) + def get_deployment_download( + site_id:, + deployment_id:, + type: nil, + token: nil + ) api_path = '/sites/{siteId}/deployments/{deploymentId}/download' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end api_params = { type: type, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -725,35 +811,36 @@ def get_deployment_download(site_id:, deployment_id:, type: nil, token: nil) headers: api_headers, params: api_params, ) - end # Cancel an ongoing site deployment build. If the build is already in - # progress, it will be stopped and marked as canceled. If the build hasn't + # progress, it will be stopped and marked as canceled. If the build hasn't # started yet, it will be marked as canceled without executing. You cannot - # cancel builds that have already completed (status 'ready') or failed. The + # cancel builds that have already completed (status 'ready') or failed. The # response includes the final build status and details. # # @param [String] site_id Site ID. # @param [String] deployment_id Deployment ID. # # @return [Deployment] - def update_deployment_status(site_id:, deployment_id:) + def update_deployment_status( + site_id:, + deployment_id: + ) api_path = '/sites/{siteId}/deployments/{deploymentId}/status' .gsub('{siteId}', site_id) .gsub('{deploymentId}', deployment_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if deployment_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') + raise Appwrite::Exception.new('Missing required parameter: "deploymentId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -767,7 +854,6 @@ def update_deployment_status(site_id:, deployment_id:) params: api_params, response_type: Models::Deployment ) - end # Get a list of all site logs. You can use the query params to filter your @@ -778,19 +864,23 @@ def update_deployment_status(site_id:, deployment_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ExecutionList] - def list_logs(site_id:, queries: nil, total: nil) + def list_logs( + site_id:, + queries: nil, + total: nil + ) api_path = '/sites/{siteId}/logs' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -803,7 +893,6 @@ def list_logs(site_id:, queries: nil, total: nil) params: api_params, response_type: Models::ExecutionList ) - end # Get a site request log by its unique ID. @@ -812,22 +901,24 @@ def list_logs(site_id:, queries: nil, total: nil) # @param [String] log_id Log ID. # # @return [Execution] - def get_log(site_id:, log_id:) + def get_log( + site_id:, + log_id: + ) api_path = '/sites/{siteId}/logs/{logId}' .gsub('{siteId}', site_id) .gsub('{logId}', log_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if log_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "logId"') + raise Appwrite::Exception.new('Missing required parameter: "logId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -840,7 +931,6 @@ def get_log(site_id:, log_id:) params: api_params, response_type: Models::Execution ) - end # Delete a site log by its unique ID. @@ -849,22 +939,24 @@ def get_log(site_id:, log_id:) # @param [String] log_id Log ID. # # @return [] - def delete_log(site_id:, log_id:) + def delete_log( + site_id:, + log_id: + ) api_path = '/sites/{siteId}/logs/{logId}' .gsub('{siteId}', site_id) .gsub('{logId}', log_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if log_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "logId"') + raise Appwrite::Exception.new('Missing required parameter: "logId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -877,7 +969,6 @@ def delete_log(site_id:, log_id:) headers: api_headers, params: api_params, ) - end # Get a list of all variables of a specific site. @@ -887,19 +978,23 @@ def delete_log(site_id:, log_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [VariableList] - def list_variables(site_id:, queries: nil, total: nil) + def list_variables( + site_id:, + queries: nil, + total: nil + ) api_path = '/sites/{siteId}/variables' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -912,37 +1007,42 @@ def list_variables(site_id:, queries: nil, total: nil) params: api_params, response_type: Models::VariableList ) - end # Create a new site variable. These variables can be accessed during build # and runtime (server-side rendering) as environment variables. # # @param [String] site_id Site unique ID. - # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] variable_id Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime. # # @return [Variable] - def create_variable(site_id:, variable_id:, key:, value:, secret: nil) + def create_variable( + site_id:, + variable_id:, + key:, + value:, + secret: nil + ) api_path = '/sites/{siteId}/variables' .gsub('{siteId}', site_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? - raise Appwrite::Exception.new('Missing required parameter: "value"') + raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { @@ -951,7 +1051,7 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -965,7 +1065,6 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) params: api_params, response_type: Models::Variable ) - end # Get a variable by its unique ID. @@ -974,22 +1073,24 @@ def create_variable(site_id:, variable_id:, key:, value:, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [Variable] - def get_variable(site_id:, variable_id:) + def get_variable( + site_id:, + variable_id: + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1002,29 +1103,34 @@ def get_variable(site_id:, variable_id:) params: api_params, response_type: Models::Variable ) - end # Update variable by its unique ID. # # @param [String] site_id Site unique ID. # @param [String] variable_id Variable unique ID. - # @param [String] key Variable key. Max length: 255 chars. + # @param [String] key Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars. # @param [String] value Variable value. Max length: 8192 chars. # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime. # # @return [Variable] - def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) + def update_variable( + site_id:, + variable_id:, + key: nil, + value: nil, + secret: nil + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { @@ -1032,7 +1138,7 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) value: value, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1046,7 +1152,6 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) params: api_params, response_type: Models::Variable ) - end # Delete a variable by its unique ID. @@ -1055,22 +1160,24 @@ def update_variable(site_id:, variable_id:, key: nil, value: nil, secret: nil) # @param [String] variable_id Variable unique ID. # # @return [] - def delete_variable(site_id:, variable_id:) + def delete_variable( + site_id:, + variable_id: + ) api_path = '/sites/{siteId}/variables/{variableId}' .gsub('{siteId}', site_id) .gsub('{variableId}', variable_id) if site_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "siteId"') + raise Appwrite::Exception.new('Missing required parameter: "siteId"') end if variable_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "variableId"') + raise Appwrite::Exception.new('Missing required parameter: "variableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1082,8 +1189,6 @@ def delete_variable(site_id:, variable_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index 705617f..18389d9 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Storage < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [BucketList] - def list_buckets(queries: nil, search: nil, total: nil) + def list_buckets( + queries: nil, + search: nil, + total: nil + ) api_path = '/storage/buckets' api_params = { @@ -23,7 +26,7 @@ def list_buckets(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,33 +39,44 @@ def list_buckets(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::BucketList ) - end # Create a new storage bucket. # - # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Bucket name # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 5GB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled # @param [] transformations Are image transformations enabled? # # @return [Bucket] - def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil, transformations: nil) + def create_bucket( + bucket_id:, + name:, + permissions: nil, + file_security: nil, + enabled: nil, + maximum_file_size: nil, + allowed_file_extensions: nil, + compression: nil, + encryption: nil, + antivirus: nil, + transformations: nil + ) api_path = '/storage/buckets' if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -78,7 +92,7 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl antivirus: antivirus, transformations: transformations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -92,7 +106,6 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl params: api_params, response_type: Models::Bucket ) - end # Get a storage bucket by its unique ID. This endpoint response returns a @@ -101,17 +114,18 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl # @param [String] bucket_id Bucket unique ID. # # @return [Bucket] - def get_bucket(bucket_id:) + def get_bucket( + bucket_id: + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -124,7 +138,6 @@ def get_bucket(bucket_id:) params: api_params, response_type: Models::Bucket ) - end # Update a storage bucket by its unique ID. @@ -133,25 +146,37 @@ def get_bucket(bucket_id:) # @param [String] name Bucket name # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 5GB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + # @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled # @param [] transformations Are image transformations enabled? # # @return [Bucket] - def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil, transformations: nil) + def update_bucket( + bucket_id:, + name:, + permissions: nil, + file_security: nil, + enabled: nil, + maximum_file_size: nil, + allowed_file_extensions: nil, + compression: nil, + encryption: nil, + antivirus: nil, + transformations: nil + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -166,7 +191,7 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl antivirus: antivirus, transformations: transformations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -180,7 +205,6 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl params: api_params, response_type: Models::Bucket ) - end # Delete a storage bucket by its unique ID. @@ -188,17 +212,18 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl # @param [String] bucket_id Bucket unique ID. # # @return [] - def delete_bucket(bucket_id:) + def delete_bucket( + bucket_id: + ) api_path = '/storage/buckets/{bucketId}' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -210,7 +235,6 @@ def delete_bucket(bucket_id:) headers: api_headers, params: api_params, ) - end # Get a list of all the user files. You can use the query params to filter @@ -222,12 +246,17 @@ def delete_bucket(bucket_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [FileList] - def list_files(bucket_id:, queries: nil, search: nil, total: nil) + def list_files( + bucket_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/storage/buckets/{bucketId}/files' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end api_params = { @@ -235,7 +264,7 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -248,49 +277,55 @@ def list_files(bucket_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::FileList ) - end # Create a new file. Before using this route, you should create a new bucket # resource using either a [server # integration](https://appwrite.io/docs/server/storage#storageCreateBucket) # API or directly from your Appwrite console. - # + # # Larger files should be uploaded using multiple requests with the # [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) # header to send a partial request with a maximum supported chunk of `5MB`. # The `content-range` header values should always be in bytes. - # + # # When the first request is sent, the server will return the **File** object, - # and the subsequent part request must include the file's **id** in + # and the subsequent part request must include the file's **id** in # `x-appwrite-id` header to allow the server to know that the partial upload # is for the existing file and not for a new one. - # - # If you're creating a new file using one of the Appwrite SDKs, all the + # + # If you're creating a new file using one of the Appwrite SDKs, all the # chunking logic will be managed by the SDK internally. - # + # # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. + # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. # # @return [File] - def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_progress: nil) + def create_file( + bucket_id:, + file_id:, + file:, + permissions: nil, + folder: nil, + on_progress: nil + ) api_path = '/storage/buckets/{bucketId}/files' .gsub('{bucketId}', bucket_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end if file.nil? - raise Appwrite::Exception.new('Missing required parameter: "file"') + raise Appwrite::Exception.new('Missing required parameter: "file"') end api_params = { @@ -299,7 +334,7 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p permissions: permissions, folder: folder, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'multipart/form-data', @@ -318,7 +353,6 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p on_progress: on_progress, response_type: Models::File ) - end # Get a file by its unique ID. This endpoint response returns a JSON object @@ -328,22 +362,24 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_p # @param [String] file_id File ID. # # @return [File] - def get_file(bucket_id:, file_id:) + def get_file( + bucket_id:, + file_id: + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -356,7 +392,6 @@ def get_file(bucket_id:, file_id:) params: api_params, response_type: Models::File ) - end # Update a file by its unique ID. Only users with write permissions have @@ -368,24 +403,29 @@ def get_file(bucket_id:, file_id:) # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [File] - def update_file(bucket_id:, file_id:, name: nil, permissions: nil) + def update_file( + bucket_id:, + file_id:, + name: nil, + permissions: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { name: name, permissions: permissions, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -399,7 +439,6 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) params: api_params, response_type: Models::File ) - end # Delete a file by its unique ID. Only users with write permissions have @@ -409,22 +448,24 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) # @param [String] file_id File ID. # # @return [] - def delete_file(bucket_id:, file_id:) + def delete_file( + bucket_id:, + file_id: + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -436,11 +477,10 @@ def delete_file(bucket_id:, file_id:) headers: api_headers, params: api_params, ) - end # Get a file content by its unique ID. The endpoint response return with a - # 'Content-Disposition: attachment' header that tells the browser to start + # 'Content-Disposition: attachment' header that tells the browser to start # downloading the file to user downloads directory. # # @param [String] bucket_id Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). @@ -448,23 +488,27 @@ def delete_file(bucket_id:, file_id:) # @param [String] token File token for accessing this file. # # @return [] - def get_file_download(bucket_id:, file_id:, token: nil) + def get_file_download( + bucket_id:, + file_id:, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -476,7 +520,6 @@ def get_file_download(bucket_id:, file_id:, token: nil) headers: api_headers, params: api_params, ) - end # Get a file preview image. Currently, this method supports preview for image @@ -501,17 +544,32 @@ def get_file_download(bucket_id:, file_id:, token: nil) # @param [String] token File token for accessing this file. # # @return [] - def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil, token: nil) + def get_file_preview( + bucket_id:, + file_id:, + width: nil, + height: nil, + gravity: nil, + quality: nil, + border_width: nil, + border_color: nil, + border_radius: nil, + opacity: nil, + rotation: nil, + background: nil, + output: nil, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { @@ -528,7 +586,7 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil output: output, token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'image/*', @@ -540,11 +598,10 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil headers: api_headers, params: api_params, ) - end # Get a file content by its unique ID. This endpoint is similar to the - # download method but returns with no 'Content-Disposition: attachment' + # download method but returns with no 'Content-Disposition: attachment' # header. # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). @@ -552,23 +609,27 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil # @param [String] token File token for accessing this file. # # @return [] - def get_file_view(bucket_id:, file_id:, token: nil) + def get_file_view( + bucket_id:, + file_id:, + token: nil + ) api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { token: token, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": '*/*', @@ -580,8 +641,6 @@ def get_file_view(bucket_id:, file_id:, token: nil) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index ed03286..ab1c72f 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class TablesDB < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [DatabaseList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/tablesdb' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,29 +39,35 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::DatabaseList ) - end # Create a new Database. - # # - # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Database name. Max length: 128 chars. - # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. # @param [String] specification Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. # # @return [Database] - def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) api_path = '/tablesdb' if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -69,7 +78,7 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, replicas: replicas, syncMode: sync_mode, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -83,7 +92,6 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, params: api_params, response_type: Models::Database ) - end # List the dedicated database specifications available on the current plan. @@ -95,9 +103,8 @@ def create(database_id:, name:, enabled: nil, specification: nil, replicas: nil, def list_specifications() api_path = '/tablesdb/specifications' - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -110,7 +117,6 @@ def list_specifications() params: api_params, response_type: Models::DedicatedDatabaseSpecificationList ) - end # List transactions across all databases. @@ -118,13 +124,15 @@ def list_specifications() # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). # # @return [TransactionList] - def list_transactions(queries: nil) + def list_transactions( + queries: nil + ) api_path = '/tablesdb/transactions' api_params = { queries: queries, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -137,7 +145,6 @@ def list_transactions(queries: nil) params: api_params, response_type: Models::TransactionList ) - end # Create a new transaction. @@ -145,13 +152,15 @@ def list_transactions(queries: nil) # @param [Integer] ttl Seconds before the transaction expires. # # @return [Transaction] - def create_transaction(ttl: nil) + def create_transaction( + ttl: nil + ) api_path = '/tablesdb/transactions' api_params = { ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -165,7 +174,6 @@ def create_transaction(ttl: nil) params: api_params, response_type: Models::Transaction ) - end # Get a transaction by its unique ID. @@ -173,17 +181,18 @@ def create_transaction(ttl: nil) # @param [String] transaction_id Transaction ID. # # @return [Transaction] - def get_transaction(transaction_id:) + def get_transaction( + transaction_id: + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -196,7 +205,6 @@ def get_transaction(transaction_id:) params: api_params, response_type: Models::Transaction ) - end # Update a transaction, to either commit or roll back its operations. @@ -206,19 +214,23 @@ def get_transaction(transaction_id:) # @param [] rollback Rollback transaction? # # @return [Transaction] - def update_transaction(transaction_id:, commit: nil, rollback: nil) + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { commit: commit, rollback: rollback, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -232,7 +244,6 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) params: api_params, response_type: Models::Transaction ) - end # Delete a transaction by its unique ID. @@ -240,17 +251,18 @@ def update_transaction(transaction_id:, commit: nil, rollback: nil) # @param [String] transaction_id Transaction ID. # # @return [] - def delete_transaction(transaction_id:) + def delete_transaction( + transaction_id: + ) api_path = '/tablesdb/transactions/{transactionId}' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -262,7 +274,6 @@ def delete_transaction(transaction_id:) headers: api_headers, params: api_params, ) - end # Create multiple operations in a single transaction. @@ -271,18 +282,21 @@ def delete_transaction(transaction_id:) # @param [Array] operations Array of staged operations. # # @return [Transaction] - def create_operations(transaction_id:, operations: nil) + def create_operations( + transaction_id:, + operations: nil + ) api_path = '/tablesdb/transactions/{transactionId}/operations' .gsub('{transactionId}', transaction_id) if transaction_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') end api_params = { operations: operations, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -296,7 +310,6 @@ def create_operations(transaction_id:, operations: nil) params: api_params, response_type: Models::Transaction ) - end # Get a database by its unique ID. This endpoint response returns a JSON @@ -305,17 +318,18 @@ def create_operations(transaction_id:, operations: nil) # @param [String] database_id Database ID. # # @return [Database] - def get(database_id:) + def get( + database_id: + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -328,25 +342,31 @@ def get(database_id:) params: api_params, response_type: Models::Database ) - end # Update a database by its unique ID. # # @param [String] database_id Database ID. # @param [String] name Database name. Max length: 128 chars. - # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. # @param [String] specification Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. # # @return [Database] - def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: nil, sync_mode: nil) + def update( + database_id:, + name: nil, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -356,7 +376,7 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: replicas: replicas, syncMode: sync_mode, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -370,7 +390,6 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: params: api_params, response_type: Models::Database ) - end # Delete a database by its unique ID. Only API keys with with databases.write @@ -379,17 +398,18 @@ def update(database_id:, name: nil, enabled: nil, specification: nil, replicas: # @param [String] database_id Database ID. # # @return [] - def delete(database_id:) + def delete( + database_id: + ) api_path = '/tablesdb/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -401,31 +421,37 @@ def delete(database_id:) headers: api_headers, params: api_params, ) - end # Trigger a manual failover for a dedicated database with high availability # enabled. Promotes a replica to primary. The failover runs asynchronously; # poll the database document for status updates. A database left - # mid-operation by a failover that did not finish also accepts this call as a - # repair, provided `targetReplicaId` names the member to promote. + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. # # @param [String] database_id Database ID. # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. # # @return [DedicatedDatabase] - def create_failover(database_id:, target_replica_id: nil) + def create_failover( + database_id:, + target_replica_id: nil + ) api_path = '/tablesdb/{databaseId}/failovers' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { targetReplicaId: target_replica_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -439,7 +465,6 @@ def create_failover(database_id:, target_replica_id: nil) params: api_params, response_type: Models::DedicatedDatabase ) - end # List the dedicated migrations for a TablesDB database. A database has at @@ -448,17 +473,18 @@ def create_failover(database_id:, target_replica_id: nil) # @param [String] database_id Database ID. # # @return [DatabaseMigrationList] - def list_migrations(database_id:) + def list_migrations( + database_id: + ) api_path = '/tablesdb/{databaseId}/migrations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -471,7 +497,6 @@ def list_migrations(database_id:) params: api_params, response_type: Models::DatabaseMigrationList ) - end # Start migrating a serverless TablesDB database onto a dedicated MySQL @@ -483,23 +508,27 @@ def list_migrations(database_id:) # @param [] auto_cutover Whether to cut over automatically once the copy is verified. When disabled the migration parks at ready_to_cutover and holds there until the cutover is performed manually. # # @return [DatabaseMigration] - def create_migration(database_id:, specification:, auto_cutover: nil) + def create_migration( + database_id:, + specification:, + auto_cutover: nil + ) api_path = '/tablesdb/{databaseId}/migrations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if specification.nil? - raise Appwrite::Exception.new('Missing required parameter: "specification"') + raise Appwrite::Exception.new('Missing required parameter: "specification"') end api_params = { specification: specification, autoCutover: auto_cutover, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -513,7 +542,6 @@ def create_migration(database_id:, specification:, auto_cutover: nil) params: api_params, response_type: Models::DatabaseMigration ) - end # Get a single dedicated migration for a TablesDB database by its ID. @@ -522,22 +550,24 @@ def create_migration(database_id:, specification:, auto_cutover: nil) # @param [String] migration_id Migration ID. # # @return [DatabaseMigration] - def get_migration(database_id:, migration_id:) + def get_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -550,7 +580,6 @@ def get_migration(database_id:, migration_id:) params: api_params, response_type: Models::DatabaseMigration ) - end # Abort an in-flight TablesDB dedicated migration. Only allowed before @@ -560,22 +589,24 @@ def get_migration(database_id:, migration_id:) # @param [String] migration_id Migration ID. # # @return [] - def delete_migration(database_id:, migration_id:) + def delete_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -588,7 +619,6 @@ def delete_migration(database_id:, migration_id:) headers: api_headers, params: api_params, ) - end # Cut a verified TablesDB migration over to its dedicated compute. Only @@ -602,22 +632,24 @@ def delete_migration(database_id:, migration_id:) # @param [String] migration_id Migration ID. # # @return [DatabaseMigration] - def cutover_migration(database_id:, migration_id:) + def cutover_migration( + database_id:, + migration_id: + ) api_path = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover' .gsub('{databaseId}', database_id) .gsub('{migrationId}', migration_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if migration_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "migrationId"') + raise Appwrite::Exception.new('Missing required parameter: "migrationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -631,7 +663,6 @@ def cutover_migration(database_id:, migration_id:) params: api_params, response_type: Models::DatabaseMigration ) - end # List the lifecycle operations recorded for a dedicated database, newest @@ -645,12 +676,17 @@ def cutover_migration(database_id:, migration_id:) # @param [Integer] offset Number of operations to skip. # # @return [DedicatedDatabaseOperationList] - def list_operations(database_id:, status: nil, limit: nil, offset: nil) + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) api_path = '/tablesdb/{databaseId}/operations' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -658,7 +694,7 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) limit: limit, offset: offset, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -671,7 +707,6 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) params: api_params, response_type: Models::DedicatedDatabaseOperationList ) - end # Get high availability status for a dedicated database. Returns replica @@ -680,17 +715,18 @@ def list_operations(database_id:, status: nil, limit: nil, offset: nil) # @param [String] database_id Database ID. # # @return [DedicatedDatabaseReplicas] - def get_replicas(database_id:) + def get_replicas( + database_id: + ) api_path = '/tablesdb/{databaseId}/replicas' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -703,7 +739,6 @@ def get_replicas(database_id:) params: api_params, response_type: Models::DedicatedDatabaseReplicas ) - end # Get real-time health and status information for a dedicated database. @@ -713,17 +748,18 @@ def get_replicas(database_id:) # @param [String] database_id Database ID. # # @return [DatabaseStatus] - def get_status(database_id:) + def get_status( + database_id: + ) api_path = '/tablesdb/{databaseId}/status' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -736,7 +772,6 @@ def get_status(database_id:) params: api_params, response_type: Models::DatabaseStatus ) - end # Get a list of all tables that belong to the provided databaseId. You can @@ -748,12 +783,17 @@ def get_status(database_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TableList] - def list_tables(database_id:, queries: nil, search: nil, total: nil) + def list_tables( + database_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { @@ -761,7 +801,7 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -774,7 +814,6 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TableList ) - end # Create a new Table. Before using this route, you should create a new @@ -783,29 +822,38 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) # API or directly from your database console. # # @param [String] database_id Database ID. - # @param [String] table_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] table_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Table name. Max length: 128 chars. # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] row_security Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. # @param [Array] columns Array of column definitions to create. Each column should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Table] - def create_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil, columns: nil, indexes: nil) + def create_table( + database_id:, + table_id:, + name:, + permissions: nil, + row_security: nil, + enabled: nil, + columns: nil, + indexes: nil + ) api_path = '/tablesdb/{databaseId}/tables' .gsub('{databaseId}', database_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -817,7 +865,7 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: columns: columns, indexes: indexes, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -831,7 +879,6 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: params: api_params, response_type: Models::Table ) - end # Get a table by its unique ID. This endpoint response returns a JSON object @@ -841,22 +888,24 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: # @param [String] table_id Table ID. # # @return [Table] - def get_table(database_id:, table_id:) + def get_table( + database_id:, + table_id: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -869,7 +918,6 @@ def get_table(database_id:, table_id:) params: api_params, response_type: Models::Table ) - end # Update a table by its unique ID. @@ -879,21 +927,29 @@ def get_table(database_id:, table_id:) # @param [String] name Table name. Max length: 128 chars. # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] row_security Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. # @param [] purge When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. # # @return [Table] - def update_table(database_id:, table_id:, name: nil, permissions: nil, row_security: nil, enabled: nil, purge: nil) + def update_table( + database_id:, + table_id:, + name: nil, + permissions: nil, + row_security: nil, + enabled: nil, + purge: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -903,7 +959,7 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur enabled: enabled, purge: purge, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -917,7 +973,6 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur params: api_params, response_type: Models::Table ) - end # Delete a table by its unique ID. Only users with write permissions have @@ -927,22 +982,24 @@ def update_table(database_id:, table_id:, name: nil, permissions: nil, row_secur # @param [String] table_id Table ID. # # @return [] - def delete_table(database_id:, table_id:) + def delete_table( + database_id:, + table_id: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -954,7 +1011,6 @@ def delete_table(database_id:, table_id:) headers: api_headers, params: api_params, ) - end # List columns in the table. @@ -965,24 +1021,29 @@ def delete_table(database_id:, table_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ColumnList] - def list_columns(database_id:, table_id:, queries: nil, total: nil) + def list_columns( + database_id:, + table_id:, + queries: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -995,12 +1056,11 @@ def list_columns(database_id:, table_id:, queries: nil, total: nil) params: api_params, response_type: Models::ColumnList ) - end # Create a bigint column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1012,25 +1072,34 @@ def list_columns(database_id:, table_id:, queries: nil, total: nil) # @param [] array Is column an array? # # @return [ColumnBigint] - def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_big_int_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1041,7 +1110,7 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1055,12 +1124,11 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma params: api_params, response_type: Models::ColumnBigint ) - end # Update a bigint column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1072,30 +1140,39 @@ def create_big_int_column(database_id:, table_id:, key:, required:, min: nil, ma # @param [String] new_key New Column Key. # # @return [ColumnBigint] - def update_big_int_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_big_int_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1105,7 +1182,7 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1119,11 +1196,10 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi params: api_params, response_type: Models::ColumnBigint ) - end # Create a boolean column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -1133,25 +1209,32 @@ def update_big_int_column(database_id:, table_id:, key:, required:, default:, mi # @param [] array Is column an array? # # @return [ColumnBoolean] - def create_boolean_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_boolean_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1160,7 +1243,7 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1174,7 +1257,6 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnBoolean ) - end # Update a boolean column. Changing the `default` value will not update @@ -1188,30 +1270,37 @@ def create_boolean_column(database_id:, table_id:, key:, required:, default: nil # @param [String] new_key New Column Key. # # @return [ColumnBoolean] - def update_boolean_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_boolean_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1219,7 +1308,7 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1233,7 +1322,6 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne params: api_params, response_type: Models::ColumnBoolean ) - end # Create a date time column according to the ISO 8601 standard. @@ -1246,25 +1334,32 @@ def update_boolean_column(database_id:, table_id:, key:, required:, default:, ne # @param [] array Is column an array? # # @return [ColumnDatetime] - def create_datetime_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_datetime_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1273,7 +1368,7 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1287,7 +1382,6 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni params: api_params, response_type: Models::ColumnDatetime ) - end # Update a date time column. Changing the `default` value will not update @@ -1301,30 +1395,37 @@ def create_datetime_column(database_id:, table_id:, key:, required:, default: ni # @param [String] new_key New Column Key. # # @return [ColumnDatetime] - def update_datetime_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_datetime_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1332,7 +1433,7 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1346,11 +1447,10 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n params: api_params, response_type: Models::ColumnDatetime ) - end # Create an email column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1360,25 +1460,32 @@ def update_datetime_column(database_id:, table_id:, key:, required:, default:, n # @param [] array Is column an array? # # @return [ColumnEmail] - def create_email_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_email_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/email' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1387,7 +1494,7 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1401,12 +1508,11 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, params: api_params, response_type: Models::ColumnEmail ) - end # Update an email column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1416,30 +1522,37 @@ def create_email_column(database_id:, table_id:, key:, required:, default: nil, # @param [String] new_key New Column Key. # # @return [ColumnEmail] - def update_email_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_email_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1447,7 +1560,7 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1461,7 +1574,6 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ params: api_params, response_type: Models::ColumnEmail ) - end # Create an enumeration column. The `elements` param acts as a white-list of @@ -1476,29 +1588,37 @@ def update_email_column(database_id:, table_id:, key:, required:, default:, new_ # @param [] array Is column an array? # # @return [ColumnEnum] - def create_enum_column(database_id:, table_id:, key:, elements:, required:, default: nil, array: nil) + def create_enum_column( + database_id:, + table_id:, + key:, + elements:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1508,7 +1628,7 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1522,12 +1642,11 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa params: api_params, response_type: Models::ColumnEnum ) - end # Update an enum column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1538,34 +1657,42 @@ def create_enum_column(database_id:, table_id:, key:, elements:, required:, defa # @param [String] new_key New Column Key. # # @return [ColumnEnum] - def update_enum_column(database_id:, table_id:, key:, elements:, required:, default:, new_key: nil) + def update_enum_column( + database_id:, + table_id:, + key:, + elements:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? - raise Appwrite::Exception.new('Missing required parameter: "elements"') + raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1574,7 +1701,7 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1588,12 +1715,11 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa params: api_params, response_type: Models::ColumnEnum ) - end # Create a float column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1605,25 +1731,34 @@ def update_enum_column(database_id:, table_id:, key:, elements:, required:, defa # @param [] array Is column an array? # # @return [ColumnFloat] - def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_float_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/float' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1634,7 +1769,7 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1648,12 +1783,11 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: params: api_params, response_type: Models::ColumnFloat ) - end # Update a float column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1665,30 +1799,39 @@ def create_float_column(database_id:, table_id:, key:, required:, min: nil, max: # @param [String] new_key New Column Key. # # @return [ColumnFloat] - def update_float_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_float_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1698,7 +1841,7 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1712,12 +1855,11 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: params: api_params, response_type: Models::ColumnFloat ) - end # Create an integer column. Optionally, minimum and maximum values can be # provided. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1729,25 +1871,34 @@ def update_float_column(database_id:, table_id:, key:, required:, default:, min: # @param [] array Is column an array? # # @return [ColumnInteger] - def create_integer_column(database_id:, table_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) + def create_integer_column( + database_id:, + table_id:, + key:, + required:, + min: nil, + max: nil, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1758,7 +1909,7 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1772,12 +1923,11 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma params: api_params, response_type: Models::ColumnInteger ) - end # Update an integer column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1789,30 +1939,39 @@ def create_integer_column(database_id:, table_id:, key:, required:, min: nil, ma # @param [String] new_key New Column Key. # # @return [ColumnInteger] - def update_integer_column(database_id:, table_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) + def update_integer_column( + database_id:, + table_id:, + key:, + required:, + default:, + min: nil, + max: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1822,7 +1981,7 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1836,11 +1995,10 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi params: api_params, response_type: Models::ColumnInteger ) - end # Create IP address column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1850,25 +2008,32 @@ def update_integer_column(database_id:, table_id:, key:, required:, default:, mi # @param [] array Is column an array? # # @return [ColumnIp] - def create_ip_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_ip_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1877,7 +2042,7 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1891,12 +2056,11 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr params: api_params, response_type: Models::ColumnIp ) - end # Update an ip column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -1906,30 +2070,37 @@ def create_ip_column(database_id:, table_id:, key:, required:, default: nil, arr # @param [String] new_key New Column Key. # # @return [ColumnIp] - def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_ip_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -1937,7 +2108,7 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1951,7 +2122,6 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key params: api_params, response_type: Models::ColumnIp ) - end # Create a geometric line column. @@ -1963,25 +2133,31 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key # @param [Array] default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. # # @return [ColumnLine] - def create_line_column(database_id:, table_id:, key:, required:, default: nil) + def create_line_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -1989,7 +2165,7 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2003,7 +2179,6 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) params: api_params, response_type: Models::ColumnLine ) - end # Update a line column. Changing the `default` value will not update already @@ -2017,26 +2192,33 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] new_key New Column Key. # # @return [ColumnLine] - def update_line_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_line_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2044,7 +2226,7 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2058,11 +2240,10 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n params: api_params, response_type: Models::ColumnLine ) - end # Create a longtext column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2073,25 +2254,33 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnLongtext] - def create_longtext_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_longtext_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2101,7 +2290,7 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2115,12 +2304,11 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni params: api_params, response_type: Models::ColumnLongtext ) - end # Update a longtext column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2130,30 +2318,37 @@ def create_longtext_column(database_id:, table_id:, key:, required:, default: ni # @param [String] new_key New Column Key. # # @return [ColumnLongtext] - def update_longtext_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_longtext_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2161,7 +2356,7 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2175,11 +2370,10 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n params: api_params, response_type: Models::ColumnLongtext ) - end # Create a mediumtext column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2190,25 +2384,33 @@ def update_longtext_column(database_id:, table_id:, key:, required:, default:, n # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnMediumtext] - def create_mediumtext_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_mediumtext_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2218,7 +2420,7 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2232,12 +2434,11 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: params: api_params, response_type: Models::ColumnMediumtext ) - end # Update a mediumtext column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2247,30 +2448,37 @@ def create_mediumtext_column(database_id:, table_id:, key:, required:, default: # @param [String] new_key New Column Key. # # @return [ColumnMediumtext] - def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_mediumtext_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2278,7 +2486,7 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2292,7 +2500,6 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, params: api_params, response_type: Models::ColumnMediumtext ) - end # Create a geometric point column. @@ -2304,25 +2511,31 @@ def update_mediumtext_column(database_id:, table_id:, key:, required:, default:, # @param [Array] default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. # # @return [ColumnPoint] - def create_point_column(database_id:, table_id:, key:, required:, default: nil) + def create_point_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2330,7 +2543,7 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2344,7 +2557,6 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) params: api_params, response_type: Models::ColumnPoint ) - end # Update a point column. Changing the `default` value will not update already @@ -2358,26 +2570,33 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] new_key New Column Key. # # @return [ColumnPoint] - def update_point_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_point_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2385,7 +2604,7 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2399,7 +2618,6 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, params: api_params, response_type: Models::ColumnPoint ) - end # Create a geometric polygon column. @@ -2411,25 +2629,31 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, # @param [Array] default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. # # @return [ColumnPolygon] - def create_polygon_column(database_id:, table_id:, key:, required:, default: nil) + def create_polygon_column( + database_id:, + table_id:, + key:, + required:, + default: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2437,7 +2661,7 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil required: required, default: default, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2451,7 +2675,6 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnPolygon ) - end # Update a polygon column. Changing the `default` value will not update @@ -2465,26 +2688,33 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [String] new_key New Column Key. # # @return [ColumnPolygon] - def update_polygon_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + def update_polygon_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2492,7 +2722,7 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2506,12 +2736,11 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil params: api_params, response_type: Models::ColumnPolygon ) - end # Create relationship column. [Learn more about relationship # columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2523,25 +2752,34 @@ def update_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull. # # @return [ColumnRelationship] - def create_relationship_column(database_id:, table_id:, related_table_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) + def create_relationship_column( + database_id:, + table_id:, + related_table_id:, + type:, + two_way: nil, + key: nil, + two_way_key: nil, + on_delete: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if related_table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "relatedTableId"') + raise Appwrite::Exception.new('Missing required parameter: "relatedTableId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { @@ -2552,7 +2790,7 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: twoWayKey: two_way_key, onDelete: on_delete, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2566,14 +2804,13 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: params: api_params, response_type: Models::ColumnRelationship ) - end # # @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. # # Create a string column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2585,29 +2822,38 @@ def create_relationship_column(database_id:, table_id:, related_table_id:, type: # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnString] - def create_string_column(database_id:, table_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_string_column( + database_id:, + table_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/string' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2618,7 +2864,7 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2632,7 +2878,6 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul params: api_params, response_type: Models::ColumnString ) - end # @@ -2640,7 +2885,7 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul # # Update a string column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2651,30 +2896,38 @@ def create_string_column(database_id:, table_id:, key:, size:, required:, defaul # @param [String] new_key New Column Key. # # @return [ColumnString] - def update_string_column(database_id:, table_id:, key:, required:, default:, size: nil, new_key: nil) + def update_string_column( + database_id:, + table_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2683,7 +2936,7 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2697,11 +2950,10 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz params: api_params, response_type: Models::ColumnString ) - end # Create a text column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2712,25 +2964,33 @@ def update_string_column(database_id:, table_id:, key:, required:, default:, siz # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnText] - def create_text_column(database_id:, table_id:, key:, required:, default: nil, array: nil, encrypt: nil) + def create_text_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/text' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2740,7 +3000,7 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2754,12 +3014,11 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a params: api_params, response_type: Models::ColumnText ) - end # Update a text column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2769,30 +3028,37 @@ def create_text_column(database_id:, table_id:, key:, required:, default: nil, a # @param [String] new_key New Column Key. # # @return [ColumnText] - def update_text_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_text_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2800,7 +3066,7 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2814,11 +3080,10 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k params: api_params, response_type: Models::ColumnText ) - end # Create a URL column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2828,25 +3093,32 @@ def update_text_column(database_id:, table_id:, key:, required:, default:, new_k # @param [] array Is column an array? # # @return [ColumnUrl] - def create_url_column(database_id:, table_id:, key:, required:, default: nil, array: nil) + def create_url_column( + database_id:, + table_id:, + key:, + required:, + default: nil, + array: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/url' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2855,7 +3127,7 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar default: default, array: array, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2869,12 +3141,11 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar params: api_params, response_type: Models::ColumnUrl ) - end # Update an url column. Changing the `default` value will not update already # existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -2884,30 +3155,37 @@ def create_url_column(database_id:, table_id:, key:, required:, default: nil, ar # @param [String] new_key New Column Key. # # @return [ColumnUrl] - def update_url_column(database_id:, table_id:, key:, required:, default:, new_key: nil) + def update_url_column( + database_id:, + table_id:, + key:, + required:, + default:, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -2915,7 +3193,7 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke default: default, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2929,11 +3207,10 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke params: api_params, response_type: Models::ColumnUrl ) - end # Create a varchar column. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -2945,29 +3222,38 @@ def update_url_column(database_id:, table_id:, key:, required:, default:, new_ke # @param [] encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. # # @return [ColumnVarchar] - def create_varchar_column(database_id:, table_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) + def create_varchar_column( + database_id:, + table_id:, + key:, + size:, + required:, + default: nil, + array: nil, + encrypt: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? - raise Appwrite::Exception.new('Missing required parameter: "size"') + raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { @@ -2978,7 +3264,7 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau array: array, encrypt: encrypt, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -2992,12 +3278,11 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau params: api_params, response_type: Models::ColumnVarchar ) - end # Update a varchar column. Changing the `default` value will not update # already existing rows. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). @@ -3008,30 +3293,38 @@ def create_varchar_column(database_id:, table_id:, key:, size:, required:, defau # @param [String] new_key New Column Key. # # @return [ColumnVarchar] - def update_varchar_column(database_id:, table_id:, key:, required:, default:, size: nil, new_key: nil) + def update_varchar_column( + database_id:, + table_id:, + key:, + required:, + default:, + size: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? - raise Appwrite::Exception.new('Missing required parameter: "required"') + raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? - raise Appwrite::Exception.new('Missing required parameter: "default"') + raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { @@ -3040,7 +3333,7 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si size: size, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3054,7 +3347,6 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si params: api_params, response_type: Models::ColumnVarchar ) - end # Get column by ID. @@ -3064,27 +3356,30 @@ def update_varchar_column(database_id:, table_id:, key:, required:, default:, si # @param [String] key Column Key. # # @return [ColumnBoolean, ColumnInteger, ColumnFloat, ColumnEmail, ColumnEnum, ColumnUrl, ColumnIp, ColumnDatetime, ColumnRelationship, ColumnString] - def get_column(database_id:, table_id:, key:) + def get_column( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3152,7 +3447,6 @@ def get_column(database_id:, table_id:, key:) end raise Exception, "Unable to match response to any expected response model" - end # Deletes a column. @@ -3162,27 +3456,30 @@ def get_column(database_id:, table_id:, key:) # @param [String] key Column Key. # # @return [] - def delete_column(database_id:, table_id:, key:) + def delete_column( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3194,12 +3491,11 @@ def delete_column(database_id:, table_id:, key:) headers: api_headers, params: api_params, ) - end # Update relationship column. [Learn more about relationship # columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -3208,29 +3504,35 @@ def delete_column(database_id:, table_id:, key:) # @param [String] new_key New Column Key. # # @return [ColumnRelationship] - def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, new_key: nil) + def update_relationship_column( + database_id:, + table_id:, + key:, + on_delete: nil, + new_key: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { onDelete: on_delete, newKey: new_key, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3244,7 +3546,6 @@ def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, ne params: api_params, response_type: Models::ColumnRelationship ) - end # List indexes on the table. @@ -3255,24 +3556,29 @@ def update_relationship_column(database_id:, table_id:, key:, on_delete: nil, ne # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ColumnIndexList] - def list_indexes(database_id:, table_id:, queries: nil, total: nil) + def list_indexes( + database_id:, + table_id:, + queries: nil, + total: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3285,7 +3591,6 @@ def list_indexes(database_id:, table_id:, queries: nil, total: nil) params: api_params, response_type: Models::ColumnIndexList ) - end # Creates an index on the columns listed. Your index should include all the @@ -3301,29 +3606,37 @@ def list_indexes(database_id:, table_id:, queries: nil, total: nil) # @param [Array] lengths Length of index. Maximum of 100 # # @return [ColumnIndex] - def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, lengths: nil) + def create_index( + database_id:, + table_id:, + key:, + type:, + columns:, + orders: nil, + lengths: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end if columns.nil? - raise Appwrite::Exception.new('Missing required parameter: "columns"') + raise Appwrite::Exception.new('Missing required parameter: "columns"') end api_params = { @@ -3333,7 +3646,7 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le orders: orders, lengths: lengths, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3347,7 +3660,6 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le params: api_params, response_type: Models::ColumnIndex ) - end # Get index by ID. @@ -3357,27 +3669,30 @@ def create_index(database_id:, table_id:, key:, type:, columns:, orders: nil, le # @param [String] key Index Key. # # @return [ColumnIndex] - def get_index(database_id:, table_id:, key:) + def get_index( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3390,7 +3705,6 @@ def get_index(database_id:, table_id:, key:) params: api_params, response_type: Models::ColumnIndex ) - end # Delete an index. @@ -3400,27 +3714,30 @@ def get_index(database_id:, table_id:, key:) # @param [String] key Index Key. # # @return [] - def delete_index(database_id:, table_id:, key:) + def delete_index( + database_id:, + table_id:, + key: + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{key}', key) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if key.nil? - raise Appwrite::Exception.new('Missing required parameter: "key"') + raise Appwrite::Exception.new('Missing required parameter: "key"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3432,10 +3749,9 @@ def delete_index(database_id:, table_id:, key:) headers: api_headers, params: api_params, ) - end - # Get a list of all the user's rows in a given table. You can use the query + # Get a list of all the user's rows in a given table. You can use the query # params to filter your results. # # @param [String] database_id Database ID. @@ -3446,17 +3762,24 @@ def delete_index(database_id:, table_id:, key:) # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). # # @return [RowList] - def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil) + def list_rows( + database_id:, + table_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -3465,7 +3788,7 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: total: total, ttl: ttl, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3478,7 +3801,6 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: params: api_params, response_type: Models::RowList ) - end # Create a new Row. Before using this route, you should create a new table @@ -3488,31 +3810,38 @@ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil, total: # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - # @param [String] row_id Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] row_id Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Row data as JSON object. # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transaction_id: nil) + def create_row( + database_id:, + table_id:, + row_id:, + data:, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if data.nil? - raise Appwrite::Exception.new('Missing required parameter: "data"') + raise Appwrite::Exception.new('Missing required parameter: "data"') end api_params = { @@ -3521,7 +3850,7 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3535,7 +3864,6 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa params: api_params, response_type: Models::Row ) - end # Create new Rows. Before using this route, you should create a new table @@ -3549,28 +3877,33 @@ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transa # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def create_rows(database_id:, table_id:, rows:, transaction_id: nil) + def create_rows( + database_id:, + table_id:, + rows:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if rows.nil? - raise Appwrite::Exception.new('Missing required parameter: "rows"') + raise Appwrite::Exception.new('Missing required parameter: "rows"') end api_params = { rows: rows, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3584,14 +3917,13 @@ def create_rows(database_id:, table_id:, rows:, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Create or update Rows. Before using this route, you should create a new # table resource using either a [server # integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) # API or directly from your database console. - # + # # # @param [String] database_id Database ID. # @param [String] table_id Table ID. @@ -3599,28 +3931,33 @@ def create_rows(database_id:, table_id:, rows:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) + def upsert_rows( + database_id:, + table_id:, + rows:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if rows.nil? - raise Appwrite::Exception.new('Missing required parameter: "rows"') + raise Appwrite::Exception.new('Missing required parameter: "rows"') end api_params = { rows: rows, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3634,7 +3971,6 @@ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Update all rows that match your queries, if no queries are submitted then @@ -3647,17 +3983,23 @@ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id: nil) + def update_rows( + database_id:, + table_id:, + data: nil, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { @@ -3665,7 +4007,7 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3679,7 +4021,6 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id params: api_params, response_type: Models::RowList ) - end # Bulk delete rows using queries, if no queries are passed then all rows are @@ -3691,24 +4032,29 @@ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id # @param [String] transaction_id Transaction ID for staging the operation. # # @return [RowList] - def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) + def delete_rows( + database_id:, + table_id:, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3722,7 +4068,6 @@ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) params: api_params, response_type: Models::RowList ) - end # Get a row by its unique ID. This endpoint response returns a JSON object @@ -3735,29 +4080,35 @@ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil) # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. # # @return [Row] - def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) + def get_row( + database_id:, + table_id:, + row_id:, + queries: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { queries: queries, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -3770,7 +4121,6 @@ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) params: api_params, response_type: Models::Row ) - end # Create or update a Row. Before using this route, you should create a new @@ -3786,22 +4136,29 @@ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil) + def upsert_row( + database_id:, + table_id:, + row_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { @@ -3809,7 +4166,7 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3823,7 +4180,6 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr params: api_params, response_type: Models::Row ) - end # Update a row by its unique ID. Using the patch method you can pass only @@ -3837,22 +4193,29 @@ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil) + def update_row( + database_id:, + table_id:, + row_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { @@ -3860,7 +4223,7 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr permissions: permissions, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3874,7 +4237,6 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr params: api_params, response_type: Models::Row ) - end # Delete a row by its unique ID. @@ -3885,28 +4247,33 @@ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, tr # @param [String] transaction_id Transaction ID for staging the operation. # # @return [] - def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) + def delete_row( + database_id:, + table_id:, + row_id:, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) .gsub('{rowId}', row_id) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end api_params = { transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3918,7 +4285,6 @@ def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) headers: api_headers, params: api_params, ) - end # Decrement a specific column of a row by a given value. @@ -3932,7 +4298,15 @@ def delete_row(database_id:, table_id:, row_id:, transaction_id: nil) # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: nil, transaction_id: nil) + def decrement_row_column( + database_id:, + table_id:, + row_id:, + column:, + value: nil, + min: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) @@ -3940,19 +4314,19 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, .gsub('{column}', column) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if column.nil? - raise Appwrite::Exception.new('Missing required parameter: "column"') + raise Appwrite::Exception.new('Missing required parameter: "column"') end api_params = { @@ -3960,7 +4334,7 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: min, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -3974,7 +4348,6 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, params: api_params, response_type: Models::Row ) - end # Increment a specific column of a row by a given value. @@ -3988,7 +4361,15 @@ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, # @param [String] transaction_id Transaction ID for staging the operation. # # @return [Row] - def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: nil, transaction_id: nil) + def increment_row_column( + database_id:, + table_id:, + row_id:, + column:, + value: nil, + max: nil, + transaction_id: nil + ) api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' .gsub('{databaseId}', database_id) .gsub('{tableId}', table_id) @@ -3996,19 +4377,19 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, .gsub('{column}', column) if database_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if table_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tableId"') + raise Appwrite::Exception.new('Missing required parameter: "tableId"') end if row_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "rowId"') + raise Appwrite::Exception.new('Missing required parameter: "rowId"') end if column.nil? - raise Appwrite::Exception.new('Missing required parameter: "column"') + raise Appwrite::Exception.new('Missing required parameter: "column"') end api_params = { @@ -4016,7 +4397,7 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: max, transactionId: transaction_id, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -4030,8 +4411,6 @@ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, params: api_params, response_type: Models::Row ) - end - - end + end end diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index 3ae89b4..d632563 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Teams < Service - def initialize(client) @client = client end @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TeamList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/teams' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,27 +39,30 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::TeamList ) - end # Create a new team. The user who creates the team will automatically be # assigned as the owner of the team. Only the users with the owner role can # invite new members, add new owners and delete or update the team. # - # @param [String] team_id Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] team_id Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Team name. Max length: 128 chars. # @param [Array] roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. # # @return [Team] - def create(team_id:, name:, roles: nil) + def create( + team_id:, + name:, + roles: nil + ) api_path = '/teams' if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { @@ -64,7 +70,7 @@ def create(team_id:, name:, roles: nil) name: name, roles: roles, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -78,7 +84,6 @@ def create(team_id:, name:, roles: nil) params: api_params, response_type: Models::Team ) - end # Get a team by its ID. All team members have read access for this resource. @@ -86,17 +91,18 @@ def create(team_id:, name:, roles: nil) # @param [String] team_id Team ID. # # @return [Team] - def get(team_id:) + def get( + team_id: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -109,31 +115,33 @@ def get(team_id:) params: api_params, response_type: Models::Team ) - end - # Update the team's name by its unique ID. + # Update the team's name by its unique ID. # # @param [String] team_id Team ID. # @param [String] name New team name. Max length: 128 chars. # # @return [Team] - def update_name(team_id:, name:) + def update_name( + team_id:, + name: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -147,7 +155,6 @@ def update_name(team_id:, name:) params: api_params, response_type: Models::Team ) - end # Delete a team using its ID. Only team members with the owner role can @@ -156,17 +163,18 @@ def update_name(team_id:, name:) # @param [String] team_id Team ID. # # @return [] - def delete(team_id:) + def delete( + team_id: + ) api_path = '/teams/{teamId}' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -178,7 +186,6 @@ def delete(team_id:) headers: api_headers, params: api_params, ) - end # List app installations on a team. Any team member can read installations. @@ -188,19 +195,23 @@ def delete(team_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [AppInstallationList] - def list_installations(team_id:, queries: nil, total: nil) + def list_installations( + team_id:, + queries: nil, + total: nil + ) api_path = '/teams/{teamId}/installations' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -213,7 +224,6 @@ def list_installations(team_id:, queries: nil, total: nil) params: api_params, response_type: Models::AppInstallationList ) - end # Install an app on a team. When authenticated as a user, only team members @@ -226,23 +236,27 @@ def list_installations(team_id:, queries: nil, total: nil) # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. # # @return [AppInstallation] - def create_installation(team_id:, app_id:, authorization_details: nil) + def create_installation( + team_id:, + app_id:, + authorization_details: nil + ) api_path = '/teams/{teamId}/installations' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if app_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "appId"') + raise Appwrite::Exception.new('Missing required parameter: "appId"') end api_params = { appId: app_id, authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -256,7 +270,6 @@ def create_installation(team_id:, app_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Get an app installation on a team by its unique ID. Any team member can @@ -266,22 +279,24 @@ def create_installation(team_id:, app_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [AppInstallation] - def get_installation(team_id:, installation_id:) + def get_installation( + team_id:, + installation_id: + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -294,11 +309,10 @@ def get_installation(team_id:, installation_id:) params: api_params, response_type: Models::AppInstallation ) - end # Update an app installation on a team. Only team members with the owner role - # can update installations. The installation's granted scopes are refreshed + # can update installations. The installation's granted scopes are refreshed # to the scopes the app currently requests; previously issued installation # access tokens are revoked. # @@ -307,23 +321,27 @@ def get_installation(team_id:, installation_id:) # @param [String] authorization_details Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. # # @return [AppInstallation] - def update_installation(team_id:, installation_id:, authorization_details: nil) + def update_installation( + team_id:, + installation_id:, + authorization_details: nil + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end api_params = { authorizationDetails: authorization_details, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -337,7 +355,6 @@ def update_installation(team_id:, installation_id:, authorization_details: nil) params: api_params, response_type: Models::AppInstallation ) - end # Uninstall an app from a team by its installation ID. Only team members with @@ -348,22 +365,24 @@ def update_installation(team_id:, installation_id:, authorization_details: nil) # @param [String] installation_id Installation unique ID. # # @return [] - def delete_installation(team_id:, installation_id:) + def delete_installation( + team_id:, + installation_id: + ) api_path = '/teams/{teamId}/installations/{installationId}' .gsub('{teamId}', team_id) .gsub('{installationId}', installation_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if installation_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "installationId"') + raise Appwrite::Exception.new('Missing required parameter: "installationId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -376,10 +395,9 @@ def delete_installation(team_id:, installation_id:) headers: api_headers, params: api_params, ) - end - # Use this endpoint to list a team's members using the team's ID. All team + # Use this endpoint to list a team's members using the team's ID. All team # members have read access to this endpoint. Hide sensitive attributes from # the response by toggling membership privacy in the Console. # @@ -389,12 +407,17 @@ def delete_installation(team_id:, installation_id:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(team_id:, queries: nil, search: nil, total: nil) + def list_memberships( + team_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/teams/{teamId}/memberships' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end api_params = { @@ -402,7 +425,7 @@ def list_memberships(team_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -415,50 +438,57 @@ def list_memberships(team_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # Invite a new member to join your team. Provide an ID for existing users, or # invite unregistered users using an email or phone number. If initiated from # a Client SDK, Appwrite will send an email or sms with a link to join the # team to the invited user, and an account will be created for them if one - # doesn't exist. If initiated from a Server SDK, the new member will be added + # doesn't exist. If initiated from a Server SDK, the new member will be added # automatically to the team. - # + # # You only need to provide one of a user ID, email, or phone number. Appwrite - # will prioritize accepting the user ID > email > phone number if you provide + # will prioritize accepting the user ID > email > phone number if you provide # more than one of these parameters. - # + # # Use the `url` parameter to redirect the user from the invitation email to # your app. After the user is redirected, use the [Update Team Membership # Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) - # endpoint to allow the user to accept the invitation to the team. - # + # endpoint to allow the user to accept the invitation to the team. + # # Please note that to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) # Appwrite will accept the only redirect URLs under the domains you have # added as a platform on the Appwrite Console. - # + # # # @param [String] team_id Team ID. # @param [Array] roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # @param [String] email Email of the new team member. # @param [String] user_id ID of the user to be added to a team. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. # @param [String] name Name of the new team member. Max length: 128 chars. # # @return [Membership] - def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, url: nil, name: nil) + def create_membership( + team_id:, + roles:, + email: nil, + user_id: nil, + phone: nil, + url: nil, + name: nil + ) api_path = '/teams/{teamId}/memberships' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { @@ -469,7 +499,7 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur url: url, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -483,7 +513,6 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur params: api_params, response_type: Models::Membership ) - end # Get a team member by the membership unique id. All team members have read @@ -494,22 +523,24 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur # @param [String] membership_id Membership ID. # # @return [Membership] - def get_membership(team_id:, membership_id:) + def get_membership( + team_id:, + membership_id: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -522,40 +553,43 @@ def get_membership(team_id:, membership_id:) params: api_params, response_type: Models::Membership ) - end # Modify the roles of a team member. Only team members with the owner role # have access to this endpoint. Learn more about [roles and # permissions](https://appwrite.io/docs/permissions). - # + # # # @param [String] team_id Team ID. # @param [String] membership_id Membership ID. - # @param [Array] roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + # @param [Array] roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. # # @return [Membership] - def update_membership(team_id:, membership_id:, roles:) + def update_membership( + team_id:, + membership_id:, + roles: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if roles.nil? - raise Appwrite::Exception.new('Missing required parameter: "roles"') + raise Appwrite::Exception.new('Missing required parameter: "roles"') end api_params = { roles: roles, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -569,7 +603,6 @@ def update_membership(team_id:, membership_id:, roles:) params: api_params, response_type: Models::Membership ) - end # This endpoint allows a user to leave a team or for a team owner to delete @@ -580,22 +613,24 @@ def update_membership(team_id:, membership_id:, roles:) # @param [String] membership_id Membership ID. # # @return [] - def delete_membership(team_id:, membership_id:) + def delete_membership( + team_id:, + membership_id: + ) api_path = '/teams/{teamId}/memberships/{membershipId}' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -607,16 +642,15 @@ def delete_membership(team_id:, membership_id:) headers: api_headers, params: api_params, ) - end # Use this endpoint to allow a user to accept an invitation to join a team # after being redirected back to your app from the invitation email received # by the user. - # + # # If the request is successful, a session for the user is automatically # created. - # + # # # @param [String] team_id Team ID. # @param [String] membership_id Membership ID. @@ -624,32 +658,37 @@ def delete_membership(team_id:, membership_id:) # @param [String] secret Secret key. # # @return [Membership] - def update_membership_status(team_id:, membership_id:, user_id:, secret:) + def update_membership_status( + team_id:, + membership_id:, + user_id:, + secret: + ) api_path = '/teams/{teamId}/memberships/{membershipId}/status' .gsub('{teamId}', team_id) .gsub('{membershipId}', membership_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if membership_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "membershipId"') + raise Appwrite::Exception.new('Missing required parameter: "membershipId"') end if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? - raise Appwrite::Exception.new('Missing required parameter: "secret"') + raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_params = { userId: user_id, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -663,27 +702,27 @@ def update_membership_status(team_id:, membership_id:, user_id:, secret:) params: api_params, response_type: Models::Membership ) - end - # Get the team's shared preferences by its unique ID. If a preference doesn't + # Get the team's shared preferences by its unique ID. If a preference doesn't # need to be shared by all team members, prefer storing them in [user # preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). # # @param [String] team_id Team ID. # # @return [Preferences] - def get_prefs(team_id:) + def get_prefs( + team_id: + ) api_path = '/teams/{teamId}/prefs' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -696,10 +735,9 @@ def get_prefs(team_id:) params: api_params, response_type: Models::Preferences ) - end - # Update the team's preferences by its unique ID. The object you pass is + # Update the team's preferences by its unique ID. The object you pass is # stored as is and replaces any previous value. The maximum allowed prefs # size is 64kB and throws an error if exceeded. # @@ -707,22 +745,25 @@ def get_prefs(team_id:) # @param [Hash] prefs Prefs key-value JSON object. # # @return [Preferences] - def update_prefs(team_id:, prefs:) + def update_prefs( + team_id:, + prefs: + ) api_path = '/teams/{teamId}/prefs' .gsub('{teamId}', team_id) if team_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "teamId"') + raise Appwrite::Exception.new('Missing required parameter: "teamId"') end if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -736,8 +777,6 @@ def update_prefs(team_id:, prefs:) params: api_params, response_type: Models::Preferences ) - end - - end + end end diff --git a/lib/appwrite/services/tokens.rb b/lib/appwrite/services/tokens.rb index 81abddf..72ba971 100644 --- a/lib/appwrite/services/tokens.rb +++ b/lib/appwrite/services/tokens.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Tokens < Service - def initialize(client) @client = client end @@ -16,24 +15,29 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [ResourceTokenList] - def list(bucket_id:, file_id:, queries: nil, total: nil) + def list( + bucket_id:, + file_id:, + queries: nil, + total: nil + ) api_path = '/tokens/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -46,7 +50,6 @@ def list(bucket_id:, file_id:, queries: nil, total: nil) params: api_params, response_type: Models::ResourceTokenList ) - end # Create a new token. A token is linked to a file. Token can be passed as a @@ -57,23 +60,27 @@ def list(bucket_id:, file_id:, queries: nil, total: nil) # @param [String] expire Token expiry date # # @return [ResourceToken] - def create_file_token(bucket_id:, file_id:, expire: nil) + def create_file_token( + bucket_id:, + file_id:, + expire: nil + ) api_path = '/tokens/buckets/{bucketId}/files/{fileId}' .gsub('{bucketId}', bucket_id) .gsub('{fileId}', file_id) if bucket_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "bucketId"') + raise Appwrite::Exception.new('Missing required parameter: "bucketId"') end if file_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "fileId"') + raise Appwrite::Exception.new('Missing required parameter: "fileId"') end api_params = { expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -87,7 +94,6 @@ def create_file_token(bucket_id:, file_id:, expire: nil) params: api_params, response_type: Models::ResourceToken ) - end # Get a token by its unique ID. @@ -95,17 +101,18 @@ def create_file_token(bucket_id:, file_id:, expire: nil) # @param [String] token_id Token ID. # # @return [ResourceToken] - def get(token_id:) + def get( + token_id: + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -118,28 +125,30 @@ def get(token_id:) params: api_params, response_type: Models::ResourceToken ) - end - # Update a token by its unique ID. Use this endpoint to update a token's + # Update a token by its unique ID. Use this endpoint to update a token's # expiry date. # # @param [String] token_id Token unique ID. # @param [String] expire File token expiry date # # @return [ResourceToken] - def update(token_id:, expire: nil) + def update( + token_id:, + expire: nil + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end api_params = { expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -153,7 +162,6 @@ def update(token_id:, expire: nil) params: api_params, response_type: Models::ResourceToken ) - end # Delete a token by its unique ID. @@ -161,17 +169,18 @@ def update(token_id:, expire: nil) # @param [String] token_id Token ID. # # @return [] - def delete(token_id:) + def delete( + token_id: + ) api_path = '/tokens/{tokenId}' .gsub('{tokenId}', token_id) if token_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "tokenId"') + raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -183,8 +192,6 @@ def delete(token_id:) headers: api_headers, params: api_params, ) - end - - end + end end diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index a3c1925..86f5483 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -1,13 +1,12 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Users < Service - def initialize(client) @client = client end - # Get a list of all the project's users. You can use the query params to + # Get a list of all the project's users. You can use the query params to # filter your results. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator, accessedAt @@ -15,7 +14,11 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [UserList] - def list(queries: nil, search: nil, total: nil) + def list( + queries: nil, + search: nil, + total: nil + ) api_path = '/users' api_params = { @@ -23,7 +26,7 @@ def list(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -36,23 +39,28 @@ def list(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::UserList ) - end # Create a new user. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. - # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. # @param [String] password Plain text user password. Must be at least 8 chars. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create(user_id:, email: nil, phone: nil, password: nil, name: nil) + def create( + user_id:, + email: nil, + phone: nil, + password: nil, + name: nil + ) api_path = '/users' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -62,7 +70,7 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -76,7 +84,6 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -84,25 +91,30 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Argon2. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_argon2_user(user_id:, email:, password:, name: nil) + def create_argon2_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/argon2' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -111,7 +123,7 @@ def create_argon2_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -125,7 +137,6 @@ def create_argon2_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -133,25 +144,30 @@ def create_argon2_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Bcrypt. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_bcrypt_user(user_id:, email:, password:, name: nil) + def create_bcrypt_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/bcrypt' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -160,7 +176,7 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -174,7 +190,6 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Get identities for all users. @@ -184,7 +199,11 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [IdentityList] - def list_identities(queries: nil, search: nil, total: nil) + def list_identities( + queries: nil, + search: nil, + total: nil + ) api_path = '/users/identities' api_params = { @@ -192,7 +211,7 @@ def list_identities(queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -205,7 +224,6 @@ def list_identities(queries: nil, search: nil, total: nil) params: api_params, response_type: Models::IdentityList ) - end # Delete an identity by its unique ID. @@ -213,17 +231,18 @@ def list_identities(queries: nil, search: nil, total: nil) # @param [String] identity_id Identity ID. # # @return [] - def delete_identity(identity_id:) + def delete_identity( + identity_id: + ) api_path = '/users/identities/{identityId}' .gsub('{identityId}', identity_id) if identity_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "identityId"') + raise Appwrite::Exception.new('Missing required parameter: "identityId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -235,7 +254,6 @@ def delete_identity(identity_id:) headers: api_headers, params: api_params, ) - end # Create a new user. Password provided must be hashed with the @@ -243,25 +261,30 @@ def delete_identity(identity_id:) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using MD5. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_md5_user(user_id:, email:, password:, name: nil) + def create_md5_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/md5' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -270,7 +293,7 @@ def create_md5_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -284,7 +307,6 @@ def create_md5_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -292,25 +314,30 @@ def create_md5_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using PHPass. # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_ph_pass_user(user_id:, email:, password:, name: nil) + def create_ph_pass_user( + user_id:, + email:, + password:, + name: nil + ) api_path = '/users/phpass' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -319,7 +346,7 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) password: password, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -333,7 +360,6 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -341,7 +367,7 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Scrypt. # @param [String] password_salt Optional salt used to hash password. @@ -352,39 +378,49 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu:, password_memory:, password_parallel:, password_length:, name: nil) + def create_scrypt_user( + user_id:, + email:, + password:, + password_salt:, + password_cpu:, + password_memory:, + password_parallel:, + password_length:, + name: nil + ) api_path = '/users/scrypt' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end if password_salt.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') end if password_cpu.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordCpu"') + raise Appwrite::Exception.new('Missing required parameter: "passwordCpu"') end if password_memory.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordMemory"') + raise Appwrite::Exception.new('Missing required parameter: "passwordMemory"') end if password_parallel.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordParallel"') + raise Appwrite::Exception.new('Missing required parameter: "passwordParallel"') end if password_length.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordLength"') + raise Appwrite::Exception.new('Missing required parameter: "passwordLength"') end api_params = { @@ -398,7 +434,7 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu passwordLength: password_length, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -412,7 +448,6 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the [Scrypt @@ -421,7 +456,7 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to # create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using Scrypt Modified. # @param [String] password_salt Salt used to hash password. @@ -430,31 +465,39 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, password_salt_separator:, password_signer_key:, name: nil) + def create_scrypt_modified_user( + user_id:, + email:, + password:, + password_salt:, + password_salt_separator:, + password_signer_key:, + name: nil + ) api_path = '/users/scrypt-modified' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end if password_salt.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"') end if password_salt_separator.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSaltSeparator"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSaltSeparator"') end if password_signer_key.nil? - raise Appwrite::Exception.new('Missing required parameter: "passwordSignerKey"') + raise Appwrite::Exception.new('Missing required parameter: "passwordSignerKey"') end api_params = { @@ -466,7 +509,7 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas passwordSignerKey: password_signer_key, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -480,7 +523,6 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas params: api_params, response_type: Models::User ) - end # Create a new user. Password provided must be hashed with the @@ -488,26 +530,32 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas # the [POST /users](https://appwrite.io/docs/server/users#usersCreate) # endpoint to create users with a plain text password. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. # @param [String] password User password hashed using SHA. - # @param [PasswordHash] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + # @param [PasswordHash] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' # @param [String] name User name. Max length: 128 chars. # # @return [User] - def create_sha_user(user_id:, email:, password:, password_version: nil, name: nil) + def create_sha_user( + user_id:, + email:, + password:, + password_version: nil, + name: nil + ) api_path = '/users/sha' if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { @@ -517,7 +565,7 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni passwordVersion: password_version, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -531,7 +579,6 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni params: api_params, response_type: Models::User ) - end # Get a user by its unique ID. @@ -539,17 +586,18 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni # @param [String] user_id User ID. # # @return [User] - def get(user_id:) + def get( + user_id: + ) api_path = '/users/{userId}' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -562,10 +610,9 @@ def get(user_id:) params: api_params, response_type: Models::User ) - end - # Delete a user by its unique ID, thereby releasing it's ID. Since ID is + # Delete a user by its unique ID, thereby releasing it's ID. Since ID is # released and can be reused, all user-related resources like documents or # storage files should be deleted before user deletion. If you want to keep # ID reserved, use the @@ -575,17 +622,18 @@ def get(user_id:) # @param [String] user_id User ID. # # @return [] - def delete(user_id:) + def delete( + user_id: + ) api_path = '/users/{userId}' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -597,7 +645,6 @@ def delete(user_id:) headers: api_headers, params: api_params, ) - end # Update the user email by its unique ID. @@ -606,22 +653,25 @@ def delete(user_id:) # @param [String] email User email. # # @return [User] - def update_email(user_id:, email:) + def update_email( + user_id:, + email: + ) api_path = '/users/{userId}/email' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? - raise Appwrite::Exception.new('Missing required parameter: "email"') + raise Appwrite::Exception.new('Missing required parameter: "email"') end api_params = { email: email, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -635,7 +685,6 @@ def update_email(user_id:, email:) params: api_params, response_type: Models::User ) - end # Enable or disable whether a user can impersonate other users. When @@ -643,28 +692,31 @@ def update_email(user_id:, email:) # behavior, while internal audit logs still attribute the action to the # original impersonator and store the impersonated target details only in # internal audit payload data. - # + # # # @param [String] user_id User ID. # @param [] impersonator Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. # # @return [User] - def update_impersonator(user_id:, impersonator:) + def update_impersonator( + user_id:, + impersonator: + ) api_path = '/users/{userId}/impersonator' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if impersonator.nil? - raise Appwrite::Exception.new('Missing required parameter: "impersonator"') + raise Appwrite::Exception.new('Missing required parameter: "impersonator"') end api_params = { impersonator: impersonator, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -678,7 +730,6 @@ def update_impersonator(user_id:, impersonator:) params: api_params, response_type: Models::User ) - end # Use this endpoint to create a JSON Web Token for user by its unique ID. You @@ -686,23 +737,27 @@ def update_impersonator(user_id:, impersonator:) # secret will become invalid if the session it uses gets deleted. # # @param [String] user_id User ID. - # @param [String] session_id Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + # @param [String] session_id Session ID. Use the string 'recent()' to use the most recent session, which is also the default. # @param [Integer] duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. # # @return [Jwt] - def create_jwt(user_id:, session_id: nil, duration: nil) + def create_jwt( + user_id:, + session_id: nil, + duration: nil + ) api_path = '/users/{userId}/jwts' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { sessionId: session_id, duration: duration, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -716,13 +771,12 @@ def create_jwt(user_id:, session_id: nil, duration: nil) params: api_params, response_type: Models::Jwt ) - end - # Update the user labels by its unique ID. - # + # Update the user labels by its unique ID. + # # Labels can be used to grant access to resources. While teams are a way for - # user's to share access to a resource, labels can be defined by the + # user's to share access to a resource, labels can be defined by the # developer to grant access without an invitation. See the [Permissions # docs](https://appwrite.io/docs/permissions) for more info. # @@ -730,22 +784,25 @@ def create_jwt(user_id:, session_id: nil, duration: nil) # @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. # # @return [User] - def update_labels(user_id:, labels:) + def update_labels( + user_id:, + labels: + ) api_path = '/users/{userId}/labels' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if labels.nil? - raise Appwrite::Exception.new('Missing required parameter: "labels"') + raise Appwrite::Exception.new('Missing required parameter: "labels"') end api_params = { labels: labels, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -759,7 +816,6 @@ def update_labels(user_id:, labels:) params: api_params, response_type: Models::User ) - end # Get the user activity logs list by its unique ID. @@ -769,19 +825,23 @@ def update_labels(user_id:, labels:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [LogList] - def list_logs(user_id:, queries: nil, total: nil) + def list_logs( + user_id:, + queries: nil, + total: nil + ) api_path = '/users/{userId}/logs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -794,7 +854,6 @@ def list_logs(user_id:, queries: nil, total: nil) params: api_params, response_type: Models::LogList ) - end # Get the user membership list by its unique ID. @@ -805,12 +864,17 @@ def list_logs(user_id:, queries: nil, total: nil) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [MembershipList] - def list_memberships(user_id:, queries: nil, search: nil, total: nil) + def list_memberships( + user_id:, + queries: nil, + search: nil, + total: nil + ) api_path = '/users/{userId}/memberships' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { @@ -818,7 +882,7 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) search: search, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -831,7 +895,6 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) params: api_params, response_type: Models::MembershipList ) - end # Enable or disable MFA on a user account. @@ -840,22 +903,25 @@ def list_memberships(user_id:, queries: nil, search: nil, total: nil) # @param [] mfa Enable or disable MFA. # # @return [User] - def update_mfa(user_id:, mfa:) + def update_mfa( + user_id:, + mfa: + ) api_path = '/users/{userId}/mfa' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if mfa.nil? - raise Appwrite::Exception.new('Missing required parameter: "mfa"') + raise Appwrite::Exception.new('Missing required parameter: "mfa"') end api_params = { mfa: mfa, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -869,7 +935,6 @@ def update_mfa(user_id:, mfa:) params: api_params, response_type: Models::User ) - end # Delete an authenticator app. @@ -878,22 +943,24 @@ def update_mfa(user_id:, mfa:) # @param [AuthenticatorType] type Type of authenticator. # # @return [] - def delete_mfa_authenticator(user_id:, type:) + def delete_mfa_authenticator( + user_id:, + type: + ) api_path = '/users/{userId}/mfa/authenticators/{type}' .gsub('{userId}', user_id) .gsub('{type}', type) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if type.nil? - raise Appwrite::Exception.new('Missing required parameter: "type"') + raise Appwrite::Exception.new('Missing required parameter: "type"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -905,7 +972,6 @@ def delete_mfa_authenticator(user_id:, type:) headers: api_headers, params: api_params, ) - end # Get a custom MFA challenge for a user, including the code to be delivered @@ -915,22 +981,24 @@ def delete_mfa_authenticator(user_id:, type:) # @param [String] challenge_id ID of the challenge. # # @return [MfaChallengeSecret] - def get_mfa_challenge(user_id:, challenge_id:) + def get_mfa_challenge( + user_id:, + challenge_id: + ) api_path = '/users/{userId}/mfa/challenges/{challengeId}' .gsub('{userId}', user_id) .gsub('{challengeId}', challenge_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if challenge_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "challengeId"') + raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -943,7 +1011,6 @@ def get_mfa_challenge(user_id:, challenge_id:) params: api_params, response_type: Models::MfaChallengeSecret ) - end # List the factors available on the account to be used as a MFA challange. @@ -951,17 +1018,18 @@ def get_mfa_challenge(user_id:, challenge_id:) # @param [String] user_id User ID. # # @return [MfaFactors] - def list_mfa_factors(user_id:) + def list_mfa_factors( + user_id: + ) api_path = '/users/{userId}/mfa/factors' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -974,7 +1042,6 @@ def list_mfa_factors(user_id:) params: api_params, response_type: Models::MfaFactors ) - end # Get recovery codes that can be used as backup for MFA flow by User ID. @@ -985,17 +1052,18 @@ def list_mfa_factors(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def get_mfa_recovery_codes(user_id:) + def get_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1008,7 +1076,6 @@ def get_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Regenerate recovery codes that can be used as backup for MFA flow by User @@ -1019,17 +1086,18 @@ def get_mfa_recovery_codes(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def update_mfa_recovery_codes(user_id:) + def update_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1043,7 +1111,6 @@ def update_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Generate recovery codes used as backup for MFA flow for User ID. Recovery @@ -1054,17 +1121,18 @@ def update_mfa_recovery_codes(user_id:) # @param [String] user_id User ID. # # @return [MfaRecoveryCodes] - def create_mfa_recovery_codes(user_id:) + def create_mfa_recovery_codes( + user_id: + ) api_path = '/users/{userId}/mfa/recovery-codes' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1078,7 +1146,6 @@ def create_mfa_recovery_codes(user_id:) params: api_params, response_type: Models::MfaRecoveryCodes ) - end # Update the user name by its unique ID. @@ -1087,22 +1154,25 @@ def create_mfa_recovery_codes(user_id:) # @param [String] name User name. Max length: 128 chars. # # @return [User] - def update_name(user_id:, name:) + def update_name( + user_id:, + name: + ) api_path = '/users/{userId}/name' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1116,7 +1186,6 @@ def update_name(user_id:, name:) params: api_params, response_type: Models::User ) - end # Update the user password by its unique ID. @@ -1125,22 +1194,25 @@ def update_name(user_id:, name:) # @param [String] password New user password. Must be at least 8 chars. # # @return [User] - def update_password(user_id:, password:) + def update_password( + user_id:, + password: + ) api_path = '/users/{userId}/password' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if password.nil? - raise Appwrite::Exception.new('Missing required parameter: "password"') + raise Appwrite::Exception.new('Missing required parameter: "password"') end api_params = { password: password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1154,7 +1226,6 @@ def update_password(user_id:, password:) params: api_params, response_type: Models::User ) - end # Update the user phone by its unique ID. @@ -1163,22 +1234,25 @@ def update_password(user_id:, password:) # @param [String] number User phone number. # # @return [User] - def update_phone(user_id:, number:) + def update_phone( + user_id:, + number: + ) api_path = '/users/{userId}/phone' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if number.nil? - raise Appwrite::Exception.new('Missing required parameter: "number"') + raise Appwrite::Exception.new('Missing required parameter: "number"') end api_params = { number: number, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1192,7 +1266,6 @@ def update_phone(user_id:, number:) params: api_params, response_type: Models::User ) - end # Get the user preferences by its unique ID. @@ -1200,17 +1273,18 @@ def update_phone(user_id:, number:) # @param [String] user_id User ID. # # @return [Preferences] - def get_prefs(user_id:) + def get_prefs( + user_id: + ) api_path = '/users/{userId}/prefs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1223,7 +1297,6 @@ def get_prefs(user_id:) params: api_params, response_type: Models::Preferences ) - end # Update the user preferences by its unique ID. The object you pass is stored @@ -1234,22 +1307,25 @@ def get_prefs(user_id:) # @param [Hash] prefs Prefs key-value JSON object. # # @return [Preferences] - def update_prefs(user_id:, prefs:) + def update_prefs( + user_id:, + prefs: + ) api_path = '/users/{userId}/prefs' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if prefs.nil? - raise Appwrite::Exception.new('Missing required parameter: "prefs"') + raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_params = { prefs: prefs, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1263,7 +1339,6 @@ def update_prefs(user_id:, prefs:) params: api_params, response_type: Models::Preferences ) - end # Get the user sessions list by its unique ID. @@ -1272,18 +1347,21 @@ def update_prefs(user_id:, prefs:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [SessionList] - def list_sessions(user_id:, total: nil) + def list_sessions( + user_id:, + total: nil + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1296,30 +1374,30 @@ def list_sessions(user_id:, total: nil) params: api_params, response_type: Models::SessionList ) - end # Creates a session for a user. Returns an immediately usable session object. - # + # # If you want to generate a token for a custom authentication flow, use the # [POST # /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) # endpoint. # - # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # # @return [Session] - def create_session(user_id:) + def create_session( + user_id: + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1333,25 +1411,25 @@ def create_session(user_id:) params: api_params, response_type: Models::Session ) - end - # Delete all user's sessions by using the user's unique ID. + # Delete all user's sessions by using the user's unique ID. # # @param [String] user_id User ID. # # @return [] - def delete_sessions(user_id:) + def delete_sessions( + user_id: + ) api_path = '/users/{userId}/sessions' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1363,7 +1441,6 @@ def delete_sessions(user_id:) headers: api_headers, params: api_params, ) - end # Delete a user sessions by its unique ID. @@ -1372,22 +1449,24 @@ def delete_sessions(user_id:) # @param [String] session_id Session ID. # # @return [] - def delete_session(user_id:, session_id:) + def delete_session( + user_id:, + session_id: + ) api_path = '/users/{userId}/sessions/{sessionId}' .gsub('{userId}', user_id) .gsub('{sessionId}', session_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if session_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "sessionId"') + raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1399,32 +1478,34 @@ def delete_session(user_id:, session_id:) headers: api_headers, params: api_params, ) - end # Update the user status by its unique ID. Use this endpoint as an - # alternative to deleting a user if you want to keep user's ID reserved. + # alternative to deleting a user if you want to keep user's ID reserved. # # @param [String] user_id User ID. # @param [] status User Status. To activate the user pass `true` and to block the user pass `false`. # # @return [User] - def update_status(user_id:, status:) + def update_status( + user_id:, + status: + ) api_path = '/users/{userId}/status' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if status.nil? - raise Appwrite::Exception.new('Missing required parameter: "status"') + raise Appwrite::Exception.new('Missing required parameter: "status"') end api_params = { status: status, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1438,7 +1519,6 @@ def update_status(user_id:, status:) params: api_params, response_type: Models::User ) - end # List the messaging targets that are associated with a user. @@ -1448,19 +1528,23 @@ def update_status(user_id:, status:) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [TargetList] - def list_targets(user_id:, queries: nil, total: nil) + def list_targets( + user_id:, + queries: nil, + total: nil + ) api_path = '/users/{userId}/targets' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1473,37 +1557,43 @@ def list_targets(user_id:, queries: nil, total: nil) params: api_params, response_type: Models::TargetList ) - end # Create a messaging target. # # @param [String] user_id User ID. - # @param [String] target_id Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] target_id Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [MessagingProviderType] provider_type The target provider type. Can be one of the following: `email`, `sms` or `push`. # @param [String] identifier The target identifier (token, email, phone etc.) # @param [String] provider_id Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. # # @return [Target] - def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id: nil, name: nil) + def create_target( + user_id:, + target_id:, + provider_type:, + identifier:, + provider_id: nil, + name: nil + ) api_path = '/users/{userId}/targets' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end if provider_type.nil? - raise Appwrite::Exception.new('Missing required parameter: "providerType"') + raise Appwrite::Exception.new('Missing required parameter: "providerType"') end if identifier.nil? - raise Appwrite::Exception.new('Missing required parameter: "identifier"') + raise Appwrite::Exception.new('Missing required parameter: "identifier"') end api_params = { @@ -1513,7 +1603,7 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id providerId: provider_id, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1527,31 +1617,32 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id params: api_params, response_type: Models::Target ) - end - # Get a user's push notification target by ID. + # Get a user's push notification target by ID. # # @param [String] user_id User ID. # @param [String] target_id Target ID. # # @return [Target] - def get_target(user_id:, target_id:) + def get_target( + user_id:, + target_id: + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -1564,7 +1655,6 @@ def get_target(user_id:, target_id:) params: api_params, response_type: Models::Target ) - end # Update a messaging target. @@ -1576,17 +1666,23 @@ def get_target(user_id:, target_id:) # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. # # @return [Target] - def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: nil) + def update_target( + user_id:, + target_id:, + identifier: nil, + provider_id: nil, + name: nil + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end api_params = { @@ -1594,7 +1690,7 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: providerId: provider_id, name: name, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1608,7 +1704,6 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: params: api_params, response_type: Models::Target ) - end # Delete a messaging target. @@ -1617,22 +1712,24 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: # @param [String] target_id Target ID. # # @return [] - def delete_target(user_id:, target_id:) + def delete_target( + user_id:, + target_id: + ) api_path = '/users/{userId}/targets/{targetId}' .gsub('{userId}', user_id) .gsub('{targetId}', target_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if target_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "targetId"') + raise Appwrite::Exception.new('Missing required parameter: "targetId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1644,33 +1741,36 @@ def delete_target(user_id:, target_id:) headers: api_headers, params: api_params, ) - end # Returns a token with a secret key for creating a session. Use the user ID # and secret and submit a request to the [PUT # /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) # endpoint to complete the login process. - # + # # # @param [String] user_id User ID. # @param [Integer] length Token length in characters. The default length is 6 characters # @param [Integer] expire Token expiration period in seconds. The default expiration is 15 minutes. # # @return [Token] - def create_token(user_id:, length: nil, expire: nil) + def create_token( + user_id:, + length: nil, + expire: nil + ) api_path = '/users/{userId}/tokens' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end api_params = { length: length, expire: expire, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1684,7 +1784,6 @@ def create_token(user_id:, length: nil, expire: nil) params: api_params, response_type: Models::Token ) - end # Update the user email verification status by its unique ID. @@ -1693,22 +1792,25 @@ def create_token(user_id:, length: nil, expire: nil) # @param [] email_verification User email verification status. # # @return [User] - def update_email_verification(user_id:, email_verification:) + def update_email_verification( + user_id:, + email_verification: + ) api_path = '/users/{userId}/verification' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email_verification.nil? - raise Appwrite::Exception.new('Missing required parameter: "emailVerification"') + raise Appwrite::Exception.new('Missing required parameter: "emailVerification"') end api_params = { emailVerification: email_verification, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1722,7 +1824,6 @@ def update_email_verification(user_id:, email_verification:) params: api_params, response_type: Models::User ) - end # Update the user phone verification status by its unique ID. @@ -1731,22 +1832,25 @@ def update_email_verification(user_id:, email_verification:) # @param [] phone_verification User phone verification status. # # @return [User] - def update_phone_verification(user_id:, phone_verification:) + def update_phone_verification( + user_id:, + phone_verification: + ) api_path = '/users/{userId}/verification/phone' .gsub('{userId}', user_id) if user_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "userId"') + raise Appwrite::Exception.new('Missing required parameter: "userId"') end if phone_verification.nil? - raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"') + raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"') end api_params = { phoneVerification: phone_verification, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -1760,8 +1864,6 @@ def update_phone_verification(user_id:, phone_verification:) params: api_params, response_type: Models::User ) - end - - end + end end diff --git a/lib/appwrite/services/vectors_db.rb b/lib/appwrite/services/vectors_db.rb new file mode 100644 index 0000000..7f90e6d --- /dev/null +++ b/lib/appwrite/services/vectors_db.rb @@ -0,0 +1,1614 @@ +# frozen_string_literal: true + +module Appwrite + class VectorsDB < Service + def initialize(client) + @client = client + end + + # Get a list of all databases from the current Appwrite project. You can use + # the search parameter to filter your results. + # + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [DatabaseList] + def list( + queries: nil, + total: nil + ) + api_path = '/vectorsdb' + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseList + ) + end + + # Create a new Database. + # + # + # @param [String] database_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Database name. Max length: 128 chars. + # @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [String] specification Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + # + # @return [Database] + def create( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/vectorsdb' + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + databaseId: database_id, + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # List the dedicated database specifications available on the current plan. + # Each specification reports its resource limits, pricing, and whether it is + # enabled for the organization. + # + # + # @return [DedicatedDatabaseSpecificationList] + def list_specifications() + api_path = '/vectorsdb/specifications' + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseSpecificationList + ) + end + + # List transactions across all databases. + # + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + # + # @return [TransactionList] + def list_transactions( + queries: nil + ) + api_path = '/vectorsdb/transactions' + + api_params = { + queries: queries, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::TransactionList + ) + end + + # Create a new transaction. + # + # @param [Integer] ttl Seconds before the transaction expires. + # + # @return [Transaction] + def create_transaction( + ttl: nil + ) + api_path = '/vectorsdb/transactions' + + api_params = { + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Get a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [Transaction] + def get_transaction( + transaction_id: + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Update a transaction, to either commit or roll back its operations. + # + # @param [String] transaction_id Transaction ID. + # @param [] commit Commit transaction? + # @param [] rollback Rollback transaction? + # + # @return [Transaction] + def update_transaction( + transaction_id:, + commit: nil, + rollback: nil + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + commit: commit, + rollback: rollback, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Delete a transaction by its unique ID. + # + # @param [String] transaction_id Transaction ID. + # + # @return [] + def delete_transaction( + transaction_id: + ) + api_path = '/vectorsdb/transactions/{transactionId}' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Create multiple operations in a single transaction. + # + # @param [String] transaction_id Transaction ID. + # @param [Array] operations Array of staged operations. + # + # @return [Transaction] + def create_operations( + transaction_id:, + operations: nil + ) + api_path = '/vectorsdb/transactions/{transactionId}/operations' + .gsub('{transactionId}', transaction_id) + + if transaction_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "transactionId"') + end + + api_params = { + operations: operations, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Transaction + ) + end + + # Get a database by its unique ID. This endpoint response returns a JSON + # object with the database metadata. + # + # @param [String] database_id Database ID. + # + # @return [Database] + def get( + database_id: + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # Update a database by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] name Database name. Max length: 128 chars. + # @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + # @param [String] specification Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + # + # @return [Database] + def update( + database_id:, + name:, + enabled: nil, + specification: nil, + replicas: nil, + sync_mode: nil + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + enabled: enabled, + specification: specification, + replicas: replicas, + syncMode: sync_mode, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + end + + # Delete a database by its unique ID. Only API keys with with databases.write + # scope can delete a database. + # + # @param [String] database_id Database ID. + # + # @return [] + def delete( + database_id: + ) + api_path = '/vectorsdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Get a list of all collections that belong to the provided databaseId. You + # can use the search parameter to filter your results. + # + # @param [String] database_id Database ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [VectorsdbCollectionList] + def list_collections( + database_id:, + queries: nil, + search: nil, + total: nil + ) + api_path = '/vectorsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + search: search, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::VectorsdbCollectionList + ) + end + + # Create a new Collection. Before using this route, you should create a new + # database resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Integer] dimension Embedding dimension. + # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # + # @return [VectorsdbCollection] + def create_collection( + database_id:, + collection_id:, + name:, + dimension:, + permissions: nil, + document_security: nil, + enabled: nil + ) + api_path = '/vectorsdb/{databaseId}/collections' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + if dimension.nil? + raise Appwrite::Exception.new('Missing required parameter: "dimension"') + end + + api_params = { + collectionId: collection_id, + name: name, + dimension: dimension, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::VectorsdbCollection + ) + end + + # Get a collection by its unique ID. This endpoint response returns a JSON + # object with the collection metadata. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [VectorsdbCollection] + def get_collection( + database_id:, + collection_id: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::VectorsdbCollection + ) + end + + # Update a collection by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] name Collection name. Max length: 128 chars. + # @param [Integer] dimension Embedding dimensions. + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # + # @return [VectorsdbCollection] + def update_collection( + database_id:, + collection_id:, + name:, + dimension: nil, + permissions: nil, + document_security: nil, + enabled: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + dimension: dimension, + permissions: permissions, + documentSecurity: document_security, + enabled: enabled, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::VectorsdbCollection + ) + end + + # Delete a collection by its unique ID. Only users with write permissions + # have access to delete this resource. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # + # @return [] + def delete_collection( + database_id:, + collection_id: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Get a list of all the user's documents in a given collection. You can use + # the query params to filter your results. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 524288 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def list_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Create a new Document. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [Hash] data Document data as JSON object. + # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # + # @return [Document] + def create_document( + database_id:, + collection_id:, + document_id:, + data:, + permissions: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + documentId: document_id, + data: data, + permissions: permissions, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Create new Documents. Before using this route, you should create a new + # collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + # @param [Array] documents Array of documents data as JSON objects. + # + # @return [DocumentList] + def create_documents( + database_id:, + collection_id:, + documents: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Create or update Documents. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Array] documents Array of document data as JSON objects. May contain partial documents. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def upsert_documents( + database_id:, + collection_id:, + documents:, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + + api_params = { + documents: documents, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Update all documents that match your queries, if no queries are submitted + # then all documents are updated. You can pass only specific fields to be + # updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def update_documents( + database_id:, + collection_id:, + data: nil, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + data: data, + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Bulk delete documents using queries, if no queries are passed then all + # documents are deleted. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [DocumentList] + def delete_documents( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Get a list of all the user's documents in a given collection using a POST + # request. This behaves identically to the list documents endpoint but + # accepts the queries in the request body, allowing much larger `queries` + # arrays than can fit in a URL query string. + # + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 524288 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + # + # @return [DocumentList] + def create_query( + database_id:, + collection_id:, + queries: nil, + transaction_id: nil, + total: nil, + ttl: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/query' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + total: total, + ttl: ttl, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DocumentList + ) + end + + # Get a document by its unique ID. This endpoint response returns a JSON + # object with the document data. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction. + # + # @return [Document] + def get_document( + database_id:, + collection_id:, + document_id:, + queries: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + queries: queries, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Create or update a Document. Before using this route, you should create a + # new collection resource using either a [server + # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def upsert_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Update a document by its unique ID. Using the patch method you can pass + # only specific fields that will get updated. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [Document] + def update_document( + database_id:, + collection_id:, + document_id:, + data: nil, + permissions: nil, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + data: data, + permissions: permissions, + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # Delete a document by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] document_id Document ID. + # @param [String] transaction_id Transaction ID for staging the operation. + # + # @return [] + def delete_document( + database_id:, + collection_id:, + document_id:, + transaction_id: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + api_params = { + transactionId: transaction_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List indexes in the collection. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [IndexList] + def list_indexes( + database_id:, + collection_id:, + queries: nil, + total: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::IndexList + ) + end + + # Creates an index on the attributes listed. Your index should include all + # the attributes you will query in a single request. + # Attributes can be `key`, `fulltext`, and `unique`. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # @param [VectorsDBIndexType] type Index type. + # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed. + # @param [Array] lengths Length of index. Maximum of 100 + # + # @return [Index] + def create_index( + database_id:, + collection_id:, + key:, + type:, + attributes:, + orders: nil, + lengths: nil + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + if attributes.nil? + raise Appwrite::Exception.new('Missing required parameter: "attributes"') + end + + api_params = { + key: key, + type: type, + attributes: attributes, + orders: orders, + lengths: lengths, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Index + ) + end + + # Get index by ID. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [Index] + def get_index( + database_id:, + collection_id:, + key: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Index + ) + end + + # Delete an index. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] key Index Key. + # + # @return [] + def delete_index( + database_id:, + collection_id:, + key: + ) + api_path = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Trigger a manual failover for a dedicated database with high availability + # enabled. Promotes a replica to primary. The failover runs asynchronously; + # poll the database document for status updates. A database left + # mid-operation also accepts this call as a repair once nothing is driving + # the operation it is stuck in. Repairing a failover that did not finish, a + # `failed` database, a stranded upgrade or migrate, or a stranded compute + # resize additionally requires `targetReplicaId` to name the member to + # promote, because the default target may be the member that operation + # already promoted. + # + # @param [String] database_id Database ID. + # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected. + # + # @return [DedicatedDatabase] + def create_failover( + database_id:, + target_replica_id: nil + ) + api_path = '/vectorsdb/{databaseId}/failovers' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + targetReplicaId: target_replica_id, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "content-type": 'application/json', + "accept": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabase + ) + end + + # List the lifecycle operations recorded for a dedicated database, newest + # first. Every provision, update, restore, backup and replication action is + # recorded here with its outcome, including an attempt that was abandoned + # because another worker took over the database. + # + # @param [String] database_id Database ID. + # @param [String] status Filter by operation status. + # @param [Integer] limit Maximum number of operations to return. + # @param [Integer] offset Number of operations to skip. + # + # @return [DedicatedDatabaseOperationList] + def list_operations( + database_id:, + status: nil, + limit: nil, + offset: nil + ) + api_path = '/vectorsdb/{databaseId}/operations' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + status: status, + limit: limit, + offset: offset, + } + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseOperationList + ) + end + + # Get high availability status for a dedicated database. Returns replica + # statuses, replication lag, and sync mode. + # + # @param [String] database_id Database ID. + # + # @return [DedicatedDatabaseReplicas] + def get_replicas( + database_id: + ) + api_path = '/vectorsdb/{databaseId}/replicas' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DedicatedDatabaseReplicas + ) + end + + # Get real-time health and status information for a dedicated database. + # Returns health status, readiness, uptime, connection info, replica status, + # and volume information. + # + # @param [String] database_id Database ID. + # + # @return [DatabaseStatus] + def get_status( + database_id: + ) + api_path = '/vectorsdb/{databaseId}/status' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = {} + + api_headers = { + "X-Appwrite-Project": @client.get_config('project'), + "accept": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::DatabaseStatus + ) + end + end +end diff --git a/lib/appwrite/services/webhooks.rb b/lib/appwrite/services/webhooks.rb index c988670..893cc08 100644 --- a/lib/appwrite/services/webhooks.rb +++ b/lib/appwrite/services/webhooks.rb @@ -1,8 +1,7 @@ -#frozen_string_literal: true +# frozen_string_literal: true module Appwrite class Webhooks < Service - def initialize(client) @client = client end @@ -14,14 +13,17 @@ def initialize(client) # @param [] total When set to false, the total count returned will be 0 and will not be calculated. # # @return [WebhookList] - def list(queries: nil, total: nil) + def list( + queries: nil, + total: nil + ) api_path = '/webhooks' api_params = { queries: queries, total: total, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -34,13 +36,12 @@ def list(queries: nil, total: nil) params: api_params, response_type: Models::WebhookList ) - end # Create a new webhook. Use this endpoint to configure a URL that will # receive events from Appwrite when specific events occur. # - # @param [String] webhook_id Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + # @param [String] webhook_id Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] url Webhook URL. # @param [String] name Webhook name. Max length: 128 chars. # @param [Array] events Events list. Maximum of 100 events are allowed. @@ -51,23 +52,33 @@ def list(queries: nil, total: nil) # @param [String] secret Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. # # @return [Webhook] - def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_username: nil, auth_password: nil, secret: nil) + def create( + webhook_id:, + url:, + name:, + events:, + enabled: nil, + tls: nil, + auth_username: nil, + auth_password: nil, + secret: nil + ) api_path = '/webhooks' if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if events.nil? - raise Appwrite::Exception.new('Missing required parameter: "events"') + raise Appwrite::Exception.new('Missing required parameter: "events"') end api_params = { @@ -81,7 +92,7 @@ def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_usern authPassword: auth_password, secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -95,26 +106,26 @@ def create(webhook_id:, url:, name:, events:, enabled: nil, tls: nil, auth_usern params: api_params, response_type: Models::Webhook ) - end # Get a webhook by its unique ID. This endpoint returns details about a - # specific webhook configured for a project. + # specific webhook configured for a project. # # @param [String] webhook_id Webhook ID. # # @return [Webhook] - def get(webhook_id:) + def get( + webhook_id: + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', @@ -127,7 +138,6 @@ def get(webhook_id:) params: api_params, response_type: Models::Webhook ) - end # Update a webhook by its unique ID. Use this endpoint to update the URL, @@ -143,24 +153,33 @@ def get(webhook_id:) # @param [String] auth_password Webhook HTTP password. Max length: 256 chars. # # @return [Webhook] - def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_username: nil, auth_password: nil) + def update( + webhook_id:, + name:, + url:, + events:, + enabled: nil, + tls: nil, + auth_username: nil, + auth_password: nil + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end if name.nil? - raise Appwrite::Exception.new('Missing required parameter: "name"') + raise Appwrite::Exception.new('Missing required parameter: "name"') end if url.nil? - raise Appwrite::Exception.new('Missing required parameter: "url"') + raise Appwrite::Exception.new('Missing required parameter: "url"') end if events.nil? - raise Appwrite::Exception.new('Missing required parameter: "events"') + raise Appwrite::Exception.new('Missing required parameter: "events"') end api_params = { @@ -172,7 +191,7 @@ def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_usern authUsername: auth_username, authPassword: auth_password, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -186,26 +205,26 @@ def update(webhook_id:, name:, url:, events:, enabled: nil, tls: nil, auth_usern params: api_params, response_type: Models::Webhook ) - end # Delete a webhook by its unique ID. Once deleted, the webhook will no longer - # receive project events. + # receive project events. # # @param [String] webhook_id Webhook ID. # # @return [] - def delete(webhook_id:) + def delete( + webhook_id: + ) api_path = '/webhooks/{webhookId}' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end - api_params = { - } - + api_params = {} + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -217,7 +236,6 @@ def delete(webhook_id:) headers: api_headers, params: api_params, ) - end # Update the webhook signing key. This endpoint can be used to regenerate the @@ -228,18 +246,21 @@ def delete(webhook_id:) # @param [String] secret Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. # # @return [Webhook] - def update_secret(webhook_id:, secret: nil) + def update_secret( + webhook_id:, + secret: nil + ) api_path = '/webhooks/{webhookId}/secret' .gsub('{webhookId}', webhook_id) if webhook_id.nil? - raise Appwrite::Exception.new('Missing required parameter: "webhookId"') + raise Appwrite::Exception.new('Missing required parameter: "webhookId"') end api_params = { secret: secret, } - + api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', @@ -253,8 +274,6 @@ def update_secret(webhook_id:, secret: nil) params: api_params, response_type: Models::Webhook ) - end - - end + end end