diff --git a/README.md b/README.md index 74b56ca..10803b5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Ruby SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite.gemspec b/appwrite.gemspec index 99c8f2d..d0a3ea4 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '16.1.0' + spec.version = '17.0.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-jwt.md similarity index 100% rename from docs/examples/account/create-j-w-t.md rename to docs/examples/account/create-jwt.md diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-url-token.md similarity index 100% rename from docs/examples/account/create-magic-u-r-l-token.md rename to docs/examples/account/create-magic-url-token.md diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth-2-token.md similarity index 100% rename from docs/examples/account/create-o-auth2token.md rename to docs/examples/account/create-o-auth-2-token.md diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-url-session.md similarity index 100% rename from docs/examples/account/update-magic-u-r-l-session.md rename to docs/examples/account/update-magic-url-session.md diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-mfa.md similarity index 100% rename from docs/examples/account/update-m-f-a.md rename to docs/examples/account/update-mfa.md diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-qr.md similarity index 100% rename from docs/examples/avatars/get-q-r.md rename to docs/examples/avatars/get-qr.md diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 9b5a5f4..9fd0191 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -5,7 +5,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint .set_project('') # Your project ID - .set_key('') # Your secret API key + .set_session('') # The user session to authenticate with databases = Databases.new(client) diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 40d8ba2..3e8bfe0 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -5,7 +5,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint .set_project('') # Your project ID - .set_key('') # Your secret API key + .set_session('') # The user session to authenticate with databases = Databases.new(client) diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index b64b1d5..666b995 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -16,5 +16,5 @@ result = functions.create_execution( path: '', # optional method: ExecutionMethod::GET, # optional headers: {}, # optional - scheduled_at: '' # optional + scheduled_at: '' # optional ) diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-db.md similarity index 100% rename from docs/examples/health/get-d-b.md rename to docs/examples/health/get-db.md diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-eu.md similarity index 100% rename from docs/examples/locale/list-countries-e-u.md rename to docs/examples/locale/list-countries-eu.md diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/create-msg91provider.md rename to docs/examples/messaging/create-msg-91-provider.md diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/update-msg91provider.md rename to docs/examples/messaging/update-msg-91-provider.md diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 0000000..99dfb41 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_boolean_column( + database_id: '', + table_id: '', + 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 new file mode 100644 index 0000000..f53b5ef --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_datetime_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 0000000..0a1ea92 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_email_column( + database_id: '', + table_id: '', + 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 new file mode 100644 index 0000000..0586dd8 --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_enum_column( + database_id: '', + table_id: '', + key: '', + elements: [], + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 0000000..88a0384 --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_float_column( + database_id: '', + table_id: '', + key: '', + required: false, + min: null, # optional + max: null, # optional + default: null, # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 0000000..f7c2d0e --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,21 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.create_index( + database_id: '', + table_id: '', + key: '', + type: IndexType::KEY, + columns: [], + orders: [], # optional + lengths: [] # optional +) diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 0000000..4b9690e --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_integer_column( + database_id: '', + table_id: '', + key: '', + required: false, + min: null, # optional + max: null, # optional + default: null, # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 0000000..1e32122 --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_ip_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 0000000..1c5a935 --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,22 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.create_relationship_column( + database_id: '', + table_id: '', + related_table_id: '', + type: RelationshipType::ONETOONE, + two_way: false, # optional + key: '', # optional + two_way_key: '', # optional + on_delete: RelationMutate::CASCADE # optional +) diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md new file mode 100644 index 0000000..5b66bc4 --- /dev/null +++ b/docs/examples/tablesdb/create-row.md @@ -0,0 +1,18 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.create_row( + database_id: '', + table_id: '', + row_id: '', + data: {}, + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 0000000..f258d4d --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_rows( + database_id: '', + table_id: '', + rows: [] +) diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 0000000..8167289 --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_string_column( + database_id: '', + table_id: '', + key: '', + size: 1, + required: false, + default: '', # optional + array: false, # optional + encrypt: false # optional +) diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 0000000..c8fcf47 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_table( + database_id: '', + table_id: '', + name: '', + permissions: ["read("any")"], # optional + row_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 0000000..fc2159f --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_url_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'https://example.com', # optional + array: false # optional +) diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 0000000..76346f5 --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create( + database_id: '', + name: '', + enabled: false # optional +) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md new file mode 100644 index 0000000..2143974 --- /dev/null +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -0,0 +1,19 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.decrement_row_column( + database_id: '', + table_id: '', + row_id: '', + column: '', + value: null, # optional + min: null # optional +) diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 0000000..d9d9c2f --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete_column( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 0000000..5998633 --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete_index( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md new file mode 100644 index 0000000..704f52f --- /dev/null +++ b/docs/examples/tablesdb/delete-row.md @@ -0,0 +1,16 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.delete_row( + database_id: '', + table_id: '', + row_id: '' +) diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 0000000..5b15c17 --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete_rows( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 0000000..2c955ae --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete_table( + database_id: '', + table_id: '' +) diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 0000000..3c4371c --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.delete( + database_id: '' +) diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 0000000..b231f2d --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_column( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 0000000..eb010e7 --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_index( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md new file mode 100644 index 0000000..621c2e1 --- /dev/null +++ b/docs/examples/tablesdb/get-row.md @@ -0,0 +1,17 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.get_row( + database_id: '', + table_id: '', + row_id: '', + queries: [] # optional +) diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 0000000..3584356 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get_table( + database_id: '', + table_id: '' +) diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 0000000..e8067bc --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.get( + database_id: '' +) diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md new file mode 100644 index 0000000..bf9b6cc --- /dev/null +++ b/docs/examples/tablesdb/increment-row-column.md @@ -0,0 +1,19 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.increment_row_column( + database_id: '', + table_id: '', + row_id: '', + column: '', + value: null, # optional + max: null # optional +) diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 0000000..f3f0165 --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_columns( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 0000000..85e343f --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_indexes( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md new file mode 100644 index 0000000..af971fb --- /dev/null +++ b/docs/examples/tablesdb/list-rows.md @@ -0,0 +1,16 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.list_rows( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 0000000..a2ec4cd --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list_tables( + database_id: '', + queries: [], # optional + search: '' # optional +) diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 0000000..ca0d464 --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.list( + queries: [], # optional + search: '' # optional +) diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 0000000..d048d76 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_boolean_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: false, + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 0000000..13bad26 --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_datetime_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 0000000..e5c97a5 --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_email_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'email@example.com', + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 0000000..4ae4574 --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_enum_column( + database_id: '', + table_id: '', + key: '', + elements: [], + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 0000000..5eb175f --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_float_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: null, + min: null, # optional + max: null, # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 0000000..e32e1d4 --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_integer_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: null, + min: null, # optional + max: null, # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 0000000..aae8ce9 --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_ip_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 0000000..3951cbc --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_relationship_column( + database_id: '', + table_id: '', + key: '', + on_delete: RelationMutate::CASCADE, # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md new file mode 100644 index 0000000..7a48c5e --- /dev/null +++ b/docs/examples/tablesdb/update-row.md @@ -0,0 +1,18 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.update_row( + database_id: '', + table_id: '', + row_id: '', + data: {}, # optional + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 0000000..7316241 --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_rows( + database_id: '', + table_id: '', + data: {}, # optional + queries: [] # optional +) diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 0000000..331ce88 --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_string_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + size: 1, # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 0000000..cb8706d --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_table( + database_id: '', + table_id: '', + name: '', + permissions: ["read("any")"], # optional + row_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 0000000..03034e9 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_url_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'https://example.com', + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 0000000..787d5c1 --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update( + database_id: '', + name: '', + enabled: false # optional +) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md new file mode 100644 index 0000000..5eb4281 --- /dev/null +++ b/docs/examples/tablesdb/upsert-row.md @@ -0,0 +1,18 @@ +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 + +tables_db = TablesDB.new(client) + +result = tables_db.upsert_row( + database_id: '', + table_id: '', + row_id: '', + data: {}, # optional + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 0000000..c48211d --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.upsert_rows( + database_id: '', + table_id: '', + rows: [] +) diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon-2-user.md similarity index 100% rename from docs/examples/users/create-argon2user.md rename to docs/examples/users/create-argon-2-user.md diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-jwt.md similarity index 100% rename from docs/examples/users/create-j-w-t.md rename to docs/examples/users/create-jwt.md diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-md-5-user.md similarity index 100% rename from docs/examples/users/create-m-d5user.md rename to docs/examples/users/create-md-5-user.md diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-ph-pass-user.md similarity index 100% rename from docs/examples/users/create-p-h-pass-user.md rename to docs/examples/users/create-ph-pass-user.md diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-sha-user.md similarity index 100% rename from docs/examples/users/create-s-h-a-user.md rename to docs/examples/users/create-sha-user.md diff --git a/lib/appwrite.rb b/lib/appwrite.rb index e80df28..5ed20fd 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -12,10 +12,13 @@ require_relative 'appwrite/role' require_relative 'appwrite/id' +require_relative 'appwrite/models/row_list' require_relative 'appwrite/models/document_list' +require_relative 'appwrite/models/table_list' require_relative 'appwrite/models/collection_list' require_relative 'appwrite/models/database_list' require_relative 'appwrite/models/index_list' +require_relative 'appwrite/models/column_index_list' require_relative 'appwrite/models/user_list' require_relative 'appwrite/models/session_list' require_relative 'appwrite/models/identity_list' @@ -57,7 +60,21 @@ require_relative 'appwrite/models/attribute_url' require_relative 'appwrite/models/attribute_datetime' require_relative 'appwrite/models/attribute_relationship' +require_relative 'appwrite/models/table' +require_relative 'appwrite/models/column_list' +require_relative 'appwrite/models/column_string' +require_relative 'appwrite/models/column_integer' +require_relative 'appwrite/models/column_float' +require_relative 'appwrite/models/column_boolean' +require_relative 'appwrite/models/column_email' +require_relative 'appwrite/models/column_enum' +require_relative 'appwrite/models/column_ip' +require_relative 'appwrite/models/column_url' +require_relative 'appwrite/models/column_datetime' +require_relative 'appwrite/models/column_relationship' require_relative 'appwrite/models/index' +require_relative 'appwrite/models/column_index' +require_relative 'appwrite/models/row' require_relative 'appwrite/models/document' require_relative 'appwrite/models/log' require_relative 'appwrite/models/user' @@ -145,6 +162,7 @@ require_relative 'appwrite/services/messaging' require_relative 'appwrite/services/sites' require_relative 'appwrite/services/storage' +require_relative 'appwrite/services/tables_db' require_relative 'appwrite/services/teams' require_relative 'appwrite/services/tokens' require_relative 'appwrite/services/users' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 6a8c307..85cb454 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,8 +15,8 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '16.1.0', - 'X-Appwrite-Response-Format' => '1.7.0' + 'x-sdk-version'=> '17.0.0', + 'X-Appwrite-Response-Format' => '1.8.0' } @endpoint = 'https://cloud.appwrite.io/v1' end diff --git a/lib/appwrite/models/column_boolean.rb b/lib/appwrite/models/column_boolean.rb new file mode 100644 index 0000000..e74c7c6 --- /dev/null +++ b/lib/appwrite/models/column_boolean.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnBoolean + 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 :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @default = default + end + + def self.from(map:) + ColumnBoolean.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"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_datetime.rb b/lib/appwrite/models/column_datetime.rb new file mode 100644 index 0000000..2d17155 --- /dev/null +++ b/lib/appwrite/models/column_datetime.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnDatetime + 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 :format + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + format:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @format = format + @default = default + end + + def self.from(map:) + ColumnDatetime.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"], + format: map["format"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "format": @format, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_email.rb b/lib/appwrite/models/column_email.rb new file mode 100644 index 0000000..889c8ca --- /dev/null +++ b/lib/appwrite/models/column_email.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnEmail + 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 :format + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + format:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @format = format + @default = default + end + + def self.from(map:) + ColumnEmail.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"], + format: map["format"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "format": @format, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_enum.rb b/lib/appwrite/models/column_enum.rb new file mode 100644 index 0000000..3d3c2c2 --- /dev/null +++ b/lib/appwrite/models/column_enum.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnEnum + 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 :elements + attr_reader :format + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + elements:, + format:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @elements = elements + @format = format + @default = default + end + + def self.from(map:) + ColumnEnum.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"], + elements: map["elements"], + format: map["format"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "elements": @elements, + "format": @format, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_float.rb b/lib/appwrite/models/column_float.rb new file mode 100644 index 0000000..e859909 --- /dev/null +++ b/lib/appwrite/models/column_float.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnFloat + 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 :min + attr_reader :max + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + min: , + max: , + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @min = min + @max = max + @default = default + end + + def self.from(map:) + ColumnFloat.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"], + min: map["min"], + max: map["max"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "min": @min, + "max": @max, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_index.rb b/lib/appwrite/models/column_index.rb new file mode 100644 index 0000000..c9927de --- /dev/null +++ b/lib/appwrite/models/column_index.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnIndex + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :columns + attr_reader :lengths + attr_reader :orders + + def initialize( + id:, + created_at:, + updated_at:, + key:, + type:, + status:, + error:, + columns:, + lengths:, + orders: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @key = key + @type = type + @status = status + @error = error + @columns = columns + @lengths = lengths + @orders = orders + end + + def self.from(map:) + ColumnIndex.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + columns: map["columns"], + lengths: map["lengths"], + orders: map["orders"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "columns": @columns, + "lengths": @lengths, + "orders": @orders + } + end + end + end +end diff --git a/lib/appwrite/models/column_index_list.rb b/lib/appwrite/models/column_index_list.rb new file mode 100644 index 0000000..8543887 --- /dev/null +++ b/lib/appwrite/models/column_index_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnIndexList + attr_reader :total + attr_reader :indexes + + def initialize( + total:, + indexes: + ) + @total = total + @indexes = indexes + end + + def self.from(map:) + ColumnIndexList.new( + total: map["total"], + indexes: map["indexes"].map { |it| ColumnIndex.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "indexes": @indexes.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/column_integer.rb b/lib/appwrite/models/column_integer.rb new file mode 100644 index 0000000..5253124 --- /dev/null +++ b/lib/appwrite/models/column_integer.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnInteger + 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 :min + attr_reader :max + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + min: , + max: , + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @min = min + @max = max + @default = default + end + + def self.from(map:) + ColumnInteger.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"], + min: map["min"], + max: map["max"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "min": @min, + "max": @max, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_ip.rb b/lib/appwrite/models/column_ip.rb new file mode 100644 index 0000000..9c5df3f --- /dev/null +++ b/lib/appwrite/models/column_ip.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnIp + 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 :format + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + format:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @format = format + @default = default + end + + def self.from(map:) + ColumnIp.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"], + format: map["format"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "format": @format, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/column_list.rb b/lib/appwrite/models/column_list.rb new file mode 100644 index 0000000..b01f858 --- /dev/null +++ b/lib/appwrite/models/column_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnList + attr_reader :total + attr_reader :columns + + def initialize( + total:, + columns: + ) + @total = total + @columns = columns + end + + def self.from(map:) + ColumnList.new( + total: map["total"], + columns: map["columns"] + ) + end + + def to_map + { + "total": @total, + "columns": @columns + } + end + end + end +end diff --git a/lib/appwrite/models/column_relationship.rb b/lib/appwrite/models/column_relationship.rb new file mode 100644 index 0000000..59a6823 --- /dev/null +++ b/lib/appwrite/models/column_relationship.rb @@ -0,0 +1,92 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnRelationship + 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 :related_table + attr_reader :relation_type + attr_reader :two_way + attr_reader :two_way_key + attr_reader :on_delete + attr_reader :side + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + related_table:, + relation_type:, + two_way:, + two_way_key:, + on_delete:, + side: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @related_table = related_table + @relation_type = relation_type + @two_way = two_way + @two_way_key = two_way_key + @on_delete = on_delete + @side = side + end + + def self.from(map:) + ColumnRelationship.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"], + related_table: map["relatedTable"], + relation_type: map["relationType"], + two_way: map["twoWay"], + two_way_key: map["twoWayKey"], + on_delete: map["onDelete"], + side: map["side"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "relatedTable": @related_table, + "relationType": @relation_type, + "twoWay": @two_way, + "twoWayKey": @two_way_key, + "onDelete": @on_delete, + "side": @side + } + end + end + end +end diff --git a/lib/appwrite/models/column_string.rb b/lib/appwrite/models/column_string.rb new file mode 100644 index 0000000..daa52c1 --- /dev/null +++ b/lib/appwrite/models/column_string.rb @@ -0,0 +1,77 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnString + 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 + attr_reader :default + attr_reader :encrypt + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + size:, + default: , + encrypt: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @size = size + @default = default + @encrypt = encrypt + end + + def self.from(map:) + ColumnString.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"], + default: map["default"], + encrypt: map["encrypt"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "size": @size, + "default": @default, + "encrypt": @encrypt + } + end + end + end +end diff --git a/lib/appwrite/models/column_url.rb b/lib/appwrite/models/column_url.rb new file mode 100644 index 0000000..6969853 --- /dev/null +++ b/lib/appwrite/models/column_url.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnUrl + 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 :format + attr_reader :default + + def initialize( + key:, + type:, + status:, + error:, + required:, + array: , + created_at:, + updated_at:, + format:, + default: + ) + @key = key + @type = type + @status = status + @error = error + @required = required + @array = array + @created_at = created_at + @updated_at = updated_at + @format = format + @default = default + end + + def self.from(map:) + ColumnUrl.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"], + format: map["format"], + default: map["default"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "required": @required, + "array": @array, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "format": @format, + "default": @default + } + end + end + end +end diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 14a1d4b..0e75728 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -8,19 +8,22 @@ class Database attr_reader :created_at attr_reader :updated_at attr_reader :enabled + attr_reader :type def initialize( id:, name:, created_at:, updated_at:, - enabled: + enabled:, + type: ) @id = id @name = name @created_at = created_at @updated_at = updated_at @enabled = enabled + @type = type end def self.from(map:) @@ -29,7 +32,8 @@ def self.from(map:) name: map["name"], created_at: map["$createdAt"], updated_at: map["$updatedAt"], - enabled: map["enabled"] + enabled: map["enabled"], + type: map["type"] ) end @@ -39,7 +43,8 @@ def to_map "name": @name, "$createdAt": @created_at, "$updatedAt": @updated_at, - "enabled": @enabled + "enabled": @enabled, + "type": @type } end end diff --git a/lib/appwrite/models/execution.rb b/lib/appwrite/models/execution.rb index 066ae71..3278544 100644 --- a/lib/appwrite/models/execution.rb +++ b/lib/appwrite/models/execution.rb @@ -8,6 +8,7 @@ class Execution attr_reader :updated_at attr_reader :permissions attr_reader :function_id + attr_reader :deployment_id attr_reader :trigger attr_reader :status attr_reader :request_method @@ -27,6 +28,7 @@ def initialize( updated_at:, permissions:, function_id:, + deployment_id:, trigger:, status:, request_method:, @@ -45,6 +47,7 @@ def initialize( @updated_at = updated_at @permissions = permissions @function_id = function_id + @deployment_id = deployment_id @trigger = trigger @status = status @request_method = request_method @@ -66,6 +69,7 @@ def self.from(map:) updated_at: map["$updatedAt"], permissions: map["$permissions"], function_id: map["functionId"], + deployment_id: map["deploymentId"], trigger: map["trigger"], status: map["status"], request_method: map["requestMethod"], @@ -88,6 +92,7 @@ def to_map "$updatedAt": @updated_at, "$permissions": @permissions, "functionId": @function_id, + "deploymentId": @deployment_id, "trigger": @trigger, "status": @status, "requestMethod": @request_method, diff --git a/lib/appwrite/models/index.rb b/lib/appwrite/models/index.rb index b7495ab..bea7d29 100644 --- a/lib/appwrite/models/index.rb +++ b/lib/appwrite/models/index.rb @@ -3,6 +3,9 @@ module Appwrite module Models class Index + attr_reader :id + attr_reader :created_at + attr_reader :updated_at attr_reader :key attr_reader :type attr_reader :status @@ -10,20 +13,22 @@ class Index attr_reader :attributes attr_reader :lengths attr_reader :orders - attr_reader :created_at - attr_reader :updated_at def initialize( + id:, + created_at:, + updated_at:, key:, type:, status:, error:, attributes:, lengths:, - orders: , - created_at:, - updated_at: + orders: ) + @id = id + @created_at = created_at + @updated_at = updated_at @key = key @type = type @status = status @@ -31,35 +36,35 @@ def initialize( @attributes = attributes @lengths = lengths @orders = orders - @created_at = created_at - @updated_at = updated_at end def self.from(map:) Index.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], key: map["key"], type: map["type"], status: map["status"], error: map["error"], attributes: map["attributes"], lengths: map["lengths"], - orders: map["orders"], - created_at: map["$createdAt"], - updated_at: map["$updatedAt"] + orders: map["orders"] ) end def to_map { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, "key": @key, "type": @type, "status": @status, "error": @error, "attributes": @attributes, "lengths": @lengths, - "orders": @orders, - "$createdAt": @created_at, - "$updatedAt": @updated_at + "orders": @orders } end end diff --git a/lib/appwrite/models/row.rb b/lib/appwrite/models/row.rb new file mode 100644 index 0000000..79c1315 --- /dev/null +++ b/lib/appwrite/models/row.rb @@ -0,0 +1,66 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Row + attr_reader :id + attr_reader :sequence + attr_reader :table_id + attr_reader :database_id + attr_reader :created_at + attr_reader :updated_at + attr_reader :permissions + attr_reader :data + + def initialize( + id:, + sequence:, + table_id:, + database_id:, + created_at:, + updated_at:, + permissions:, + data: + ) + @id = id + @sequence = sequence + @table_id = table_id + @database_id = database_id + @created_at = created_at + @updated_at = updated_at + @permissions = permissions + @data = data + end + + def self.from(map:) + Row.new( + id: map["$id"], + sequence: map["$sequence"], + table_id: map["$tableId"], + database_id: map["$databaseId"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + permissions: map["$permissions"], + data: map + ) + end + + def to_map + { + "$id": @id, + "$sequence": @sequence, + "$tableId": @table_id, + "$databaseId": @database_id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "$permissions": @permissions, + "data": @data + } + end + + def convert_to(from_json) + from_json.call(data) + end + end + end +end diff --git a/lib/appwrite/models/row_list.rb b/lib/appwrite/models/row_list.rb new file mode 100644 index 0000000..26e676b --- /dev/null +++ b/lib/appwrite/models/row_list.rb @@ -0,0 +1,36 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class RowList + attr_reader :total + attr_reader :rows + + def initialize( + total:, + rows: + ) + @total = total + @rows = rows + end + + def self.from(map:) + RowList.new( + total: map["total"], + rows: map["rows"].map { |it| Row.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "rows": @rows.map { |it| it.to_map } + } + end + + def convert_to(from_json) + rows.map { |it| it.convert_to(from_json) } + end + end + end +end diff --git a/lib/appwrite/models/table.rb b/lib/appwrite/models/table.rb new file mode 100644 index 0000000..89da503 --- /dev/null +++ b/lib/appwrite/models/table.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Table + 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 :row_security + attr_reader :columns + attr_reader :indexes + + def initialize( + id:, + created_at:, + updated_at:, + permissions:, + database_id:, + name:, + enabled:, + row_security:, + columns:, + indexes: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @permissions = permissions + @database_id = database_id + @name = name + @enabled = enabled + @row_security = row_security + @columns = columns + @indexes = indexes + end + + def self.from(map:) + Table.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"], + row_security: map["rowSecurity"], + columns: map["columns"], + indexes: map["indexes"].map { |it| ColumnIndex.from(map: it) } + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "$permissions": @permissions, + "databaseId": @database_id, + "name": @name, + "enabled": @enabled, + "rowSecurity": @row_security, + "columns": @columns, + "indexes": @indexes.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/table_list.rb b/lib/appwrite/models/table_list.rb new file mode 100644 index 0000000..9c8d0ac --- /dev/null +++ b/lib/appwrite/models/table_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class TableList + attr_reader :total + attr_reader :tables + + def initialize( + total:, + tables: + ) + @total = total + @tables = tables + end + + def self.from(map:) + TableList.new( + total: map["total"], + tables: map["tables"].map { |it| Table.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "tables": @tables.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index 2dfc525..ad3c7f3 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -108,6 +108,42 @@ def contains(attribute, value) return Query.new("contains", attribute, value).to_s end + def not_contains(attribute, value) + return Query.new("notContains", attribute, value).to_s + end + + def not_search(attribute, value) + return Query.new("notSearch", attribute, value).to_s + end + + def not_between(attribute, start, ending) + return Query.new("notBetween", attribute, [start, ending]).to_s + end + + def not_starts_with(attribute, value) + return Query.new("notStartsWith", attribute, value).to_s + end + + def not_ends_with(attribute, value) + return Query.new("notEndsWith", attribute, value).to_s + end + + def created_before(value) + return Query.new("createdBefore", nil, value).to_s + end + + def created_after(value) + return Query.new("createdAfter", nil, value).to_s + end + + def updated_before(value) + return Query.new("updatedBefore", nil, value).to_s + end + + def updated_after(value) + return Query.new("updatedAfter", nil, value).to_s + end + def or(queries) return Query.new("or", nil, queries.map { |query| JSON.parse(query) }).to_s end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 2446c08..6470297 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -29,7 +29,6 @@ def get() ) end - # Use this endpoint to allow a new user to register a new account in your # project. After the user registration completes successfully, you can use # the @@ -79,7 +78,6 @@ def create(user_id:, email:, password:, name: nil) ) end - # Update currently logged in user account email address. After changing user # address, the user confirmation status will get reset. A new confirmation # email is not sent automatically however you can use the send confirmation @@ -122,7 +120,6 @@ def update_email(email:, password:) ) end - # Get the list of identities for the currently logged in user. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry @@ -147,7 +144,6 @@ def list_identities(queries: nil) ) end - # Delete an identity by its unique ID. # # @param [String] identity_id Identity ID. @@ -176,7 +172,6 @@ def delete_identity(identity_id:) ) end - # Use this endpoint to create a JSON Web Token. You can use the resulting JWT # to authenticate on behalf of the current user when working with the # Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes @@ -204,7 +199,6 @@ def create_jwt() ) end - # Get the list of latest security activity logs for the currently logged in # user. Each log returns user IP address, location and date and time of log. # @@ -230,7 +224,6 @@ def list_logs(queries: nil) ) end - # Enable or disable MFA on an account. # # @param [] mfa Enable or disable MFA. @@ -260,7 +253,6 @@ def update_mfa(mfa:) ) end - # Add an authenticator app to be used as an MFA factor. Verify the # authenticator using the [verify # authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) @@ -293,7 +285,6 @@ def create_mfa_authenticator(type:) ) end - # Verify an authenticator app after adding it using the [add # authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) # method. @@ -331,7 +322,6 @@ def update_mfa_authenticator(type:, otp:) ) end - # Delete an authenticator for a user by ID. # # @param [AuthenticatorType] type Type of authenticator. @@ -360,7 +350,6 @@ def delete_mfa_authenticator(type:) ) end - # Begin the process of MFA verification after sign-in. Finish the flow with # [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) # method. @@ -392,7 +381,6 @@ def create_mfa_challenge(factor:) ) end - # Complete the MFA challenge by providing the one-time password. Finish the # process of MFA verification by providing the one-time password. To begin # the flow, use @@ -432,7 +420,6 @@ def update_mfa_challenge(challenge_id:, otp:) ) end - # List the factors available on the account to be used as a MFA challange. # # @@ -455,7 +442,6 @@ def list_mfa_factors() ) end - # Get recovery codes that can be used as backup for MFA flow. Before getting # codes, they must be generated using # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) @@ -481,7 +467,6 @@ def get_mfa_recovery_codes() ) end - # 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 @@ -509,7 +494,6 @@ def create_mfa_recovery_codes() ) end - # Regenerate recovery codes that can be used as backup for MFA flow. Before # regenerating codes, they must be first generated using # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) @@ -536,7 +520,6 @@ def update_mfa_recovery_codes() ) end - # Update currently logged in user account name. # # @param [String] name User name. Max length: 128 chars. @@ -566,7 +549,6 @@ def update_name(name:) ) end - # Update currently logged in user password. For validation, user is required # to pass in the new password, and the old password. For users created with # OAuth, Team Invites and Magic URL, oldPassword is optional. @@ -600,7 +582,6 @@ def update_password(password:, old_password: nil) ) end - # 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 @@ -640,7 +621,6 @@ def update_phone(phone:, password:) ) end - # Get the preferences as a key-value object for the currently logged in user. # # @@ -663,7 +643,6 @@ def get_prefs() ) end - # Update currently logged in user account preferences. The object you pass is # stored as is, and replaces any previous value. The maximum allowed prefs # size is 64kB and throws error if exceeded. @@ -695,7 +674,6 @@ def update_prefs(prefs:) ) end - # Sends the user an email with a temporary secret key for password reset. # When the user clicks the confirmation link he is redirected back to your # app password reset URL with the secret key and email address values @@ -738,7 +716,6 @@ def create_recovery(email:, url:) ) end - # Use this endpoint to complete the user account password reset. Both the # **userId** and **secret** arguments will be passed as query parameters to # the redirect URL you have provided when sending your request to the [POST @@ -789,7 +766,6 @@ def update_recovery(user_id:, secret:, password:) ) end - # Get the list of active sessions across different devices for the currently # logged in user. # @@ -813,7 +789,6 @@ def list_sessions() ) end - # Delete all sessions from the user account and remove any sessions cookies # from the end client. # @@ -837,7 +812,6 @@ def delete_sessions() ) end - # Use this endpoint to allow a new user to register an anonymous account in # your project. This route will also create a new session for the user. To # allow the new user to convert an anonymous account to a normal account, you @@ -867,7 +841,6 @@ def create_anonymous_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. # @@ -908,7 +881,9 @@ def create_email_password_session(email:, password:) ) end - + # + # @deprecated This API has been deprecated. + # # 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. @@ -946,7 +921,9 @@ def update_magic_url_session(user_id:, secret:) ) end - + # + # @deprecated This API has been deprecated. + # # 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. @@ -984,7 +961,6 @@ def update_phone_session(user_id:, secret:) ) 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. @@ -1022,7 +998,6 @@ def create_session(user_id:, secret:) ) 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. # @@ -1052,7 +1027,6 @@ def get_session(session_id:) ) end - # 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. @@ -1084,7 +1058,6 @@ def update_session(session_id:) ) 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 # the user on all devices, use [Delete @@ -1117,7 +1090,6 @@ def delete_session(session_id:) ) end - # Block the currently logged in user account. Behind the scene, the user # record is not deleted but permanently blocked from any access. To # completely delete a user, use the Users API instead. @@ -1143,10 +1115,12 @@ def update_status() ) end - # Sends the user an email 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 + # 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**. Then, the user will receive an + # 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 # is valid for 15 minutes. @@ -1154,8 +1128,9 @@ def update_status() # 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. + # @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. # @@ -1190,7 +1165,6 @@ def create_email_token(user_id:, email:, phrase: nil) ) end - # Sends the user an email with a secret key for creating a session. If the # provided user ID has not been registered, a new user will be created. When # the user clicks the link in the email, the user is redirected back to the @@ -1206,7 +1180,7 @@ def create_email_token(user_id:, email:, phrase: nil) # 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. + # @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. @@ -1243,7 +1217,6 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil) ) 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 @@ -1291,7 +1264,6 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) ) 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 @@ -1303,7 +1275,7 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil) # 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. + # @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] @@ -1336,7 +1308,6 @@ def create_phone_token(user_id:, phone:) ) end - # Use this endpoint to send a verification message to your user email address # to confirm they are the valid owners of that address. Both the **userId** # and **secret** arguments will be passed as query parameters to the URL you @@ -1380,7 +1351,6 @@ def create_verification(url:) ) end - # Use this endpoint to complete the user email verification process. Use both # the **userId** and **secret** parameters that were attached to your app URL # to verify the user email ownership. If confirmed this route will return a @@ -1419,7 +1389,6 @@ def update_verification(user_id:, secret:) ) 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 # using the @@ -1450,7 +1419,6 @@ def create_phone_verification() ) 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 # verify the user email ownership. If confirmed this route will return a 200 @@ -1489,6 +1457,5 @@ def update_phone_verification(user_id:, secret:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index 7f1bc67..04afade 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -49,7 +49,6 @@ def get_browser(code:, width: nil, height: nil, quality: nil) ) 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. @@ -91,7 +90,6 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil) ) end - # Use this endpoint to fetch the favorite icon (AKA favicon) of any remote # website URL. # @@ -122,7 +120,6 @@ def get_favicon(url:) ) 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 @@ -165,7 +162,6 @@ def get_flag(code:, width: nil, height: nil, quality: nil) ) 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 @@ -207,7 +203,6 @@ def get_image(url:, width: nil, height: nil) ) 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' @@ -252,7 +247,6 @@ def get_initials(name: nil, width: nil, height: nil, background: nil) ) 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. # @@ -288,6 +282,5 @@ def get_qr(text:, size: nil, margin: nil, download: nil) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 9e78f69..69de399 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -7,6 +7,9 @@ def initialize(client) @client = client end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. + # # Get a list of all databases from the current Appwrite project. You can use # the search parameter to filter your results. # @@ -34,7 +37,9 @@ def list(queries: nil, search: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatabase` instead. + # # Create a new Database. # # @@ -73,7 +78,9 @@ def create(database_id:, name:, enabled: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. + # # Get a database by its unique ID. This endpoint response returns a JSON # object with the database metadata. # @@ -103,7 +110,9 @@ def get(database_id:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. + # # Update a database by its unique ID. # # @param [String] database_id Database ID. @@ -141,7 +150,9 @@ def update(database_id:, name:, enabled: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. + # # Delete a database by its unique ID. Only API keys with with databases.write # scope can delete a database. # @@ -171,7 +182,9 @@ def delete(database_id:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. + # # Get a list of all collections that belong to the provided databaseId. You # can use the search parameter to filter your results. # @@ -205,7 +218,9 @@ def list_collections(database_id:, queries: nil, search: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. + # # 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#databasesCreateCollection) @@ -256,7 +271,9 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. + # # Get a collection by its unique ID. This endpoint response returns a JSON # object with the collection metadata. # @@ -292,7 +309,9 @@ def get_collection(database_id:, collection_id:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. + # # Update a collection by its unique ID. # # @param [String] database_id Database ID. @@ -340,7 +359,9 @@ def update_collection(database_id:, collection_id:, name:, permissions: nil, doc ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. + # # Delete a collection by its unique ID. Only users with write permissions # have access to delete this resource. # @@ -376,11 +397,13 @@ def delete_collection(database_id:, collection_id:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. + # # List attributes 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 [String] collection_id Collection 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: key, type, size, required, array, status, error # # @return [AttributeList] @@ -413,12 +436,14 @@ def list_attributes(database_id:, collection_id:, queries: nil) ) 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). + # @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). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -466,12 +491,14 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. + # # Update a boolean 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). + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -523,11 +550,13 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. + # # Create a date time attribute according to the ISO 8601 standard. # # @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] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. @@ -575,12 +604,14 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. + # # Update a date time 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). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -632,12 +663,14 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def ) 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -685,17 +718,19 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [String] new_key New attribute key. + # @param [String] new_key New Attribute Key. # # @return [AttributeEmail] def update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) @@ -743,15 +778,17 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul ) end - - # Create an enumeration attribute. The `elements` param acts as a white-list - # of accepted values for this attribute. + # + # @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. # # # @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] collection_id Collection ID. # @param [String] key Attribute Key. - # @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + # @param [Array] elements Array of enum values. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. # @param [] array Is attribute an array? @@ -803,18 +840,20 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. - # @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + # @param [Array] elements Updated list of enum values. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [String] new_key New attribute key. + # @param [String] new_key New Attribute Key. # # @return [AttributeEnum] def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) @@ -867,18 +906,20 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. + # # Create a float attribute. Optionally, minimum and maximum values can be # provided. # # # @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] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Float] min Minimum value to enforce on new documents - # @param [Float] max Maximum value to enforce on new documents - # @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required. + # @param [Float] min Minimum value. + # @param [Float] max Maximum value. + # @param [Float] default Default value. Cannot be set when required. # @param [] array Is attribute an array? # # @return [AttributeFloat] @@ -925,19 +966,21 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [Float] min Minimum value to enforce on new documents - # @param [Float] max Maximum value to enforce on new documents - # @param [String] new_key New attribute key. + # @param [Float] default Default value. Cannot be set when required. + # @param [Float] min Minimum value. + # @param [Float] max Maximum value. + # @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) @@ -987,18 +1030,20 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. + # # Create an integer attribute. Optionally, minimum and maximum values can be # provided. # # # @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] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Integer] min Minimum value to enforce on new documents - # @param [Integer] max Maximum value to enforce on new documents - # @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required. + # @param [Integer] min Minimum value + # @param [Integer] max Maximum value + # @param [Integer] default Default value. Cannot be set when attribute is required. # @param [] array Is attribute an array? # # @return [AttributeInteger] @@ -1045,19 +1090,21 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [Integer] min Minimum value to enforce on new documents - # @param [Integer] max Maximum value to enforce on new documents - # @param [String] new_key New attribute key. + # @param [Integer] default Default value. Cannot be set when attribute is required. + # @param [Integer] min Minimum value + # @param [Integer] max Maximum value + # @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) @@ -1107,15 +1154,17 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa ) 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. + # @param [String] default Default value. Cannot be set when attribute is required. # @param [] array Is attribute an array? # # @return [AttributeIp] @@ -1160,17 +1209,19 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [String] new_key New attribute key. + # @param [String] default Default value. Cannot be set when attribute is required. + # @param [String] new_key New Attribute Key. # # @return [AttributeIp] def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) @@ -1218,14 +1269,16 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - # @param [String] related_collection_id Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. + # @param [String] related_collection_id Related Collection ID. # @param [RelationshipType] type Relation type # @param [] two_way Is Two Way? # @param [String] key Attribute Key. @@ -1276,12 +1329,14 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti ) 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 collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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). # @param [String] key Attribute Key. # @param [Integer] size Attribute size for text attributes, in number of characters. # @param [] required Is attribute required? @@ -1337,18 +1392,20 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. + # # 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 collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @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). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. # @param [Integer] size Maximum size of the string attribute. - # @param [String] new_key New attribute key. + # @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) @@ -1397,12 +1454,14 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. + # # Create a URL 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). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -1450,17 +1509,19 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. - # @param [String] new_key New attribute key. + # @param [String] new_key New Attribute Key. # # @return [AttributeUrl] def update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) @@ -1508,11 +1569,13 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. + # # Get attribute 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] collection_id Collection ID. # @param [String] key Attribute Key. # # @return [] @@ -1548,11 +1611,13 @@ def get_attribute(database_id:, collection_id:, key:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. + # # Deletes an 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). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # # @return [] @@ -1589,16 +1654,18 @@ def delete_attribute(database_id:, collection_id:, key:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + # # 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. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. # @param [String] key Attribute Key. # @param [RelationMutate] on_delete Constraints option - # @param [String] new_key New attribute key. + # @param [String] new_key New Attribute Key. # # @return [AttributeRelationship] def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) @@ -1637,7 +1704,9 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: ) 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 # the query params to filter your results. # @@ -1675,7 +1744,9 @@ def list_documents(database_id:, collection_id:, queries: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. + # # 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#databasesCreateCollection) @@ -1728,11 +1799,9 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio ) end - - # **WARNING: Experimental Feature** - This endpoint is experimental and not - # yet officially supported. It may be subject to breaking changes or removal - # in future versions. - # + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. + # # 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#databasesCreateCollection) @@ -1777,11 +1846,9 @@ def create_documents(database_id:, collection_id:, documents:) ) end - - # **WARNING: Experimental Feature** - This endpoint is experimental and not - # yet officially supported. It may be subject to breaking changes or removal - # in future versions. - # + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. + # # 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#databasesCreateCollection) @@ -1827,11 +1894,9 @@ def upsert_documents(database_id:, collection_id:, documents:) ) end - - # **WARNING: Experimental Feature** - This endpoint is experimental and not - # yet officially supported. It may be subject to breaking changes or removal - # in future versions. - # + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. + # # 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. @@ -1873,11 +1938,9 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil) ) end - - # **WARNING: Experimental Feature** - This endpoint is experimental and not - # yet officially supported. It may be subject to breaking changes or removal - # in future versions. - # + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. + # # Bulk delete documents using queries, if no queries are passed then all # documents are deleted. # @@ -1916,7 +1979,9 @@ def delete_documents(database_id:, collection_id:, queries: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. + # # Get a document by its unique ID. This endpoint response returns a JSON # object with the document data. # @@ -1960,11 +2025,9 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) ) end - - # **WARNING: Experimental Feature** - This endpoint is experimental and not - # yet officially supported. It may be subject to breaking changes or removal - # in future versions. - # + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. + # # 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#databasesCreateCollection) @@ -2017,7 +2080,9 @@ def upsert_document(database_id:, collection_id:, document_id:, data:, permissio ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. + # # Update a document by its unique ID. Using the patch method you can pass # only specific fields that will get updated. # @@ -2064,7 +2129,9 @@ def update_document(database_id:, collection_id:, document_id:, data: nil, permi ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. + # # Delete a document by its unique ID. # # @param [String] database_id Database ID. @@ -2105,14 +2172,16 @@ def delete_document(database_id:, collection_id:, document_id:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. + # # Decrement a specific attribute of a document 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] value Value to increment 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. # # @return [Document] @@ -2157,7 +2226,9 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. + # # Increment a specific attribute of a document by a given value. # # @param [String] database_id Database ID. @@ -2209,7 +2280,9 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. + # # List indexes in the collection. # # @param [String] database_id Database ID. @@ -2246,7 +2319,9 @@ def list_indexes(database_id:, collection_id:, queries: nil) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. + # # 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`. @@ -2306,7 +2381,9 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. + # # Get index by ID. # # @param [String] database_id Database ID. @@ -2347,7 +2424,9 @@ def get_index(database_id:, collection_id:, key:) ) end - + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. + # # Delete an index. # # @param [String] database_id Database ID. @@ -2388,6 +2467,5 @@ def delete_index(database_id:, collection_id:, key:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index 91c90e3..5f04c88 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -34,7 +34,6 @@ def list(queries: nil, search: nil) ) end - # Create a new function. You can pass a list of # [permissions](https://appwrite.io/docs/permissions) to allow different # project users or team with access to execute the function using the client @@ -109,7 +108,6 @@ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: n ) end - # Get a list of all runtimes that are currently active on your instance. # # @@ -132,7 +130,6 @@ def list_runtimes() ) end - # List allowed function specifications for this instance. # # @@ -155,7 +152,6 @@ def list_specifications() ) end - # Get a function by its unique ID. # # @param [String] function_id Function ID. @@ -184,7 +180,6 @@ def get(function_id:) ) end - # Update function by its unique ID. # # @param [String] function_id Function ID. @@ -252,7 +247,6 @@ def update(function_id:, name:, runtime: nil, execute: nil, events: nil, schedul ) end - # Delete a function by its unique ID. # # @param [String] function_id Function ID. @@ -281,7 +275,6 @@ def delete(function_id:) ) end - # Update the function active deployment. Use this endpoint to switch the code # deployment that should be used when visitor opens your function. # @@ -318,7 +311,6 @@ def update_function_deployment(function_id:, deployment_id:) ) end - # Get a list of all the function's code deployments. You can use the query # params to filter your results. # @@ -352,7 +344,6 @@ def list_deployments(function_id:, queries: nil, search: nil) ) 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. @@ -412,7 +403,6 @@ def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: ) 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 @@ -454,7 +444,6 @@ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil) ) end - # Create a deployment based on a template. # # Use this endpoint with combination of @@ -514,7 +503,6 @@ def create_template_deployment(function_id:, repository:, owner:, root_directory ) end - # Create a deployment when a function is connected to VCS. # # This endpoint lets you create deployment from a branch, commit, or a tag. @@ -560,7 +548,6 @@ def create_vcs_deployment(function_id:, type:, reference:, activate: nil) ) end - # Get a function deployment by its unique ID. # # @param [String] function_id Function ID. @@ -595,7 +582,6 @@ def get_deployment(function_id:, deployment_id:) ) end - # Delete a code deployment by its unique ID. # # @param [String] function_id Function ID. @@ -630,7 +616,6 @@ def delete_deployment(function_id:, deployment_id:) ) end - # Get a function deployment content by its unique ID. The endpoint response # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. @@ -668,7 +653,6 @@ def get_deployment_download(function_id:, deployment_id:, type: nil) ) 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 # started yet, it will be marked as canceled without executing. You cannot @@ -708,7 +692,6 @@ def update_deployment_status(function_id:, deployment_id:) ) end - # Get a list of all the current user function execution logs. You can use the # query params to filter your results. # @@ -740,7 +723,6 @@ def list_executions(function_id:, queries: nil) ) end - # Trigger a function execution. The returned object will return you the # current execution status. You can ping the `Get Execution` endpoint to get # updates on the current execution status. Once this endpoint is called, your @@ -785,7 +767,6 @@ def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: ni ) end - # Get a function execution log by its unique ID. # # @param [String] function_id Function ID. @@ -820,7 +801,6 @@ def get_execution(function_id:, execution_id:) ) end - # Delete a function execution by its unique ID. # # @param [String] function_id Function ID. @@ -855,7 +835,6 @@ def delete_execution(function_id:, execution_id:) ) end - # Get a list of all variables of a specific function. # # @param [String] function_id Function unique ID. @@ -884,7 +863,6 @@ def list_variables(function_id:) ) end - # Create a new function environment variable. These variables can be accessed # in the function at runtime as environment variables. # @@ -929,7 +907,6 @@ def create_variable(function_id:, key:, value:, secret: nil) ) end - # Get a variable by its unique ID. # # @param [String] function_id Function unique ID. @@ -964,7 +941,6 @@ def get_variable(function_id:, variable_id:) ) end - # Update variable by its unique ID. # # @param [String] function_id Function unique ID. @@ -1010,7 +986,6 @@ def update_variable(function_id:, variable_id:, key:, value: nil, secret: nil) ) end - # Delete a variable by its unique ID. # # @param [String] function_id Function unique ID. @@ -1045,6 +1020,5 @@ def delete_variable(function_id:, variable_id:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/graphql.rb b/lib/appwrite/services/graphql.rb index b9db9a0..0c32737 100644 --- a/lib/appwrite/services/graphql.rb +++ b/lib/appwrite/services/graphql.rb @@ -36,7 +36,6 @@ def query(query:) ) end - # Execute a GraphQL mutation. # # @param [Hash] query The query or queries to execute. @@ -66,6 +65,5 @@ def mutation(query:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/health.rb b/lib/appwrite/services/health.rb index b92717d..1375b8b 100644 --- a/lib/appwrite/services/health.rb +++ b/lib/appwrite/services/health.rb @@ -29,7 +29,6 @@ def get() ) end - # Check the Appwrite Antivirus server is up and connection is successful. # # @@ -52,7 +51,6 @@ def get_antivirus() ) end - # Check the Appwrite in-memory cache servers are up and connection is # successful. # @@ -76,7 +74,6 @@ def get_cache() ) end - # Get the SSL certificate for a domain # # @param [String] domain string @@ -101,7 +98,6 @@ def get_certificate(domain: nil) ) end - # Check the Appwrite database servers are up and connection is successful. # # @@ -124,7 +120,6 @@ def get_db() ) end - # Check the Appwrite pub-sub servers are up and connection is successful. # # @@ -147,7 +142,6 @@ def get_pub_sub() ) end - # Get the number of builds that are waiting to be processed in the Appwrite # internal queue server. # @@ -173,7 +167,6 @@ def get_queue_builds(threshold: nil) ) end - # Get the number of certificates that are waiting to be issued against # [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue # server. @@ -200,7 +193,6 @@ def get_queue_certificates(threshold: nil) ) end - # Get the number of database changes that are waiting to be processed in the # Appwrite internal queue server. # @@ -228,7 +220,6 @@ def get_queue_databases(name: nil, threshold: nil) ) end - # Get the number of background destructive changes that are waiting to be # processed in the Appwrite internal queue server. # @@ -254,7 +245,6 @@ def get_queue_deletes(threshold: nil) ) end - # Returns the amount of failed jobs in a given queue. # # @@ -286,7 +276,6 @@ def get_failed_jobs(name:, threshold: nil) ) end - # Get the number of function executions that are waiting to be processed in # the Appwrite internal queue server. # @@ -312,7 +301,6 @@ def get_queue_functions(threshold: nil) ) end - # Get the number of logs that are waiting to be processed in the Appwrite # internal queue server. # @@ -338,7 +326,6 @@ def get_queue_logs(threshold: nil) ) end - # Get the number of mails that are waiting to be processed in the Appwrite # internal queue server. # @@ -364,7 +351,6 @@ def get_queue_mails(threshold: nil) ) end - # Get the number of messages that are waiting to be processed in the Appwrite # internal queue server. # @@ -390,7 +376,6 @@ def get_queue_messaging(threshold: nil) ) end - # Get the number of migrations that are waiting to be processed in the # Appwrite internal queue server. # @@ -416,7 +401,6 @@ def get_queue_migrations(threshold: nil) ) end - # Get the number of metrics that are waiting to be processed in the Appwrite # stats resources queue. # @@ -442,7 +426,6 @@ def get_queue_stats_resources(threshold: nil) ) end - # Get the number of metrics that are waiting to be processed in the Appwrite # internal queue server. # @@ -468,7 +451,6 @@ def get_queue_usage(threshold: nil) ) end - # Get the number of webhooks that are waiting to be processed in the Appwrite # internal queue server. # @@ -494,7 +476,6 @@ def get_queue_webhooks(threshold: nil) ) end - # Check the Appwrite storage device is up and connection is successful. # # @@ -517,7 +498,6 @@ def get_storage() ) end - # Check the Appwrite local storage device is up and connection is successful. # # @@ -540,7 +520,6 @@ def get_storage_local() ) end - # Check the Appwrite server time is synced with Google remote NTP server. We # use this technology to smoothly handle leap seconds with no disruptive # events. The [Network Time @@ -569,6 +548,5 @@ def get_time() ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/locale.rb b/lib/appwrite/services/locale.rb index 8cb443e..00296f4 100644 --- a/lib/appwrite/services/locale.rb +++ b/lib/appwrite/services/locale.rb @@ -34,7 +34,6 @@ def get() ) end - # List of all locale codes in [ISO # 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). # @@ -58,7 +57,6 @@ def list_codes() ) end - # List of all continents. You can use the locale header to get the data in a # supported language. # @@ -82,7 +80,6 @@ def list_continents() ) end - # List of all countries. You can use the locale header to get the data in a # supported language. # @@ -106,7 +103,6 @@ def list_countries() ) end - # List of all countries that are currently members of the EU. You can use the # locale header to get the data in a supported language. # @@ -130,7 +126,6 @@ def list_countries_eu() ) end - # List of all countries phone codes. You can use the locale header to get the # data in a supported language. # @@ -154,7 +149,6 @@ def list_countries_phones() ) end - # List of all currencies, including currency symbol, name, plural, and # decimal digits for all major and minor currencies. You can use the locale # header to get the data in a supported language. @@ -179,7 +173,6 @@ def list_currencies() ) end - # List of all languages classified by ISO 639-1 including 2-letter code, name # in English, and name in the respective language. # @@ -203,6 +196,5 @@ def list_languages() ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/messaging.rb b/lib/appwrite/services/messaging.rb index 8a760de..a24020b 100644 --- a/lib/appwrite/services/messaging.rb +++ b/lib/appwrite/services/messaging.rb @@ -33,7 +33,6 @@ def list_messages(queries: nil, search: nil) ) 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. @@ -93,7 +92,6 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe ) 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. @@ -148,7 +146,6 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni ) 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. @@ -214,7 +211,6 @@ def create_push(message_id:, title: nil, body: nil, topics: nil, users: nil, tar ) 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. @@ -283,7 +279,6 @@ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, ) 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. @@ -329,7 +324,6 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra ) 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. @@ -374,7 +368,6 @@ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, ) end - # Get a message by its unique ID. # # @@ -404,7 +397,6 @@ def get_message(message_id:) ) end - # Delete a message. If the message is not a draft or scheduled, but has been # sent, this will not recall the message. # @@ -434,7 +426,6 @@ def delete(message_id:) ) end - # Get the message activity logs listed by its unique ID. # # @param [String] message_id Message ID. @@ -465,7 +456,6 @@ def list_message_logs(message_id:, queries: nil) ) end - # Get a list of the targets associated with a message. # # @param [String] message_id Message ID. @@ -496,7 +486,6 @@ def list_targets(message_id:, queries: nil) ) end - # Get a list of all providers from the current Appwrite project. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled @@ -523,7 +512,6 @@ def list_providers(queries: nil, search: nil) ) 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. @@ -571,7 +559,6 @@ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, t ) end - # Update a Apple Push Notification service provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -615,7 +602,6 @@ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, a ) 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. @@ -655,7 +641,6 @@ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: ) end - # Update a Firebase Cloud Messaging provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -691,7 +676,6 @@ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_j ) 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. @@ -743,7 +727,6 @@ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_e ) end - # Update a Mailgun provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -791,7 +774,6 @@ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, ) 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. @@ -835,7 +817,6 @@ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, ) end - # Update a MSG91 provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -875,7 +856,6 @@ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: ni ) 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. @@ -923,7 +903,6 @@ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, ) end - # Update a Sendgrid provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -967,7 +946,6 @@ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil ) 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. @@ -1031,7 +1009,6 @@ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, p ) end - # Update a SMTP provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1087,7 +1064,6 @@ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username ) 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. @@ -1131,7 +1107,6 @@ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, a ) end - # Update a Telesign provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1171,7 +1146,6 @@ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: ) 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. @@ -1215,7 +1189,6 @@ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api ) end - # Update a Textmagic provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1255,7 +1228,6 @@ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: n ) 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. @@ -1299,7 +1271,6 @@ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, aut ) end - # Update a Twilio provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1339,7 +1310,6 @@ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: n ) 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. @@ -1383,7 +1353,6 @@ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_sec ) end - # Update a Vonage provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1423,7 +1392,6 @@ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, ) end - # Get a provider by its unique ID. # # @@ -1453,7 +1421,6 @@ def get_provider(provider_id:) ) end - # Delete a provider by its unique ID. # # @param [String] provider_id Provider ID. @@ -1482,7 +1449,6 @@ def delete_provider(provider_id:) ) end - # Get the provider activity logs listed by its unique ID. # # @param [String] provider_id Provider ID. @@ -1513,7 +1479,6 @@ def list_provider_logs(provider_id:, queries: nil) ) end - # Get the subscriber activity logs listed by its unique ID. # # @param [String] subscriber_id Subscriber ID. @@ -1544,7 +1509,6 @@ def list_subscriber_logs(subscriber_id:, queries: nil) ) end - # Get a list of all topics from the current Appwrite project. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal @@ -1571,7 +1535,6 @@ def list_topics(queries: nil, search: nil) ) end - # Create a new topic. # # @param [String] topic_id Topic ID. Choose a custom Topic ID or a new Topic ID. @@ -1609,7 +1572,6 @@ def create_topic(topic_id:, name:, subscribe: nil) ) end - # Get a topic by its unique ID. # # @@ -1639,7 +1601,6 @@ def get_topic(topic_id:) ) end - # Update a topic by its unique ID. # # @@ -1674,7 +1635,6 @@ def update_topic(topic_id:, name: nil, subscribe: nil) ) end - # Delete a topic by its unique ID. # # @param [String] topic_id Topic ID. @@ -1703,7 +1663,6 @@ def delete_topic(topic_id:) ) end - # Get the topic activity logs listed by its unique ID. # # @param [String] topic_id Topic ID. @@ -1734,7 +1693,6 @@ def list_topic_logs(topic_id:, queries: nil) ) end - # Get a list of all subscribers from the current Appwrite project. # # @param [String] topic_id Topic ID. The topic ID subscribed to. @@ -1767,7 +1725,6 @@ def list_subscribers(topic_id:, queries: nil, search: nil) ) end - # Create a new subscriber. # # @param [String] topic_id Topic ID. The topic ID to subscribe to. @@ -1809,7 +1766,6 @@ def create_subscriber(topic_id:, subscriber_id:, target_id:) ) end - # Get a subscriber by its unique ID. # # @@ -1845,7 +1801,6 @@ def get_subscriber(topic_id:, subscriber_id:) ) end - # Delete a subscriber by its unique ID. # # @param [String] topic_id Topic ID. The topic ID subscribed to. @@ -1880,6 +1835,5 @@ def delete_subscriber(topic_id:, subscriber_id:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/sites.rb b/lib/appwrite/services/sites.rb index 1c50389..138dae7 100644 --- a/lib/appwrite/services/sites.rb +++ b/lib/appwrite/services/sites.rb @@ -34,7 +34,6 @@ def list(queries: nil, search: nil) ) 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. @@ -110,7 +109,6 @@ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: n ) end - # Get a list of all frameworks that are currently available on the server # instance. # @@ -134,7 +132,6 @@ def list_frameworks() ) end - # List allowed site specifications for this instance. # # @@ -157,7 +154,6 @@ def list_specifications() ) end - # Get a site by its unique ID. # # @param [String] site_id Site ID. @@ -186,7 +182,6 @@ def get(site_id:) ) end - # Update site by its unique ID. # # @param [String] site_id Site ID. @@ -258,7 +253,6 @@ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil ) end - # Delete a site by its unique ID. # # @param [String] site_id Site ID. @@ -287,7 +281,6 @@ def delete(site_id:) ) end - # Update the site active deployment. Use this endpoint to switch the code # deployment that should be used when visitor opens your site. # @@ -324,7 +317,6 @@ def update_site_deployment(site_id:, deployment_id:) ) end - # Get a list of all the site's code deployments. You can use the query params # to filter your results. # @@ -358,7 +350,6 @@ def list_deployments(site_id:, queries: nil, search: nil) ) 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 function's deployment to use your new deployment ID. @@ -413,7 +404,6 @@ def create_deployment(site_id:, code:, activate:, install_command: nil, build_co ) 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 @@ -453,7 +443,6 @@ def create_duplicate_deployment(site_id:, deployment_id:) ) end - # Create a deployment based on a template. # # Use this endpoint with combination of @@ -513,7 +502,6 @@ def create_template_deployment(site_id:, repository:, owner:, root_directory:, v ) end - # Create a deployment when a site is connected to VCS. # # This endpoint lets you create deployment from a branch, commit, or a tag. @@ -559,7 +547,6 @@ def create_vcs_deployment(site_id:, type:, reference:, activate: nil) ) end - # Get a site deployment by its unique ID. # # @param [String] site_id Site ID. @@ -594,7 +581,6 @@ def get_deployment(site_id:, deployment_id:) ) end - # Delete a site deployment by its unique ID. # # @param [String] site_id Site ID. @@ -629,7 +615,6 @@ def delete_deployment(site_id:, deployment_id:) ) end - # Get a site deployment content by its unique ID. The endpoint response # return with a 'Content-Disposition: attachment' header that tells the # browser to start downloading the file to user downloads directory. @@ -667,7 +652,6 @@ def get_deployment_download(site_id:, deployment_id:, type: nil) ) 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 # started yet, it will be marked as canceled without executing. You cannot @@ -707,7 +691,6 @@ def update_deployment_status(site_id:, deployment_id:) ) end - # Get a list of all site logs. You can use the query params to filter your # results. # @@ -739,7 +722,6 @@ def list_logs(site_id:, queries: nil) ) end - # Get a site request log by its unique ID. # # @param [String] site_id Site ID. @@ -774,7 +756,6 @@ def get_log(site_id:, log_id:) ) end - # Delete a site log by its unique ID. # # @param [String] site_id Site ID. @@ -809,7 +790,6 @@ def delete_log(site_id:, log_id:) ) end - # Get a list of all variables of a specific site. # # @param [String] site_id Site unique ID. @@ -838,7 +818,6 @@ def list_variables(site_id:) ) end - # Create a new site variable. These variables can be accessed during build # and runtime (server-side rendering) as environment variables. # @@ -883,7 +862,6 @@ def create_variable(site_id:, key:, value:, secret: nil) ) end - # Get a variable by its unique ID. # # @param [String] site_id Site unique ID. @@ -918,7 +896,6 @@ def get_variable(site_id:, variable_id:) ) end - # Update variable by its unique ID. # # @param [String] site_id Site unique ID. @@ -964,7 +941,6 @@ def update_variable(site_id:, variable_id:, key:, value: nil, secret: nil) ) end - # Delete a variable by its unique ID. # # @param [String] site_id Site unique ID. @@ -999,6 +975,5 @@ def delete_variable(site_id:, variable_id:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index 84a9041..1d020e7 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -34,7 +34,6 @@ def list_buckets(queries: nil, search: nil) ) 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. @@ -86,7 +85,6 @@ def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl ) end - # Get a storage bucket by its unique ID. This endpoint response returns a # JSON object with the storage bucket metadata. # @@ -116,7 +114,6 @@ def get_bucket(bucket_id:) ) end - # Update a storage bucket by its unique ID. # # @param [String] bucket_id Bucket unique ID. @@ -168,7 +165,6 @@ def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabl ) end - # Delete a storage bucket by its unique ID. # # @param [String] bucket_id Bucket unique ID. @@ -197,7 +193,6 @@ def delete_bucket(bucket_id:) ) end - # Get a list of all the user files. You can use the query params to filter # your results. # @@ -231,7 +226,6 @@ def list_files(bucket_id:, queries: nil, search: nil) ) 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) @@ -297,7 +291,6 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) ) end - # Get a file by its unique ID. This endpoint response returns a JSON object # with the file metadata. # @@ -333,7 +326,6 @@ def get_file(bucket_id:, file_id:) ) end - # Update a file by its unique ID. Only users with write permissions have # access to update this resource. # @@ -374,7 +366,6 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) ) end - # Delete a file by its unique ID. Only users with write permissions have # access to delete this resource. # @@ -410,7 +401,6 @@ def delete_file(bucket_id:, file_id:) ) 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 # downloading the file to user downloads directory. @@ -448,7 +438,6 @@ def get_file_download(bucket_id:, file_id:, token: nil) ) end - # Get a file preview image. Currently, this method supports preview for image # files (jpg, png, and gif), other supported formats, like pdf, docs, slides, # and spreadsheets, will return the file icon image. You can also pass query @@ -510,7 +499,6 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil ) end - # Get a file content by its unique ID. This endpoint is similar to the # download method but returns with no 'Content-Disposition: attachment' # header. @@ -548,6 +536,5 @@ def get_file_view(bucket_id:, file_id:, token: nil) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb new file mode 100644 index 0000000..5544fba --- /dev/null +++ b/lib/appwrite/services/tables_db.rb @@ -0,0 +1,2318 @@ +#frozen_string_literal: true + +module Appwrite + class TablesDB < 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 [String] search Search term to filter your list results. Max length: 256 chars. + # + # @return [DatabaseList] + def list(queries: nil, search: nil) + api_path = '/tablesdb' + + api_params = { + queries: queries, + search: search, + } + + api_headers = { + } + + @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. + # + # @return [Database] + def create(database_id:, name:, enabled: nil) + api_path = '/tablesdb' + + 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, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Database + ) + 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 = '/tablesdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + } + + api_headers = { + } + + @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. + # + # @return [Database] + def update(database_id:, name:, enabled: nil) + api_path = '/tablesdb/{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, + } + + api_headers = { + "content-type": '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 = '/tablesdb/{databaseId}' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Get a list of all tables 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 columns: name, enabled, rowSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # + # @return [TableList] + def list_tables(database_id:, queries: nil, search: nil) + api_path = '/tablesdb/{databaseId}/tables' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + api_params = { + queries: queries, + search: search, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::TableList + ) + end + + # Create a new Table. Before using this route, you should create a new + # database resource using either a [server + # integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) + # 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] 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. + # + # @return [Table] + def create_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) + api_path = '/tablesdb/{databaseId}/tables' + .gsub('{databaseId}', database_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + tableId: table_id, + name: name, + permissions: permissions, + rowSecurity: row_security, + enabled: enabled, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Table + ) + end + + # Get a table by its unique ID. This endpoint response returns a JSON object + # with the table metadata. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # + # @return [Table] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Table + ) + end + + # Update a table by its unique ID. + # + # @param [String] database_id Database ID. + # @param [String] table_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 document. [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. + # + # @return [Table] + def update_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if name.nil? + raise Appwrite::Exception.new('Missing required parameter: "name"') + end + + api_params = { + name: name, + permissions: permissions, + rowSecurity: row_security, + enabled: enabled, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Table + ) + end + + # Delete a table by its unique ID. Only users with write permissions have + # access to delete this resource. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # + # @return [] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # List columns in the table. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table 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 columns: key, type, size, required, array, status, error + # + # @return [ColumnList] + def list_columns(database_id:, table_id:, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnList + ) + 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/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [] default Default value for column when not provided. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnBoolean] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnBoolean + ) + end + + # Update a boolean 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/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [] default Default value for column when not provided. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnBoolean] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnBoolean + ) + end + + # Create a date time column according to the ISO 8601 standard. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnDatetime] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnDatetime + ) + end + + # Update a date time column. Changing the `default` value will not update + # already existing rows. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnDatetime] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnDatetime + ) + end + + # Create an email column. + # + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnEmail] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnEmail] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnEmail + ) + end + + # Create an enumeration column. The `elements` param acts as a white-list of + # accepted values for this column. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [Array] elements Array of enum values. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnEnum] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if elements.nil? + raise Appwrite::Exception.new('Missing required parameter: "elements"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + elements: elements, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [Array] elements Updated list of enum values. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnEnum] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if elements.nil? + raise Appwrite::Exception.new('Missing required parameter: "elements"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + elements: elements, + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [Float] min Minimum value + # @param [Float] max Maximum value + # @param [Float] default Default value. Cannot be set when required. + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + min: min, + max: max, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [Float] default Default value. Cannot be set when required. + # @param [Float] min Minimum value + # @param [Float] max Maximum value + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + min: min, + max: max, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [Integer] min Minimum value + # @param [Integer] max Maximum value + # @param [Integer] default Default value. Cannot be set when column is required. + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + min: min, + max: max, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [Integer] default Default value. Cannot be set when column is required. + # @param [Integer] min Minimum value + # @param [Integer] max Maximum value + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + min: min, + max: max, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnInteger + ) + end + + # Create IP address column. + # + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnIp] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnIp] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnIp + ) + 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. + # @param [String] related_table_id Related Table ID. + # @param [RelationshipType] type Relation type + # @param [] two_way Is Two Way? + # @param [String] key Column Key. + # @param [String] two_way_key Two Way Column Key. + # @param [RelationMutate] on_delete Constraints option + # + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if related_table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "relatedTableId"') + end + + if type.nil? + raise Appwrite::Exception.new('Missing required parameter: "type"') + end + + api_params = { + relatedTableId: related_table_id, + type: type, + twoWay: two_way, + key: key, + twoWayKey: two_way_key, + onDelete: on_delete, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnRelationship + ) + end + + # 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/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [Integer] size Column size for text columns, in number of characters. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [] array Is column an array? + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if size.nil? + raise Appwrite::Exception.new('Missing required parameter: "size"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + size: size, + required: required, + default: default, + array: array, + encrypt: encrypt, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnString + ) + end + + # 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/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [Integer] size Maximum size of the string column. + # @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) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + size: size, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnString + ) + end + + # Create a URL column. + # + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [] array Is column an array? + # + # @return [ColumnUrl] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + array: array, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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. + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnUrl] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + if default.nil? + raise Appwrite::Exception.new('Missing required parameter: "default"') + end + + api_params = { + required: required, + default: default, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnUrl + ) + end + + # Get column by ID. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # + # @return [] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + ) + end + + # Deletes a column. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] key Column Key. + # + # @return [] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = { + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + 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. + # @param [String] key Column Key. + # @param [RelationMutate] on_delete Constraints option + # @param [String] new_key New Column Key. + # + # @return [ColumnRelationship] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = { + onDelete: on_delete, + newKey: new_key, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnRelationship + ) + end + + # List indexes on the table. + # + # @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/server/tablesdb#tablesDBCreate). + # @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: key, type, status, attributes, error + # + # @return [ColumnIndexList] + def list_indexes(database_id:, table_id:, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnIndexList + ) + end + + # Creates an index on the columns listed. Your index should include all the + # columns you will query in a single request. + # Type can be `key`, `fulltext`, or `unique`. + # + # @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/server/tablesdb#tablesDBCreate). + # @param [String] key Index Key. + # @param [IndexType] type Index type. + # @param [Array] columns Array of columns to index. Maximum of 100 columns 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 [ColumnIndex] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + 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 columns.nil? + raise Appwrite::Exception.new('Missing required parameter: "columns"') + end + + api_params = { + key: key, + type: type, + columns: columns, + orders: orders, + lengths: lengths, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnIndex + ) + end + + # Get index by ID. + # + # @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/server/tablesdb#tablesDBCreate). + # @param [String] key Index Key. + # + # @return [ColumnIndex] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnIndex + ) + end + + # Delete an index. + # + # @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/server/tablesdb#tablesDBCreate). + # @param [String] key Index Key. + # + # @return [] + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + api_params = { + } + + api_headers = { + "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 rows in a given table. You can use the query + # params to filter your results. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate). + # @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 [RowList] + def list_rows(database_id:, table_id:, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::RowList + ) + end + + # Create a new Row. Before using this route, you should create a new table + # resource using either a [server + # integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) + # API or directly from your database console. + # + # @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/server/tablesdb#tablesDBCreate). 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 [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). + # + # @return [Row] + def create_row(database_id:, table_id:, row_id:, data:, permissions: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + rowId: row_id, + data: data, + permissions: permissions, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + # Create new Rows. Before using this route, you should create a new table + # resource using either a [server + # integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) + # API or directly from your database console. + # + # @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/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. + # @param [Array] rows Array of documents data as JSON objects. + # + # @return [RowList] + def create_rows(database_id:, table_id:, rows:) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if rows.nil? + raise Appwrite::Exception.new('Missing required parameter: "rows"') + end + + api_params = { + rows: rows, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + 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/server/tablesdb#tablesDBCreateTable) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [Array] rows Array of row data as JSON objects. May contain partial rows. + # + # @return [RowList] + def upsert_rows(database_id:, table_id:, rows:) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if rows.nil? + raise Appwrite::Exception.new('Missing required parameter: "rows"') + end + + api_params = { + rows: rows, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::RowList + ) + end + + # Update all rows that match your queries, if no queries are submitted then + # all rows are updated. You can pass only specific fields to be updated. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [Hash] data Row data as JSON object. Include only column 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. + # + # @return [RowList] + def update_rows(database_id:, table_id:, data: nil, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + data: data, + queries: queries, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::RowList + ) + end + + # Bulk delete rows using queries, if no queries are passed then all rows are + # deleted. + # + # @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/server/tablesdb#tablesDBCreate). + # @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 [RowList] + def delete_rows(database_id:, table_id:, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::RowList + ) + end + + # Get a row by its unique ID. This endpoint response returns a JSON object + # with the row data. + # + # @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/server/tablesdb#tablesDBCreate). + # @param [String] row_id Row 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 [Row] + def get_row(database_id:, table_id:, row_id:, queries: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + api_params = { + queries: queries, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + # Create or update a Row. Before using this route, you should create a new + # table resource using either a [server + # integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] row_id Row ID. + # @param [Hash] data Row data as JSON object. Include all required columns of the row 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). + # + # @return [Row] + def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + api_params = { + data: data, + permissions: permissions, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + # Update a row 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] table_id Table ID. + # @param [String] row_id Row ID. + # @param [Hash] data Row data as JSON object. Include only columns 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). + # + # @return [Row] + def update_row(database_id:, table_id:, row_id:, data: nil, permissions: 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + api_params = { + data: data, + permissions: permissions, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + # Delete a row by its unique ID. + # + # @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/server/tablesdb#tablesDBCreate). + # @param [String] row_id Row ID. + # + # @return [] + def delete_row(database_id:, table_id:, row_id:) + 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"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + api_params = { + } + + api_headers = { + "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] table_id Table ID. + # @param [String] row_id Row ID. + # @param [String] column Column key. + # @param [Float] value Value to increment the column by. The value must be a number. + # @param [Float] min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + # + # @return [Row] + def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + .gsub('{rowId}', row_id) + .gsub('{column}', column) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + if column.nil? + raise Appwrite::Exception.new('Missing required parameter: "column"') + end + + api_params = { + value: value, + min: min, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + # Increment a specific column of a row by a given value. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # @param [String] row_id Row ID. + # @param [String] column Column key. + # @param [Float] value Value to increment the column by. The value must be a number. + # @param [Float] max Maximum value for the column. If the current value is greater than this value, an error will be thrown. + # + # @return [Row] + def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + .gsub('{rowId}', row_id) + .gsub('{column}', column) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if table_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "tableId"') + end + + if row_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "rowId"') + end + + if column.nil? + raise Appwrite::Exception.new('Missing required parameter: "column"') + end + + api_params = { + value: value, + max: max, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Row + ) + end + + end +end \ No newline at end of file diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index d1b749b..dc07e0c 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -34,7 +34,6 @@ def list(queries: nil, search: nil) ) 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. @@ -74,7 +73,6 @@ def create(team_id:, name:, roles: nil) ) end - # Get a team by its ID. All team members have read access for this resource. # # @param [String] team_id Team ID. @@ -103,7 +101,6 @@ def get(team_id:) ) end - # Update the team's name by its unique ID. # # @param [String] team_id Team ID. @@ -139,7 +136,6 @@ def update_name(team_id:, name:) ) end - # Delete a team using its ID. Only team members with the owner role can # delete the team. # @@ -169,7 +165,6 @@ def delete(team_id:) ) end - # Use this endpoint to list a team's members using the team's ID. All team # members have read access to this endpoint. Hide sensitive attributes from # the response by toggling membership privacy in the Console. @@ -204,7 +199,6 @@ def list_memberships(team_id:, queries: nil, search: nil) ) 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 @@ -270,7 +264,6 @@ def create_membership(team_id:, roles:, email: nil, user_id: nil, phone: nil, ur ) end - # Get a team member by the membership unique id. All team members have read # access for this resource. Hide sensitive attributes from the response by # toggling membership privacy in the Console. @@ -307,7 +300,6 @@ def get_membership(team_id:, membership_id:) ) 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). @@ -352,7 +344,6 @@ def update_membership(team_id:, membership_id:, roles:) ) end - # This endpoint allows a user to leave a team or for a team owner to delete # the membership of any other team member. You can also use this endpoint to # delete a user membership even if it is not accepted. @@ -389,7 +380,6 @@ def delete_membership(team_id:, membership_id:) ) 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. @@ -443,7 +433,6 @@ def update_membership_status(team_id:, membership_id:, user_id:, secret:) ) end - # 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). @@ -474,7 +463,6 @@ def get_prefs(team_id:) ) end - # 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. @@ -512,6 +500,5 @@ def update_prefs(team_id:, prefs:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/tokens.rb b/lib/appwrite/services/tokens.rb index 6d3bd6d..a2a7c32 100644 --- a/lib/appwrite/services/tokens.rb +++ b/lib/appwrite/services/tokens.rb @@ -44,7 +44,6 @@ def list(bucket_id:, file_id:, queries: nil) ) end - # Create a new token. A token is linked to a file. Token can be passed as a # request URL search parameter. # @@ -83,7 +82,6 @@ def create_file_token(bucket_id:, file_id:, expire: nil) ) end - # Get a token by its unique ID. # # @param [String] token_id Token ID. @@ -112,7 +110,6 @@ def get(token_id:) ) end - # Update a token by its unique ID. Use this endpoint to update a token's # expiry date. # @@ -145,7 +142,6 @@ def update(token_id:, expire: nil) ) end - # Delete a token by its unique ID. # # @param [String] token_id Token ID. @@ -174,6 +170,5 @@ def delete(token_id:) ) end - end end \ No newline at end of file diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 0f44a9b..4128398 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -34,7 +34,6 @@ def list(queries: nil, search: nil) ) 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. @@ -72,7 +71,6 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) ) end - # Create a new user. Password provided must be hashed with the # [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to @@ -119,7 +117,6 @@ def create_argon2_user(user_id:, email:, password:, name: nil) ) end - # Create a new user. Password provided must be hashed with the # [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to @@ -166,7 +163,6 @@ def create_bcrypt_user(user_id:, email:, password:, name: nil) ) end - # Get identities for all users. # # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry @@ -193,7 +189,6 @@ def list_identities(queries: nil, search: nil) ) end - # Delete an identity by its unique ID. # # @param [String] identity_id Identity ID. @@ -222,7 +217,6 @@ def delete_identity(identity_id:) ) end - # Create a new user. Password provided must be hashed with the # [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to @@ -269,7 +263,6 @@ def create_md5_user(user_id:, email:, password:, name: nil) ) end - # Create a new user. Password provided must be hashed with the # [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to @@ -316,7 +309,6 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) ) end - # Create a new user. Password provided must be hashed with the # [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to @@ -393,7 +385,6 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu ) end - # Create a new user. Password provided must be hashed with the [Scrypt # Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) # algorithm. Use the [POST @@ -459,7 +450,6 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas ) end - # Create a new user. Password provided must be hashed with the # [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use # the [POST /users](https://appwrite.io/docs/server/users#usersCreate) @@ -508,7 +498,6 @@ def create_sha_user(user_id:, email:, password:, password_version: nil, name: ni ) end - # Get a user by its unique ID. # # @param [String] user_id User ID. @@ -537,7 +526,6 @@ def get(user_id:) ) end - # 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 @@ -571,7 +559,6 @@ def delete(user_id:) ) end - # Update the user email by its unique ID. # # @param [String] user_id User ID. @@ -607,7 +594,6 @@ def update_email(user_id:, email:) ) end - # Use this endpoint to create a JSON Web Token for user by its unique ID. You # can use the resulting JWT to authenticate on behalf of the user. The JWT # secret will become invalid if the session it uses gets deleted. @@ -643,7 +629,6 @@ def create_jwt(user_id:, session_id: nil, duration: nil) ) end - # Update the user labels by its unique ID. # # Labels can be used to grant access to resources. While teams are a way for @@ -684,7 +669,6 @@ def update_labels(user_id:, labels:) ) end - # Get the user activity logs list by its unique ID. # # @param [String] user_id User ID. @@ -715,7 +699,6 @@ def list_logs(user_id:, queries: nil) ) end - # Get the user membership list by its unique ID. # # @param [String] user_id User ID. @@ -748,7 +731,6 @@ def list_memberships(user_id:, queries: nil, search: nil) ) end - # Enable or disable MFA on a user account. # # @param [String] user_id User ID. @@ -784,7 +766,6 @@ def update_mfa(user_id:, mfa:) ) end - # Delete an authenticator app. # # @param [String] user_id User ID. @@ -819,7 +800,6 @@ def delete_mfa_authenticator(user_id:, type:) ) end - # List the factors available on the account to be used as a MFA challange. # # @param [String] user_id User ID. @@ -848,7 +828,6 @@ def list_mfa_factors(user_id:) ) end - # Get recovery codes that can be used as backup for MFA flow by User ID. # Before getting codes, they must be generated using # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) @@ -880,7 +859,6 @@ def get_mfa_recovery_codes(user_id:) ) end - # Regenerate recovery codes that can be used as backup for MFA flow by User # ID. Before regenerating codes, they must be first generated using # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) @@ -913,7 +891,6 @@ def update_mfa_recovery_codes(user_id:) ) end - # Generate recovery codes used as backup for MFA flow for User ID. Recovery # codes can be used as a MFA verification type in # [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) @@ -946,7 +923,6 @@ def create_mfa_recovery_codes(user_id:) ) end - # Update the user name by its unique ID. # # @param [String] user_id User ID. @@ -982,7 +958,6 @@ def update_name(user_id:, name:) ) end - # Update the user password by its unique ID. # # @param [String] user_id User ID. @@ -1018,7 +993,6 @@ def update_password(user_id:, password:) ) end - # Update the user phone by its unique ID. # # @param [String] user_id User ID. @@ -1054,7 +1028,6 @@ def update_phone(user_id:, number:) ) end - # Get the user preferences by its unique ID. # # @param [String] user_id User ID. @@ -1083,7 +1056,6 @@ def get_prefs(user_id:) ) end - # Update the user 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 error if exceeded. @@ -1121,7 +1093,6 @@ def update_prefs(user_id:, prefs:) ) end - # Get the user sessions list by its unique ID. # # @param [String] user_id User ID. @@ -1150,7 +1121,6 @@ def list_sessions(user_id:) ) 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 @@ -1185,7 +1155,6 @@ def create_session(user_id:) ) end - # Delete all user's sessions by using the user's unique ID. # # @param [String] user_id User ID. @@ -1214,7 +1183,6 @@ def delete_sessions(user_id:) ) end - # Delete a user sessions by its unique ID. # # @param [String] user_id User ID. @@ -1249,7 +1217,6 @@ def delete_session(user_id:, session_id:) ) 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. # @@ -1286,7 +1253,6 @@ def update_status(user_id:, status:) ) end - # List the messaging targets that are associated with a user. # # @param [String] user_id User ID. @@ -1317,7 +1283,6 @@ def list_targets(user_id:, queries: nil) ) end - # Create a messaging target. # # @param [String] user_id User ID. @@ -1369,7 +1334,6 @@ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id ) end - # Get a user's push notification target by ID. # # @param [String] user_id User ID. @@ -1404,7 +1368,6 @@ def get_target(user_id:, target_id:) ) end - # Update a messaging target. # # @param [String] user_id User ID. @@ -1446,7 +1409,6 @@ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: ) end - # Delete a messaging target. # # @param [String] user_id User ID. @@ -1481,7 +1443,6 @@ def delete_target(user_id:, target_id:) ) 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) @@ -1519,7 +1480,6 @@ def create_token(user_id:, length: nil, expire: nil) ) end - # Update the user email verification status by its unique ID. # # @param [String] user_id User ID. @@ -1555,7 +1515,6 @@ def update_email_verification(user_id:, email_verification:) ) end - # Update the user phone verification status by its unique ID. # # @param [String] user_id User ID. @@ -1591,6 +1550,5 @@ def update_phone_verification(user_id:, phone_verification:) ) end - end end \ No newline at end of file