From d95e204d928f378a0bd7bbb9c1f1c5acc0a1e03a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 18 Jul 2025 12:50:42 +1200 Subject: [PATCH 1/4] Add inc/dec --- README.md | 2 +- appwrite.gemspec | 2 +- docs/examples/databases/create-document.md | 1 + .../databases/decrement-document-attribute.md | 19 ++ .../databases/increment-document-attribute.md | 19 ++ docs/examples/databases/upsert-document.md | 18 ++ docs/examples/databases/upsert-documents.md | 2 +- lib/appwrite/client.rb | 2 +- lib/appwrite/enums/build_runtime.rb | 2 + lib/appwrite/enums/image_format.rb | 1 + lib/appwrite/enums/runtime.rb | 2 + lib/appwrite/models/attribute_string.rb | 11 +- lib/appwrite/models/document.rb | 5 + lib/appwrite/services/databases.rb | 184 +++++++++++++++++- lib/appwrite/services/tokens.rb | 2 +- lib/appwrite/services/users.rb | 2 +- 16 files changed, 263 insertions(+), 11 deletions(-) create mode 100644 docs/examples/databases/decrement-document-attribute.md create mode 100644 docs/examples/databases/increment-document-attribute.md create mode 100644 docs/examples/databases/upsert-document.md diff --git a/README.md b/README.md index 4d908bc..74b56ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Ruby SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite.gemspec b/appwrite.gemspec index 3c76b6b..99c8f2d 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '16.0.0' + spec.version = '16.1.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/databases/create-document.md b/docs/examples/databases/create-document.md index ce8dea7..c2e7691 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -4,6 +4,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_admin('') # .set_session('') # The user session to authenticate with .set_key('') # Your secret API key .set_jwt('') # Your secret JSON Web Token diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..9b5a5f4 --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.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 + +databases = Databases.new(client) + +result = databases.decrement_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: null, # optional + min: null # optional +) diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..40d8ba2 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.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 + +databases = Databases.new(client) + +result = databases.increment_document_attribute( + database_id: '', + collection_id: '', + document_id: '', + attribute: '', + value: null, # optional + max: null # optional +) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md new file mode 100644 index 0000000..2380818 --- /dev/null +++ b/docs/examples/databases/upsert-document.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 + +databases = Databases.new(client) + +result = databases.upsert_document( + database_id: '', + collection_id: '', + document_id: '', + data: {}, + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 353e38f..30c42aa 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -12,5 +12,5 @@ databases = Databases.new(client) result = databases.upsert_documents( database_id: '', collection_id: '', - documents: [] # optional + documents: [] ) diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 2158e4c..6a8c307 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '16.0.0', + 'x-sdk-version'=> '16.1.0', 'X-Appwrite-Response-Format' => '1.7.0' } @endpoint = 'https://cloud.appwrite.io/v1' diff --git a/lib/appwrite/enums/build_runtime.rb b/lib/appwrite/enums/build_runtime.rb index e113a77..1101024 100644 --- a/lib/appwrite/enums/build_runtime.rb +++ b/lib/appwrite/enums/build_runtime.rb @@ -38,6 +38,7 @@ module BuildRuntime DART_3_1 = 'dart-3.1' DART_3_3 = 'dart-3.3' DART_3_5 = 'dart-3.5' + DART_3_8 = 'dart-3.8' DOTNET_6_0 = 'dotnet-6.0' DOTNET_7_0 = 'dotnet-7.0' DOTNET_8_0 = 'dotnet-8.0' @@ -64,6 +65,7 @@ module BuildRuntime FLUTTER_3_24 = 'flutter-3.24' FLUTTER_3_27 = 'flutter-3.27' FLUTTER_3_29 = 'flutter-3.29' + FLUTTER_3_32 = 'flutter-3.32' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/image_format.rb b/lib/appwrite/enums/image_format.rb index f1e0ea2..3cd22ed 100644 --- a/lib/appwrite/enums/image_format.rb +++ b/lib/appwrite/enums/image_format.rb @@ -7,6 +7,7 @@ module ImageFormat WEBP = 'webp' HEIC = 'heic' AVIF = 'avif' + GIF = 'gif' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/runtime.rb b/lib/appwrite/enums/runtime.rb index 726c326..96d3b45 100644 --- a/lib/appwrite/enums/runtime.rb +++ b/lib/appwrite/enums/runtime.rb @@ -38,6 +38,7 @@ module Runtime DART_3_1 = 'dart-3.1' DART_3_3 = 'dart-3.3' DART_3_5 = 'dart-3.5' + DART_3_8 = 'dart-3.8' DOTNET_6_0 = 'dotnet-6.0' DOTNET_7_0 = 'dotnet-7.0' DOTNET_8_0 = 'dotnet-8.0' @@ -64,6 +65,7 @@ module Runtime FLUTTER_3_24 = 'flutter-3.24' FLUTTER_3_27 = 'flutter-3.27' FLUTTER_3_29 = 'flutter-3.29' + FLUTTER_3_32 = 'flutter-3.32' end end end \ No newline at end of file diff --git a/lib/appwrite/models/attribute_string.rb b/lib/appwrite/models/attribute_string.rb index 85037d5..79416f4 100644 --- a/lib/appwrite/models/attribute_string.rb +++ b/lib/appwrite/models/attribute_string.rb @@ -13,6 +13,7 @@ class AttributeString attr_reader :updated_at attr_reader :size attr_reader :default + attr_reader :encrypt def initialize( key:, @@ -24,7 +25,8 @@ def initialize( created_at:, updated_at:, size:, - default: + default: , + encrypt: ) @key = key @type = type @@ -36,6 +38,7 @@ def initialize( @updated_at = updated_at @size = size @default = default + @encrypt = encrypt end def self.from(map:) @@ -49,7 +52,8 @@ def self.from(map:) created_at: map["$createdAt"], updated_at: map["$updatedAt"], size: map["size"], - default: map["default"] + default: map["default"], + encrypt: map["encrypt"] ) end @@ -64,7 +68,8 @@ def to_map "$createdAt": @created_at, "$updatedAt": @updated_at, "size": @size, - "default": @default + "default": @default, + "encrypt": @encrypt } end end diff --git a/lib/appwrite/models/document.rb b/lib/appwrite/models/document.rb index 59d200e..0bab705 100644 --- a/lib/appwrite/models/document.rb +++ b/lib/appwrite/models/document.rb @@ -4,6 +4,7 @@ module Appwrite module Models class Document attr_reader :id + attr_reader :sequence attr_reader :collection_id attr_reader :database_id attr_reader :created_at @@ -13,6 +14,7 @@ class Document def initialize( id:, + sequence:, collection_id:, database_id:, created_at:, @@ -21,6 +23,7 @@ def initialize( data: ) @id = id + @sequence = sequence @collection_id = collection_id @database_id = database_id @created_at = created_at @@ -32,6 +35,7 @@ def initialize( def self.from(map:) Document.new( id: map["$id"], + sequence: map["$sequence"], collection_id: map["$collectionId"], database_id: map["$databaseId"], created_at: map["$createdAt"], @@ -44,6 +48,7 @@ def self.from(map:) def to_map { "$id": @id, + "$sequence": @sequence, "$collectionId": @collection_id, "$databaseId": @database_id, "$createdAt": @created_at, diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 7f3fec2..084a29a 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -1729,6 +1729,10 @@ 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. + # # 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) @@ -1774,18 +1778,21 @@ 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. + # # 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) # API or directly from your database console. - # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [Array] documents Array of document data as JSON objects. May contain partial documents. # # @return [DocumentList] - def upsert_documents(database_id:, collection_id:, documents: nil) + def upsert_documents(database_id:, collection_id:, documents:) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -1798,6 +1805,10 @@ def upsert_documents(database_id:, collection_id:, documents: nil) raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + api_params = { documents: documents, } @@ -1816,6 +1827,10 @@ def upsert_documents(database_id:, collection_id:, documents: 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. + # # 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. @@ -1858,6 +1873,10 @@ 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. + # # Bulk delete documents using queries, if no queries are passed then all # documents are deleted. # @@ -1941,6 +1960,63 @@ 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. + # + # 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) + # API or directly from your database console. + # + # @param [String] database_id Database ID. + # @param [String] collection_id Collection ID. + # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required attributes of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # + # @return [Document] + def upsert_document(database_id:, collection_id:, document_id:, data:, permissions: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + + api_params = { + 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::Document + ) + end + + # Update a document by its unique ID. Using the patch method you can pass # only specific fields that will get updated. # @@ -2029,6 +2105,110 @@ def delete_document(database_id:, collection_id:, document_id:) end + # 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] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + # + # @return [Document] + def decrement_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, min: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + min: min, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + + # Increment 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 increment the attribute by. The value must be a number. + # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + # + # @return [Document] + def increment_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, max: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + .gsub('{attribute}', attribute) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if document_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "documentId"') + end + + if attribute.nil? + raise Appwrite::Exception.new('Missing required parameter: "attribute"') + end + + api_params = { + value: value, + max: max, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Document + ) + end + + # List indexes in the collection. # # @param [String] database_id Database ID. diff --git a/lib/appwrite/services/tokens.rb b/lib/appwrite/services/tokens.rb index acc1739..6d3bd6d 100644 --- a/lib/appwrite/services/tokens.rb +++ b/lib/appwrite/services/tokens.rb @@ -46,7 +46,7 @@ def list(bucket_id:, file_id:, queries: nil) # Create a new token. A token is linked to a file. Token can be passed as a - # header or request get parameter. + # request URL search parameter. # # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File unique ID. diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 6bb2063..0f44a9b 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -1290,7 +1290,7 @@ def update_status(user_id:, status:) # List the messaging targets that are associated with a user. # # @param [String] user_id User ID. - # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + # @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, providerId, identifier, providerType # # @return [TargetList] def list_targets(user_id:, queries: nil) From 0ef280a34f74b3dde0dca6d7e8c9b8cd20d8953d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Jul 2025 16:17:04 +0000 Subject: [PATCH 2/4] chore: regenerate --- README.md | 4 +- appwrite.gemspec | 2 +- docs/examples/databases/create-document.md | 1 - docs/examples/databases/create-documents.md | 1 + docs/examples/databases/upsert-document.md | 7 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 19 + .../examples/tables/create-datetime-column.md | 19 + docs/examples/tables/create-email-column.md | 19 + docs/examples/tables/create-enum-column.md | 20 + docs/examples/tables/create-float-column.md | 21 + docs/examples/tables/create-index.md | 21 + docs/examples/tables/create-integer-column.md | 21 + docs/examples/tables/create-ip-column.md | 19 + .../tables/create-relationship-column.md | 22 + docs/examples/tables/create-row.md | 19 + docs/examples/tables/create-rows.md | 16 + docs/examples/tables/create-string-column.md | 21 + docs/examples/tables/create-url-column.md | 19 + docs/examples/tables/create.md | 19 + docs/examples/tables/decrement-row-column.md | 19 + docs/examples/tables/delete-column.md | 16 + docs/examples/tables/delete-index.md | 16 + docs/examples/tables/delete-row.md | 16 + docs/examples/tables/delete-rows.md | 16 + docs/examples/tables/delete.md | 15 + docs/examples/tables/get-column.md | 16 + docs/examples/tables/get-index.md | 16 + docs/examples/tables/get-row.md | 17 + docs/examples/tables/get.md | 15 + docs/examples/tables/increment-row-column.md | 19 + docs/examples/tables/list-columns.md | 16 + docs/examples/tables/list-indexes.md | 16 + docs/examples/tables/list-rows.md | 16 + docs/examples/tables/list.md | 16 + docs/examples/tables/update-boolean-column.md | 19 + .../examples/tables/update-datetime-column.md | 19 + docs/examples/tables/update-email-column.md | 19 + docs/examples/tables/update-enum-column.md | 20 + docs/examples/tables/update-float-column.md | 21 + docs/examples/tables/update-integer-column.md | 21 + docs/examples/tables/update-ip-column.md | 19 + .../tables/update-relationship-column.md | 18 + docs/examples/tables/update-row.md | 18 + docs/examples/tables/update-rows.md | 17 + docs/examples/tables/update-string-column.md | 20 + docs/examples/tables/update-url-column.md | 19 + docs/examples/tables/update.md | 19 + docs/examples/tables/upsert-row.md | 17 + docs/examples/tables/upsert-rows.md | 15 + lib/appwrite.rb | 18 + lib/appwrite/client.rb | 4 +- lib/appwrite/models/column_boolean.rb | 67 + lib/appwrite/models/column_datetime.rb | 72 + lib/appwrite/models/column_email.rb | 72 + lib/appwrite/models/column_enum.rb | 77 + lib/appwrite/models/column_float.rb | 77 + lib/appwrite/models/column_index.rb | 67 + lib/appwrite/models/column_index_list.rb | 32 + lib/appwrite/models/column_integer.rb | 77 + lib/appwrite/models/column_ip.rb | 72 + lib/appwrite/models/column_list.rb | 32 + lib/appwrite/models/column_relationship.rb | 92 + lib/appwrite/models/column_string.rb | 77 + lib/appwrite/models/column_url.rb | 72 + lib/appwrite/models/row.rb | 66 + lib/appwrite/models/row_list.rb | 36 + lib/appwrite/models/table.rb | 72 + lib/appwrite/models/table_list.rb | 32 + lib/appwrite/services/account.rb | 6 + lib/appwrite/services/databases.rb | 253 +- lib/appwrite/services/tables.rb | 2192 +++++++++++++++++ 72 files changed, 4306 insertions(+), 80 deletions(-) create mode 100644 docs/examples/tables/create-boolean-column.md create mode 100644 docs/examples/tables/create-datetime-column.md create mode 100644 docs/examples/tables/create-email-column.md create mode 100644 docs/examples/tables/create-enum-column.md create mode 100644 docs/examples/tables/create-float-column.md create mode 100644 docs/examples/tables/create-index.md create mode 100644 docs/examples/tables/create-integer-column.md create mode 100644 docs/examples/tables/create-ip-column.md create mode 100644 docs/examples/tables/create-relationship-column.md create mode 100644 docs/examples/tables/create-row.md create mode 100644 docs/examples/tables/create-rows.md create mode 100644 docs/examples/tables/create-string-column.md create mode 100644 docs/examples/tables/create-url-column.md create mode 100644 docs/examples/tables/create.md create mode 100644 docs/examples/tables/decrement-row-column.md create mode 100644 docs/examples/tables/delete-column.md create mode 100644 docs/examples/tables/delete-index.md create mode 100644 docs/examples/tables/delete-row.md create mode 100644 docs/examples/tables/delete-rows.md create mode 100644 docs/examples/tables/delete.md create mode 100644 docs/examples/tables/get-column.md create mode 100644 docs/examples/tables/get-index.md create mode 100644 docs/examples/tables/get-row.md create mode 100644 docs/examples/tables/get.md create mode 100644 docs/examples/tables/increment-row-column.md create mode 100644 docs/examples/tables/list-columns.md create mode 100644 docs/examples/tables/list-indexes.md create mode 100644 docs/examples/tables/list-rows.md create mode 100644 docs/examples/tables/list.md create mode 100644 docs/examples/tables/update-boolean-column.md create mode 100644 docs/examples/tables/update-datetime-column.md create mode 100644 docs/examples/tables/update-email-column.md create mode 100644 docs/examples/tables/update-enum-column.md create mode 100644 docs/examples/tables/update-float-column.md create mode 100644 docs/examples/tables/update-integer-column.md create mode 100644 docs/examples/tables/update-ip-column.md create mode 100644 docs/examples/tables/update-relationship-column.md create mode 100644 docs/examples/tables/update-row.md create mode 100644 docs/examples/tables/update-rows.md create mode 100644 docs/examples/tables/update-string-column.md create mode 100644 docs/examples/tables/update-url-column.md create mode 100644 docs/examples/tables/update.md create mode 100644 docs/examples/tables/upsert-row.md create mode 100644 docs/examples/tables/upsert-rows.md create mode 100644 lib/appwrite/models/column_boolean.rb create mode 100644 lib/appwrite/models/column_datetime.rb create mode 100644 lib/appwrite/models/column_email.rb create mode 100644 lib/appwrite/models/column_enum.rb create mode 100644 lib/appwrite/models/column_float.rb create mode 100644 lib/appwrite/models/column_index.rb create mode 100644 lib/appwrite/models/column_index_list.rb create mode 100644 lib/appwrite/models/column_integer.rb create mode 100644 lib/appwrite/models/column_ip.rb create mode 100644 lib/appwrite/models/column_list.rb create mode 100644 lib/appwrite/models/column_relationship.rb create mode 100644 lib/appwrite/models/column_string.rb create mode 100644 lib/appwrite/models/column_url.rb create mode 100644 lib/appwrite/models/row.rb create mode 100644 lib/appwrite/models/row_list.rb create mode 100644 lib/appwrite/models/table.rb create mode 100644 lib/appwrite/models/table_list.rb create mode 100644 lib/appwrite/services/tables.rb 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/databases/create-document.md b/docs/examples/databases/create-document.md index c2e7691..ce8dea7 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -4,7 +4,6 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_admin('') # .set_session('') # The user session to authenticate with .set_key('') # Your secret API key .set_jwt('') # Your secret JSON Web Token diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 469234c..ecccdf5 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -4,6 +4,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_admin('') # .set_key('') # Your secret API key databases = Databases.new(client) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 2380818..d165e1e 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -4,15 +4,14 @@ 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 + .set_key('') # Your secret API key + .set_jwt('') # Your secret JSON Web Token databases = Databases.new(client) result = databases.upsert_document( database_id: '', collection_id: '', - document_id: '', - data: {}, - permissions: ["read("any")"] # optional + document_id: '' ) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 30c42aa..8e404e6 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -4,13 +4,12 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_project('') # Your project ID + .set_admin('') # .set_key('') # Your secret API key databases = Databases.new(client) result = databases.upsert_documents( database_id: '', - collection_id: '', - documents: [] + collection_id: '' ) diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md new file mode 100644 index 0000000..7df3908 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_boolean_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: false, # optional + array: false # optional +) diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md new file mode 100644 index 0000000..2d65509 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_datetime_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md new file mode 100644 index 0000000..01f7ad4 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_email_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'email@example.com', # optional + array: false # optional +) diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md new file mode 100644 index 0000000..97fcb58 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_enum_column( + database_id: '', + table_id: '', + key: '', + elements: [], + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md new file mode 100644 index 0000000..9df32a3 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/create-index.md b/docs/examples/tables/create-index.md new file mode 100644 index 0000000..3c8dfdf --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_index( + database_id: '', + table_id: '', + key: '', + type: IndexType::KEY, + columns: [], + orders: [], # optional + lengths: [] # optional +) diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md new file mode 100644 index 0000000..d0c5c78 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md new file mode 100644 index 0000000..0c97840 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_ip_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md new file mode 100644 index 0000000..8f7fb84 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/create-row.md b/docs/examples/tables/create-row.md new file mode 100644 index 0000000..a625249 --- /dev/null +++ b/docs/examples/tables/create-row.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_key('') # Your secret API key + .set_jwt('') # Your secret JSON Web Token + +tables = Tables.new(client) + +result = tables.create_row( + database_id: '', + table_id: '', + row_id: '', + data: {}, + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md new file mode 100644 index 0000000..2e78b96 --- /dev/null +++ b/docs/examples/tables/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_admin('') # + .set_key('') # Your secret API key + +tables = Tables.new(client) + +result = tables.create_rows( + database_id: '', + table_id: '', + rows: [] +) diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md new file mode 100644 index 0000000..d47cf49 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/create-url-column.md b/docs/examples/tables/create-url-column.md new file mode 100644 index 0000000..fcfebac --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.create_url_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'https://example.com', # optional + array: false # optional +) diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md new file mode 100644 index 0000000..5a255fa --- /dev/null +++ b/docs/examples/tables/create.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 = Tables.new(client) + +result = tables.create( + database_id: '', + table_id: '', + name: '', + permissions: ["read("any")"], # optional + row_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md new file mode 100644 index 0000000..e22afcb --- /dev/null +++ b/docs/examples/tables/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_key('') # Your secret API key + +tables = Tables.new(client) + +result = tables.decrement_row_column( + database_id: '', + table_id: '', + row_id: '', + column: '', + value: null, # optional + min: null # optional +) diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md new file mode 100644 index 0000000..2458640 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.delete_column( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md new file mode 100644 index 0000000..54bd545 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.delete_index( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md new file mode 100644 index 0000000..9841fc2 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.delete_row( + database_id: '', + table_id: '', + row_id: '' +) diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md new file mode 100644 index 0000000..7be1e4b --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.delete_rows( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md new file mode 100644 index 0000000..ca607f2 --- /dev/null +++ b/docs/examples/tables/delete.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 = Tables.new(client) + +result = tables.delete( + database_id: '', + table_id: '' +) diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md new file mode 100644 index 0000000..1a1469d --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.get_column( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md new file mode 100644 index 0000000..7d762ce --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.get_index( + database_id: '', + table_id: '', + key: '' +) diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md new file mode 100644 index 0000000..4526bb7 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.get_row( + database_id: '', + table_id: '', + row_id: '', + queries: [] # optional +) diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md new file mode 100644 index 0000000..22ba02a --- /dev/null +++ b/docs/examples/tables/get.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 = Tables.new(client) + +result = tables.get( + database_id: '', + table_id: '' +) diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md new file mode 100644 index 0000000..c0a91d4 --- /dev/null +++ b/docs/examples/tables/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_key('') # Your secret API key + +tables = Tables.new(client) + +result = tables.increment_row_column( + database_id: '', + table_id: '', + row_id: '', + column: '', + value: null, # optional + max: null # optional +) diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md new file mode 100644 index 0000000..7e85156 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.list_columns( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md new file mode 100644 index 0000000..0789291 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.list_indexes( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md new file mode 100644 index 0000000..bc9a0a4 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.list_rows( + database_id: '', + table_id: '', + queries: [] # optional +) diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md new file mode 100644 index 0000000..7cf987e --- /dev/null +++ b/docs/examples/tables/list.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 = Tables.new(client) + +result = tables.list( + database_id: '', + queries: [], # optional + search: '' # optional +) diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md new file mode 100644 index 0000000..a09b365 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_boolean_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: false, + new_key: '' # optional +) diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md new file mode 100644 index 0000000..55e0484 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_datetime_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md new file mode 100644 index 0000000..285cd66 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_email_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'email@example.com', + new_key: '' # optional +) diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md new file mode 100644 index 0000000..90773ed --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_enum_column( + database_id: '', + table_id: '', + key: '', + elements: [], + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md new file mode 100644 index 0000000..0bb992b --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md new file mode 100644 index 0000000..35f8c47 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.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/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md new file mode 100644 index 0000000..2ad1840 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_ip_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md new file mode 100644 index 0000000..de86fd5 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_relationship_column( + database_id: '', + table_id: '', + key: '', + on_delete: RelationMutate::CASCADE, # optional + new_key: '' # optional +) diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md new file mode 100644 index 0000000..500927d --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_row( + database_id: '', + table_id: '', + row_id: '', + data: {}, # optional + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md new file mode 100644 index 0000000..8cee181 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_rows( + database_id: '', + table_id: '', + data: {}, # optional + queries: [] # optional +) diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md new file mode 100644 index 0000000..2240f49 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_string_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', + size: 1, # optional + new_key: '' # optional +) diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md new file mode 100644 index 0000000..0947a78 --- /dev/null +++ b/docs/examples/tables/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 = Tables.new(client) + +result = tables.update_url_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: 'https://example.com', + new_key: '' # optional +) diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md new file mode 100644 index 0000000..003d3d0 --- /dev/null +++ b/docs/examples/tables/update.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 = Tables.new(client) + +result = tables.update( + database_id: '', + table_id: '', + name: '', + permissions: ["read("any")"], # optional + row_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md new file mode 100644 index 0000000..d96172e --- /dev/null +++ b/docs/examples/tables/upsert-row.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_key('') # Your secret API key + .set_jwt('') # Your secret JSON Web Token + +tables = Tables.new(client) + +result = tables.upsert_row( + database_id: '', + table_id: '', + row_id: '' +) diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md new file mode 100644 index 0000000..8987b1e --- /dev/null +++ b/docs/examples/tables/upsert-rows.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_admin('') # + .set_key('') # Your secret API key + +tables = Tables.new(client) + +result = tables.upsert_rows( + database_id: '', + table_id: '' +) diff --git a/lib/appwrite.rb b/lib/appwrite.rb index e80df28..0e6e87a 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' @@ -138,6 +155,7 @@ require_relative 'appwrite/services/account' require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/databases' +require_relative 'appwrite/services/tables' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/health' 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..0336418 --- /dev/null +++ b/lib/appwrite/models/column_index.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnIndex + attr_reader :key + attr_reader :type + attr_reader :status + attr_reader :error + attr_reader :columns + attr_reader :lengths + attr_reader :orders + attr_reader :created_at + attr_reader :updated_at + + def initialize( + key:, + type:, + status:, + error:, + columns:, + lengths:, + orders: , + created_at:, + updated_at: + ) + @key = key + @type = type + @status = status + @error = error + @columns = columns + @lengths = lengths + @orders = orders + @created_at = created_at + @updated_at = updated_at + end + + def self.from(map:) + ColumnIndex.new( + key: map["key"], + type: map["type"], + status: map["status"], + error: map["error"], + columns: map["columns"], + lengths: map["lengths"], + orders: map["orders"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"] + ) + end + + def to_map + { + "key": @key, + "type": @type, + "status": @status, + "error": @error, + "columns": @columns, + "lengths": @lengths, + "orders": @orders, + "$createdAt": @created_at, + "$updatedAt": @updated_at + } + 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/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/services/account.rb b/lib/appwrite/services/account.rb index 2446c08..5ce86e0 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -909,6 +909,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. @@ -947,6 +950,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. diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 084a29a..74fe4e9 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -172,6 +172,9 @@ def delete(database_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.list` instead. + # # Get a list of all collections that belong to the provided databaseId. You # can use the search parameter to filter your results. # @@ -206,6 +209,9 @@ def list_collections(database_id:, queries: nil, search: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.create` 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) @@ -257,6 +263,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 `Tables.get` instead. + # # Get a collection by its unique ID. This endpoint response returns a JSON # object with the collection metadata. # @@ -293,6 +302,9 @@ def get_collection(database_id:, collection_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.update` instead. + # # Update a collection by its unique ID. # # @param [String] database_id Database ID. @@ -341,6 +353,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 `Tables.delete` instead. + # # Delete a collection by its unique ID. Only users with write permissions # have access to delete this resource. # @@ -377,10 +392,13 @@ def delete_collection(database_id:, collection_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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] @@ -414,11 +432,14 @@ def list_attributes(database_id:, collection_id:, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. @@ -467,11 +488,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 `Tables.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. @@ -524,10 +548,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 `Tables.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. @@ -576,11 +603,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 `Tables.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. @@ -633,11 +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 `Tables.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. @@ -686,16 +719,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 `Tables.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) @@ -744,14 +780,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 `Tables.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? @@ -804,17 +843,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 `Tables.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) @@ -868,17 +910,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 `Tables.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] @@ -926,18 +971,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 `Tables.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) @@ -988,17 +1036,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 `Tables.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] @@ -1046,18 +1097,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 `Tables.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) @@ -1108,14 +1162,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 `Tables.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] @@ -1161,16 +1218,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 `Tables.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) @@ -1219,13 +1279,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 `Tables.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. @@ -1277,11 +1340,14 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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? @@ -1338,17 +1404,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 `Tables.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) @@ -1398,11 +1467,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 `Tables.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. @@ -1451,16 +1523,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 `Tables.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) @@ -1509,10 +1584,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 `Tables.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 [] @@ -1549,10 +1627,13 @@ def get_attribute(database_id:, collection_id:, key:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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 [] @@ -1590,15 +1671,18 @@ def delete_attribute(database_id:, collection_id:, key:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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) @@ -1638,6 +1722,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 `Tables.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. # @@ -1676,6 +1763,9 @@ def list_documents(database_id:, collection_id:, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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) @@ -1729,6 +1819,9 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. + # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1778,6 +1871,9 @@ def create_documents(database_id:, collection_id:, documents:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead. + # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1786,13 +1882,13 @@ def create_documents(database_id:, collection_id:, documents:) # new collection resource using either a [server # integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) # API or directly from your database console. + # # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. - # @param [Array] documents Array of document data as JSON objects. May contain partial documents. # # @return [DocumentList] - def upsert_documents(database_id:, collection_id:, documents:) + def upsert_documents(database_id:, collection_id:) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -1805,12 +1901,7 @@ def upsert_documents(database_id:, collection_id:, documents:) raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end - if documents.nil? - raise Appwrite::Exception.new('Missing required parameter: "documents"') - end - api_params = { - documents: documents, } api_headers = { @@ -1827,6 +1918,9 @@ def upsert_documents(database_id:, collection_id:, documents:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead. + # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1873,6 +1967,9 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead. + # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1916,6 +2013,9 @@ def delete_documents(database_id:, collection_id:, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead. + # # Get a document by its unique ID. This endpoint response returns a JSON # object with the document data. # @@ -1960,6 +2060,9 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead. + # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1972,11 +2075,9 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [String] document_id Document ID. - # @param [Hash] data Document data as JSON object. Include all required attributes of the document to be created or updated. - # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [Document] - def upsert_document(database_id:, collection_id:, document_id:, data:, permissions: nil) + def upsert_document(database_id:, collection_id:, document_id:) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -1994,13 +2095,7 @@ def upsert_document(database_id:, collection_id:, document_id:, data:, permissio raise Appwrite::Exception.new('Missing required parameter: "documentId"') end - if data.nil? - raise Appwrite::Exception.new('Missing required parameter: "data"') - end - api_params = { - data: data, - permissions: permissions, } api_headers = { @@ -2017,6 +2112,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 `Tables.updateRow` instead. + # # Update a document by its unique ID. Using the patch method you can pass # only specific fields that will get updated. # @@ -2064,6 +2162,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 `Tables.deleteRow` instead. + # # Delete a document by its unique ID. # # @param [String] database_id Database ID. @@ -2105,13 +2206,16 @@ def delete_document(database_id:, collection_id:, document_id:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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,6 +2261,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 `Tables.incrementRowColumn` instead. + # # Increment a specific attribute of a document by a given value. # # @param [String] database_id Database ID. @@ -2209,6 +2316,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 `Tables.listIndexes` instead. + # # List indexes in the collection. # # @param [String] database_id Database ID. @@ -2246,6 +2356,9 @@ def list_indexes(database_id:, collection_id:, queries: nil) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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,6 +2419,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 `Tables.getIndex` instead. + # # Get index by ID. # # @param [String] database_id Database ID. @@ -2347,6 +2463,9 @@ def get_index(database_id:, collection_id:, key:) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead. + # # Delete an index. # # @param [String] database_id Database ID. diff --git a/lib/appwrite/services/tables.rb b/lib/appwrite/services/tables.rb new file mode 100644 index 0000000..607a725 --- /dev/null +++ b/lib/appwrite/services/tables.rb @@ -0,0 +1,2192 @@ +#frozen_string_literal: true + +module Appwrite + class Tables < Service + + def initialize(client) + @client = client + 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 attributes: name, enabled, rowSecurity + # @param [String] search Search term to filter your list results. Max length: 256 chars. + # + # @return [TableList] + def list(database_id:, queries: nil, search: nil) + api_path = '/databases/{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/databases#databasesCreateTable) + # 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(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) + api_path = '/databases/{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(database_id:, table_id:) + api_path = '/databases/{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(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) + api_path = '/databases/{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(database_id:, table_id:) + api_path = '/databases/{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 attributes in the collection. + # + # @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 attributes: key, type, size, required, array, status, error + # + # @return [ColumnList] + def list_columns(database_id:, table_id:, queries: nil) + api_path = '/databases/{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/tables#tablesCreate). + # @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 = '/databases/{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/tables#tablesCreate). + # @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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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/tables#tablesCreate). + # @param [String] key Column Key. + # @param [Integer] size Attribute size for text attributes, 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 = '/databases/{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/tables#tablesCreate). + # @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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 in the collection. + # + # @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/tables#tablesCreate). + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + # + # @return [ColumnIndexList] + def list_indexes(database_id:, table_id:, queries: nil) + api_path = '/databases/{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 attributes listed. Your index should include all + # the attributes you will query in a single request. + # Attributes can be `key`, `fulltext`, and `unique`. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + # @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 = '/databases/{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/tables#tablesCreate). + # @param [String] key Index Key. + # + # @return [ColumnIndex] + def get_index(database_id:, table_id:, key:) + api_path = '/databases/{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/tables#tablesCreate). + # @param [String] key Index Key. + # + # @return [] + def delete_index(database_id:, table_id:, key:) + api_path = '/databases/{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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + # @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 = '/databases/{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/databases#databasesCreateTable) + # 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/tables#tablesCreate). 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 = '/databases/{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/databases#databasesCreateTable) + # 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/tables#tablesCreate). 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 = '/databases/{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/databases#databasesCreateTable) + # API or directly from your database console. + # + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. + # + # @return [RowList] + def upsert_rows(database_id:, table_id:) + api_path = '/databases/{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 = { + } + + 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 = '/databases/{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/tables#tablesCreate). + # @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 = '/databases/{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/tables#tablesCreate). + # @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 = '/databases/{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/databases#databasesCreateTable) + # 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. + # + # @return [Row] + def upsert_row(database_id:, table_id:, row_id:) + api_path = '/databases/{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: '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 = '/databases/{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/tables#tablesCreate). + # @param [String] row_id Row ID. + # + # @return [] + def delete_row(database_id:, table_id:, row_id:) + api_path = '/databases/{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 = '/databases/{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 = '/databases/{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 From 21800fe0dd6ea9c1e6ea9bbe3450ec9a1b051c91 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jul 2025 06:43:34 +0000 Subject: [PATCH 3/4] chore: regen to 1.7.x --- README.md | 4 +- appwrite.gemspec | 2 +- docs/examples/databases/create-document.md | 3 +- docs/examples/databases/create-documents.md | 2 +- docs/examples/databases/upsert-document.md | 7 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 19 - .../examples/tables/create-datetime-column.md | 19 - docs/examples/tables/create-email-column.md | 19 - docs/examples/tables/create-enum-column.md | 20 - docs/examples/tables/create-float-column.md | 21 - docs/examples/tables/create-index.md | 21 - docs/examples/tables/create-integer-column.md | 21 - docs/examples/tables/create-ip-column.md | 19 - .../tables/create-relationship-column.md | 22 - docs/examples/tables/create-row.md | 19 - docs/examples/tables/create-rows.md | 16 - docs/examples/tables/create-string-column.md | 21 - docs/examples/tables/create-url-column.md | 19 - docs/examples/tables/create.md | 19 - docs/examples/tables/decrement-row-column.md | 19 - docs/examples/tables/delete-column.md | 16 - docs/examples/tables/delete-index.md | 16 - docs/examples/tables/delete-row.md | 16 - docs/examples/tables/delete-rows.md | 16 - docs/examples/tables/delete.md | 15 - docs/examples/tables/get-column.md | 16 - docs/examples/tables/get-index.md | 16 - docs/examples/tables/get-row.md | 17 - docs/examples/tables/get.md | 15 - docs/examples/tables/increment-row-column.md | 19 - docs/examples/tables/list-columns.md | 16 - docs/examples/tables/list-indexes.md | 16 - docs/examples/tables/list-rows.md | 16 - docs/examples/tables/list.md | 16 - docs/examples/tables/update-boolean-column.md | 19 - .../examples/tables/update-datetime-column.md | 19 - docs/examples/tables/update-email-column.md | 19 - docs/examples/tables/update-enum-column.md | 20 - docs/examples/tables/update-float-column.md | 21 - docs/examples/tables/update-integer-column.md | 21 - docs/examples/tables/update-ip-column.md | 19 - .../tables/update-relationship-column.md | 18 - docs/examples/tables/update-row.md | 18 - docs/examples/tables/update-rows.md | 17 - docs/examples/tables/update-string-column.md | 20 - docs/examples/tables/update-url-column.md | 19 - docs/examples/tables/update.md | 19 - docs/examples/tables/upsert-row.md | 17 - docs/examples/tables/upsert-rows.md | 15 - lib/appwrite.rb | 18 - lib/appwrite/client.rb | 4 +- lib/appwrite/models/column_boolean.rb | 67 - lib/appwrite/models/column_datetime.rb | 72 - lib/appwrite/models/column_email.rb | 72 - lib/appwrite/models/column_enum.rb | 77 - lib/appwrite/models/column_float.rb | 77 - lib/appwrite/models/column_index.rb | 67 - lib/appwrite/models/column_index_list.rb | 32 - lib/appwrite/models/column_integer.rb | 77 - lib/appwrite/models/column_ip.rb | 72 - lib/appwrite/models/column_list.rb | 32 - lib/appwrite/models/column_relationship.rb | 92 - lib/appwrite/models/column_string.rb | 77 - lib/appwrite/models/column_url.rb | 72 - lib/appwrite/models/row.rb | 66 - lib/appwrite/models/row_list.rb | 36 - lib/appwrite/models/table.rb | 72 - lib/appwrite/models/table_list.rb | 32 - lib/appwrite/services/account.rb | 6 - lib/appwrite/services/databases.rb | 252 +- lib/appwrite/services/tables.rb | 2192 ----------------- 72 files changed, 81 insertions(+), 4307 deletions(-) delete mode 100644 docs/examples/tables/create-boolean-column.md delete mode 100644 docs/examples/tables/create-datetime-column.md delete mode 100644 docs/examples/tables/create-email-column.md delete mode 100644 docs/examples/tables/create-enum-column.md delete mode 100644 docs/examples/tables/create-float-column.md delete mode 100644 docs/examples/tables/create-index.md delete mode 100644 docs/examples/tables/create-integer-column.md delete mode 100644 docs/examples/tables/create-ip-column.md delete mode 100644 docs/examples/tables/create-relationship-column.md delete mode 100644 docs/examples/tables/create-row.md delete mode 100644 docs/examples/tables/create-rows.md delete mode 100644 docs/examples/tables/create-string-column.md delete mode 100644 docs/examples/tables/create-url-column.md delete mode 100644 docs/examples/tables/create.md delete mode 100644 docs/examples/tables/decrement-row-column.md delete mode 100644 docs/examples/tables/delete-column.md delete mode 100644 docs/examples/tables/delete-index.md delete mode 100644 docs/examples/tables/delete-row.md delete mode 100644 docs/examples/tables/delete-rows.md delete mode 100644 docs/examples/tables/delete.md delete mode 100644 docs/examples/tables/get-column.md delete mode 100644 docs/examples/tables/get-index.md delete mode 100644 docs/examples/tables/get-row.md delete mode 100644 docs/examples/tables/get.md delete mode 100644 docs/examples/tables/increment-row-column.md delete mode 100644 docs/examples/tables/list-columns.md delete mode 100644 docs/examples/tables/list-indexes.md delete mode 100644 docs/examples/tables/list-rows.md delete mode 100644 docs/examples/tables/list.md delete mode 100644 docs/examples/tables/update-boolean-column.md delete mode 100644 docs/examples/tables/update-datetime-column.md delete mode 100644 docs/examples/tables/update-email-column.md delete mode 100644 docs/examples/tables/update-enum-column.md delete mode 100644 docs/examples/tables/update-float-column.md delete mode 100644 docs/examples/tables/update-integer-column.md delete mode 100644 docs/examples/tables/update-ip-column.md delete mode 100644 docs/examples/tables/update-relationship-column.md delete mode 100644 docs/examples/tables/update-row.md delete mode 100644 docs/examples/tables/update-rows.md delete mode 100644 docs/examples/tables/update-string-column.md delete mode 100644 docs/examples/tables/update-url-column.md delete mode 100644 docs/examples/tables/update.md delete mode 100644 docs/examples/tables/upsert-row.md delete mode 100644 docs/examples/tables/upsert-rows.md delete mode 100644 lib/appwrite/models/column_boolean.rb delete mode 100644 lib/appwrite/models/column_datetime.rb delete mode 100644 lib/appwrite/models/column_email.rb delete mode 100644 lib/appwrite/models/column_enum.rb delete mode 100644 lib/appwrite/models/column_float.rb delete mode 100644 lib/appwrite/models/column_index.rb delete mode 100644 lib/appwrite/models/column_index_list.rb delete mode 100644 lib/appwrite/models/column_integer.rb delete mode 100644 lib/appwrite/models/column_ip.rb delete mode 100644 lib/appwrite/models/column_list.rb delete mode 100644 lib/appwrite/models/column_relationship.rb delete mode 100644 lib/appwrite/models/column_string.rb delete mode 100644 lib/appwrite/models/column_url.rb delete mode 100644 lib/appwrite/models/row.rb delete mode 100644 lib/appwrite/models/row_list.rb delete mode 100644 lib/appwrite/models/table.rb delete mode 100644 lib/appwrite/models/table_list.rb delete mode 100644 lib/appwrite/services/tables.rb diff --git a/README.md b/README.md index 10803b5..74b56ca 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.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-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.8.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.7.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 d0a3ea4..3c76b6b 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '17.0.0' + spec.version = '16.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/databases/create-document.md b/docs/examples/databases/create-document.md index ce8dea7..e683108 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -4,9 +4,8 @@ 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 - .set_key('') # Your secret API key - .set_jwt('') # Your secret JSON Web Token databases = Databases.new(client) diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index ecccdf5..16abc5e 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -4,7 +4,7 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_admin('') # + .set_project('') # Your project ID .set_key('') # Your secret API key databases = Databases.new(client) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index d165e1e..2380818 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -4,14 +4,15 @@ 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 - .set_key('') # Your secret API key - .set_jwt('') # Your secret JSON Web Token databases = Databases.new(client) result = databases.upsert_document( database_id: '', collection_id: '', - document_id: '' + document_id: '', + data: {}, + permissions: ["read("any")"] # optional ) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 8e404e6..30c42aa 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -4,12 +4,13 @@ include Appwrite client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_admin('') # + .set_project('') # Your project ID .set_key('') # Your secret API key databases = Databases.new(client) result = databases.upsert_documents( database_id: '', - collection_id: '' + collection_id: '', + documents: [] ) diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md deleted file mode 100644 index 7df3908..0000000 --- a/docs/examples/tables/create-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_boolean_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: false, # optional - array: false # optional -) diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md deleted file mode 100644 index 2d65509..0000000 --- a/docs/examples/tables/create-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_datetime_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: '', # optional - array: false # optional -) diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md deleted file mode 100644 index 01f7ad4..0000000 --- a/docs/examples/tables/create-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_email_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: 'email@example.com', # optional - array: false # optional -) diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md deleted file mode 100644 index 97fcb58..0000000 --- a/docs/examples/tables/create-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_enum_column( - database_id: '', - table_id: '', - key: '', - elements: [], - required: false, - default: '', # optional - array: false # optional -) diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md deleted file mode 100644 index 9df32a3..0000000 --- a/docs/examples/tables/create-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.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/tables/create-index.md b/docs/examples/tables/create-index.md deleted file mode 100644 index 3c8dfdf..0000000 --- a/docs/examples/tables/create-index.md +++ /dev/null @@ -1,21 +0,0 @@ -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 = Tables.new(client) - -result = tables.create_index( - database_id: '', - table_id: '', - key: '', - type: IndexType::KEY, - columns: [], - orders: [], # optional - lengths: [] # optional -) diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md deleted file mode 100644 index d0c5c78..0000000 --- a/docs/examples/tables/create-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.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/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md deleted file mode 100644 index 0c97840..0000000 --- a/docs/examples/tables/create-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_ip_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: '', # optional - array: false # optional -) diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md deleted file mode 100644 index 8f7fb84..0000000 --- a/docs/examples/tables/create-relationship-column.md +++ /dev/null @@ -1,22 +0,0 @@ -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 = Tables.new(client) - -result = tables.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/tables/create-row.md b/docs/examples/tables/create-row.md deleted file mode 100644 index a625249..0000000 --- a/docs/examples/tables/create-row.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_session('') # The user session to authenticate with - .set_key('') # Your secret API key - .set_jwt('') # Your secret JSON Web Token - -tables = Tables.new(client) - -result = tables.create_row( - database_id: '', - table_id: '', - row_id: '', - data: {}, - permissions: ["read("any")"] # optional -) diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md deleted file mode 100644 index 2e78b96..0000000 --- a/docs/examples/tables/create-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_admin('') # - .set_key('') # Your secret API key - -tables = Tables.new(client) - -result = tables.create_rows( - database_id: '', - table_id: '', - rows: [] -) diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md deleted file mode 100644 index d47cf49..0000000 --- a/docs/examples/tables/create-string-column.md +++ /dev/null @@ -1,21 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.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/tables/create-url-column.md b/docs/examples/tables/create-url-column.md deleted file mode 100644 index fcfebac..0000000 --- a/docs/examples/tables/create-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create_url_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: 'https://example.com', # optional - array: false # optional -) diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md deleted file mode 100644 index 5a255fa..0000000 --- a/docs/examples/tables/create.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.create( - database_id: '', - table_id: '', - name: '', - permissions: ["read("any")"], # optional - row_security: false, # optional - enabled: false # optional -) diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md deleted file mode 100644 index e22afcb..0000000 --- a/docs/examples/tables/decrement-row-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.decrement_row_column( - database_id: '', - table_id: '', - row_id: '', - column: '', - value: null, # optional - min: null # optional -) diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md deleted file mode 100644 index 2458640..0000000 --- a/docs/examples/tables/delete-column.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.delete_column( - database_id: '', - table_id: '', - key: '' -) diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md deleted file mode 100644 index 54bd545..0000000 --- a/docs/examples/tables/delete-index.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.delete_index( - database_id: '', - table_id: '', - key: '' -) diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md deleted file mode 100644 index 9841fc2..0000000 --- a/docs/examples/tables/delete-row.md +++ /dev/null @@ -1,16 +0,0 @@ -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 = Tables.new(client) - -result = tables.delete_row( - database_id: '', - table_id: '', - row_id: '' -) diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md deleted file mode 100644 index 7be1e4b..0000000 --- a/docs/examples/tables/delete-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.delete_rows( - database_id: '', - table_id: '', - queries: [] # optional -) diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md deleted file mode 100644 index ca607f2..0000000 --- a/docs/examples/tables/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.delete( - database_id: '', - table_id: '' -) diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md deleted file mode 100644 index 1a1469d..0000000 --- a/docs/examples/tables/get-column.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.get_column( - database_id: '', - table_id: '', - key: '' -) diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md deleted file mode 100644 index 7d762ce..0000000 --- a/docs/examples/tables/get-index.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.get_index( - database_id: '', - table_id: '', - key: '' -) diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md deleted file mode 100644 index 4526bb7..0000000 --- a/docs/examples/tables/get-row.md +++ /dev/null @@ -1,17 +0,0 @@ -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 = Tables.new(client) - -result = tables.get_row( - database_id: '', - table_id: '', - row_id: '', - queries: [] # optional -) diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md deleted file mode 100644 index 22ba02a..0000000 --- a/docs/examples/tables/get.md +++ /dev/null @@ -1,15 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.get( - database_id: '', - table_id: '' -) diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md deleted file mode 100644 index c0a91d4..0000000 --- a/docs/examples/tables/increment-row-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.increment_row_column( - database_id: '', - table_id: '', - row_id: '', - column: '', - value: null, # optional - max: null # optional -) diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md deleted file mode 100644 index 7e85156..0000000 --- a/docs/examples/tables/list-columns.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.list_columns( - database_id: '', - table_id: '', - queries: [] # optional -) diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md deleted file mode 100644 index 0789291..0000000 --- a/docs/examples/tables/list-indexes.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.list_indexes( - database_id: '', - table_id: '', - queries: [] # optional -) diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md deleted file mode 100644 index bc9a0a4..0000000 --- a/docs/examples/tables/list-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -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 = Tables.new(client) - -result = tables.list_rows( - database_id: '', - table_id: '', - queries: [] # optional -) diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md deleted file mode 100644 index 7cf987e..0000000 --- a/docs/examples/tables/list.md +++ /dev/null @@ -1,16 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.list( - database_id: '', - queries: [], # optional - search: '' # optional -) diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md deleted file mode 100644 index a09b365..0000000 --- a/docs/examples/tables/update-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_boolean_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: false, - new_key: '' # optional -) diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md deleted file mode 100644 index 55e0484..0000000 --- a/docs/examples/tables/update-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_datetime_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: '', - new_key: '' # optional -) diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md deleted file mode 100644 index 285cd66..0000000 --- a/docs/examples/tables/update-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_email_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: 'email@example.com', - new_key: '' # optional -) diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md deleted file mode 100644 index 90773ed..0000000 --- a/docs/examples/tables/update-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_enum_column( - database_id: '', - table_id: '', - key: '', - elements: [], - required: false, - default: '', - new_key: '' # optional -) diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md deleted file mode 100644 index 0bb992b..0000000 --- a/docs/examples/tables/update-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.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/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md deleted file mode 100644 index 35f8c47..0000000 --- a/docs/examples/tables/update-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.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/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md deleted file mode 100644 index 2ad1840..0000000 --- a/docs/examples/tables/update-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_ip_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: '', - new_key: '' # optional -) diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md deleted file mode 100644 index de86fd5..0000000 --- a/docs/examples/tables/update-relationship-column.md +++ /dev/null @@ -1,18 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_relationship_column( - database_id: '', - table_id: '', - key: '', - on_delete: RelationMutate::CASCADE, # optional - new_key: '' # optional -) diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md deleted file mode 100644 index 500927d..0000000 --- a/docs/examples/tables/update-row.md +++ /dev/null @@ -1,18 +0,0 @@ -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 = Tables.new(client) - -result = tables.update_row( - database_id: '', - table_id: '', - row_id: '', - data: {}, # optional - permissions: ["read("any")"] # optional -) diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md deleted file mode 100644 index 8cee181..0000000 --- a/docs/examples/tables/update-rows.md +++ /dev/null @@ -1,17 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_rows( - database_id: '', - table_id: '', - data: {}, # optional - queries: [] # optional -) diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md deleted file mode 100644 index 2240f49..0000000 --- a/docs/examples/tables/update-string-column.md +++ /dev/null @@ -1,20 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_string_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: '', - size: 1, # optional - new_key: '' # optional -) diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md deleted file mode 100644 index 0947a78..0000000 --- a/docs/examples/tables/update-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update_url_column( - database_id: '', - table_id: '', - key: '', - required: false, - default: 'https://example.com', - new_key: '' # optional -) diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md deleted file mode 100644 index 003d3d0..0000000 --- a/docs/examples/tables/update.md +++ /dev/null @@ -1,19 +0,0 @@ -require 'appwrite' - -include Appwrite - -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 = Tables.new(client) - -result = tables.update( - database_id: '', - table_id: '', - name: '', - permissions: ["read("any")"], # optional - row_security: false, # optional - enabled: false # optional -) diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md deleted file mode 100644 index d96172e..0000000 --- a/docs/examples/tables/upsert-row.md +++ /dev/null @@ -1,17 +0,0 @@ -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_session('') # The user session to authenticate with - .set_key('') # Your secret API key - .set_jwt('') # Your secret JSON Web Token - -tables = Tables.new(client) - -result = tables.upsert_row( - database_id: '', - table_id: '', - row_id: '' -) diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md deleted file mode 100644 index 8987b1e..0000000 --- a/docs/examples/tables/upsert-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -require 'appwrite' - -include Appwrite - -client = Client.new - .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint - .set_admin('') # - .set_key('') # Your secret API key - -tables = Tables.new(client) - -result = tables.upsert_rows( - database_id: '', - table_id: '' -) diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 0e6e87a..e80df28 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -12,13 +12,10 @@ 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' @@ -60,21 +57,7 @@ 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' @@ -155,7 +138,6 @@ require_relative 'appwrite/services/account' require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/databases' -require_relative 'appwrite/services/tables' require_relative 'appwrite/services/functions' require_relative 'appwrite/services/graphql' require_relative 'appwrite/services/health' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 85cb454..2158e4c 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'=> '17.0.0', - 'X-Appwrite-Response-Format' => '1.8.0' + 'x-sdk-version'=> '16.0.0', + 'X-Appwrite-Response-Format' => '1.7.0' } @endpoint = 'https://cloud.appwrite.io/v1' end diff --git a/lib/appwrite/models/column_boolean.rb b/lib/appwrite/models/column_boolean.rb deleted file mode 100644 index e74c7c6..0000000 --- a/lib/appwrite/models/column_boolean.rb +++ /dev/null @@ -1,67 +0,0 @@ -#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 deleted file mode 100644 index 2d17155..0000000 --- a/lib/appwrite/models/column_datetime.rb +++ /dev/null @@ -1,72 +0,0 @@ -#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 deleted file mode 100644 index 889c8ca..0000000 --- a/lib/appwrite/models/column_email.rb +++ /dev/null @@ -1,72 +0,0 @@ -#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 deleted file mode 100644 index 3d3c2c2..0000000 --- a/lib/appwrite/models/column_enum.rb +++ /dev/null @@ -1,77 +0,0 @@ -#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 deleted file mode 100644 index e859909..0000000 --- a/lib/appwrite/models/column_float.rb +++ /dev/null @@ -1,77 +0,0 @@ -#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 deleted file mode 100644 index 0336418..0000000 --- a/lib/appwrite/models/column_index.rb +++ /dev/null @@ -1,67 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class ColumnIndex - attr_reader :key - attr_reader :type - attr_reader :status - attr_reader :error - attr_reader :columns - attr_reader :lengths - attr_reader :orders - attr_reader :created_at - attr_reader :updated_at - - def initialize( - key:, - type:, - status:, - error:, - columns:, - lengths:, - orders: , - created_at:, - updated_at: - ) - @key = key - @type = type - @status = status - @error = error - @columns = columns - @lengths = lengths - @orders = orders - @created_at = created_at - @updated_at = updated_at - end - - def self.from(map:) - ColumnIndex.new( - key: map["key"], - type: map["type"], - status: map["status"], - error: map["error"], - columns: map["columns"], - lengths: map["lengths"], - orders: map["orders"], - created_at: map["$createdAt"], - updated_at: map["$updatedAt"] - ) - end - - def to_map - { - "key": @key, - "type": @type, - "status": @status, - "error": @error, - "columns": @columns, - "lengths": @lengths, - "orders": @orders, - "$createdAt": @created_at, - "$updatedAt": @updated_at - } - end - end - end -end diff --git a/lib/appwrite/models/column_index_list.rb b/lib/appwrite/models/column_index_list.rb deleted file mode 100644 index 8543887..0000000 --- a/lib/appwrite/models/column_index_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#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 deleted file mode 100644 index 5253124..0000000 --- a/lib/appwrite/models/column_integer.rb +++ /dev/null @@ -1,77 +0,0 @@ -#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 deleted file mode 100644 index 9c5df3f..0000000 --- a/lib/appwrite/models/column_ip.rb +++ /dev/null @@ -1,72 +0,0 @@ -#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 deleted file mode 100644 index b01f858..0000000 --- a/lib/appwrite/models/column_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#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 deleted file mode 100644 index 59a6823..0000000 --- a/lib/appwrite/models/column_relationship.rb +++ /dev/null @@ -1,92 +0,0 @@ -#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 deleted file mode 100644 index daa52c1..0000000 --- a/lib/appwrite/models/column_string.rb +++ /dev/null @@ -1,77 +0,0 @@ -#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 deleted file mode 100644 index 6969853..0000000 --- a/lib/appwrite/models/column_url.rb +++ /dev/null @@ -1,72 +0,0 @@ -#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/row.rb b/lib/appwrite/models/row.rb deleted file mode 100644 index 79c1315..0000000 --- a/lib/appwrite/models/row.rb +++ /dev/null @@ -1,66 +0,0 @@ -#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 deleted file mode 100644 index 26e676b..0000000 --- a/lib/appwrite/models/row_list.rb +++ /dev/null @@ -1,36 +0,0 @@ -#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 deleted file mode 100644 index 89da503..0000000 --- a/lib/appwrite/models/table.rb +++ /dev/null @@ -1,72 +0,0 @@ -#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 deleted file mode 100644 index 9c8d0ac..0000000 --- a/lib/appwrite/models/table_list.rb +++ /dev/null @@ -1,32 +0,0 @@ -#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/services/account.rb b/lib/appwrite/services/account.rb index 5ce86e0..2446c08 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -909,9 +909,6 @@ 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. @@ -950,9 +947,6 @@ 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. diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 74fe4e9..9e78f69 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -172,9 +172,6 @@ def delete(database_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.list` instead. - # # Get a list of all collections that belong to the provided databaseId. You # can use the search parameter to filter your results. # @@ -209,9 +206,6 @@ def list_collections(database_id:, queries: nil, search: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.create` 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) @@ -263,9 +257,6 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.get` instead. - # # Get a collection by its unique ID. This endpoint response returns a JSON # object with the collection metadata. # @@ -302,9 +293,6 @@ def get_collection(database_id:, collection_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.update` instead. - # # Update a collection by its unique ID. # # @param [String] database_id Database ID. @@ -353,9 +341,6 @@ def update_collection(database_id:, collection_id:, name:, permissions: nil, doc end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.delete` instead. - # # Delete a collection by its unique ID. Only users with write permissions # have access to delete this resource. # @@ -392,13 +377,10 @@ def delete_collection(database_id:, collection_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listColumns` instead. - # # List attributes in the collection. # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error # # @return [AttributeList] @@ -432,14 +414,11 @@ def list_attributes(database_id:, collection_id:, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createBooleanColumn` instead. - # # Create a boolean attribute. # # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -488,14 +467,11 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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#createCollection). + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -548,13 +524,10 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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#createCollection). + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key 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. @@ -603,14 +576,11 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -663,14 +633,11 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEmailColumn` instead. - # # Create an email attribute. # # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -719,19 +686,16 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key 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) @@ -780,17 +744,14 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEnumColumn` instead. - # - # Create an enum attribute. The `elements` param acts as a white-list of - # accepted values for this attribute. + # Create an enumeration 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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. - # @param [Array] elements Array of enum values. + # @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 [] 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? @@ -843,20 +804,17 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. - # @param [Array] elements Updated list of enum values. + # @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 [] 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) @@ -910,20 +868,17 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Float] min Minimum value. - # @param [Float] max Maximum value. - # @param [Float] default Default value. Cannot be set when 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 [] array Is attribute an array? # # @return [AttributeFloat] @@ -971,21 +926,18 @@ 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 `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute 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 Attribute Key. + # @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. # # @return [AttributeFloat] def update_float_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) @@ -1036,20 +988,17 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, defaul end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [Integer] min Minimum value - # @param [Integer] max Maximum value - # @param [Integer] default Default value. 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 [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required. # @param [] array Is attribute an array? # # @return [AttributeInteger] @@ -1097,21 +1046,18 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @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. + # @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. # # @return [AttributeInteger] def update_integer_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil) @@ -1162,17 +1108,14 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, defa end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIpColumn` instead. - # # Create IP address attribute. # # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [String] default Default value. Cannot be set when attribute is required. + # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. # @param [] array Is attribute an array? # # @return [AttributeIp] @@ -1218,19 +1161,16 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? - # @param [String] default Default value. Cannot be set when attribute is required. - # @param [String] new_key New Attribute Key. + # @param [String] default Default value for attribute when not provided. 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) @@ -1279,16 +1219,13 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. - # @param [String] related_collection_id Related Collection 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 [RelationshipType] type Relation type # @param [] two_way Is Two Way? # @param [String] key Attribute Key. @@ -1340,14 +1277,11 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createStringColumn` instead. - # # Create a string attribute. # # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [Integer] size Attribute size for text attributes, in number of characters. # @param [] required Is attribute required? @@ -1404,20 +1338,17 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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 table 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#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) @@ -1467,14 +1398,11 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createUrlColumn` instead. - # # Create a URL attribute. # # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # @param [] required Is attribute required? # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required. @@ -1523,19 +1451,16 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key 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) @@ -1584,13 +1509,10 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getColumn` instead. - # # Get attribute by ID. # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # # @return [] @@ -1627,13 +1549,10 @@ def get_attribute(database_id:, collection_id:, key:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteColumn` instead. - # # Deletes an attribute. # # @param [String] database_id Database ID. - # @param [String] collection_id Collection ID. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key Attribute Key. # # @return [] @@ -1671,18 +1590,15 @@ def delete_attribute(database_id:, collection_id:, key:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. + # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). # @param [String] key 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) @@ -1722,9 +1638,6 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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. # @@ -1763,9 +1676,6 @@ def list_documents(database_id:, collection_id:, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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) @@ -1819,9 +1729,6 @@ def create_document(database_id:, collection_id:, document_id:, data:, permissio end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. - # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1871,9 +1778,6 @@ def create_documents(database_id:, collection_id:, documents:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead. - # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1886,9 +1790,10 @@ def create_documents(database_id:, collection_id:, documents:) # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. + # @param [Array] documents Array of document data as JSON objects. May contain partial documents. # # @return [DocumentList] - def upsert_documents(database_id:, collection_id:) + def upsert_documents(database_id:, collection_id:, documents:) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -1901,7 +1806,12 @@ def upsert_documents(database_id:, collection_id:) raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end + if documents.nil? + raise Appwrite::Exception.new('Missing required parameter: "documents"') + end + api_params = { + documents: documents, } api_headers = { @@ -1918,9 +1828,6 @@ def upsert_documents(database_id:, collection_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead. - # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -1967,9 +1874,6 @@ def update_documents(database_id:, collection_id:, data: nil, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead. - # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -2013,9 +1917,6 @@ def delete_documents(database_id:, collection_id:, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead. - # # Get a document by its unique ID. This endpoint response returns a JSON # object with the document data. # @@ -2060,9 +1961,6 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead. - # # **WARNING: Experimental Feature** - This endpoint is experimental and not # yet officially supported. It may be subject to breaking changes or removal # in future versions. @@ -2075,9 +1973,11 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [String] document_id Document ID. + # @param [Hash] data Document data as JSON object. Include all required attributes of the document to be created or updated. + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [Document] - def upsert_document(database_id:, collection_id:, document_id:) + def upsert_document(database_id:, collection_id:, document_id:, data:, permissions: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) @@ -2095,7 +1995,13 @@ def upsert_document(database_id:, collection_id:, document_id:) raise Appwrite::Exception.new('Missing required parameter: "documentId"') end + if data.nil? + raise Appwrite::Exception.new('Missing required parameter: "data"') + end + api_params = { + data: data, + permissions: permissions, } api_headers = { @@ -2112,9 +2018,6 @@ def upsert_document(database_id:, collection_id:, document_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead. - # # Update a document by its unique ID. Using the patch method you can pass # only specific fields that will get updated. # @@ -2162,9 +2065,6 @@ 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 `Tables.deleteRow` instead. - # # Delete a document by its unique ID. # # @param [String] database_id Database ID. @@ -2206,16 +2106,13 @@ def delete_document(database_id:, collection_id:, document_id:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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 increment the attribute by. The value must be a number. + # @param [Float] value Value to decrement the attribute by. The value must be a number. # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. # # @return [Document] @@ -2261,9 +2158,6 @@ def decrement_document_attribute(database_id:, collection_id:, document_id:, att end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead. - # # Increment a specific attribute of a document by a given value. # # @param [String] database_id Database ID. @@ -2316,9 +2210,6 @@ def increment_document_attribute(database_id:, collection_id:, document_id:, att end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listIndexes` instead. - # # List indexes in the collection. # # @param [String] database_id Database ID. @@ -2356,9 +2247,6 @@ def list_indexes(database_id:, collection_id:, queries: nil) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.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`. @@ -2419,9 +2307,6 @@ def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getIndex` instead. - # # Get index by ID. # # @param [String] database_id Database ID. @@ -2463,9 +2348,6 @@ def get_index(database_id:, collection_id:, key:) end - # - # @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead. - # # Delete an index. # # @param [String] database_id Database ID. diff --git a/lib/appwrite/services/tables.rb b/lib/appwrite/services/tables.rb deleted file mode 100644 index 607a725..0000000 --- a/lib/appwrite/services/tables.rb +++ /dev/null @@ -1,2192 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - class Tables < Service - - def initialize(client) - @client = client - 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 attributes: name, enabled, rowSecurity - # @param [String] search Search term to filter your list results. Max length: 256 chars. - # - # @return [TableList] - def list(database_id:, queries: nil, search: nil) - api_path = '/databases/{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/databases#databasesCreateTable) - # 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(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) - api_path = '/databases/{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(database_id:, table_id:) - api_path = '/databases/{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(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) - api_path = '/databases/{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(database_id:, table_id:) - api_path = '/databases/{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 attributes in the collection. - # - # @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 attributes: key, type, size, required, array, status, error - # - # @return [ColumnList] - def list_columns(database_id:, table_id:, queries: nil) - api_path = '/databases/{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/tables#tablesCreate). - # @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 = '/databases/{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/tables#tablesCreate). - # @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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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/tables#tablesCreate). - # @param [String] key Column Key. - # @param [Integer] size Attribute size for text attributes, 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 = '/databases/{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/tables#tablesCreate). - # @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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 = '/databases/{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 in the collection. - # - # @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/tables#tablesCreate). - # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error - # - # @return [ColumnIndexList] - def list_indexes(database_id:, table_id:, queries: nil) - api_path = '/databases/{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 attributes listed. Your index should include all - # the attributes you will query in a single request. - # Attributes can be `key`, `fulltext`, and `unique`. - # - # @param [String] database_id Database ID. - # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - # @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 = '/databases/{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/tables#tablesCreate). - # @param [String] key Index Key. - # - # @return [ColumnIndex] - def get_index(database_id:, table_id:, key:) - api_path = '/databases/{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/tables#tablesCreate). - # @param [String] key Index Key. - # - # @return [] - def delete_index(database_id:, table_id:, key:) - api_path = '/databases/{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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - # @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 = '/databases/{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/databases#databasesCreateTable) - # 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/tables#tablesCreate). 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 = '/databases/{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/databases#databasesCreateTable) - # 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/tables#tablesCreate). 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 = '/databases/{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/databases#databasesCreateTable) - # API or directly from your database console. - # - # - # @param [String] database_id Database ID. - # @param [String] table_id Table ID. - # - # @return [RowList] - def upsert_rows(database_id:, table_id:) - api_path = '/databases/{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 = { - } - - 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 = '/databases/{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/tables#tablesCreate). - # @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 = '/databases/{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/tables#tablesCreate). - # @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 = '/databases/{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/databases#databasesCreateTable) - # 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. - # - # @return [Row] - def upsert_row(database_id:, table_id:, row_id:) - api_path = '/databases/{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: '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 = '/databases/{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/tables#tablesCreate). - # @param [String] row_id Row ID. - # - # @return [] - def delete_row(database_id:, table_id:, row_id:) - api_path = '/databases/{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 = '/databases/{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 = '/databases/{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 From ca3bdd09599a4f168f62f092359121822ee534db Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jul 2025 10:47:00 +0000 Subject: [PATCH 4/4] add changelog --- CHANGELOG.md | 31 ++++++++++++++++++++++++++++++- appwrite.gemspec | 2 +- lib/appwrite/client.rb | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..1f2e10b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,30 @@ -# Change Log \ No newline at end of file +# Change Log + +## 16.1.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Add `dart38` and `flutter332` support to runtime models +* Add `gif` support to `ImageFormat` enum +* Add `encrypt` support to `StringAttribute` model +* Add `sequence` support to `Document` model +* Add `upsertDocument` support to `Databases` service + +## 16.0.0 + +* Add `` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Remove `search` param from `listExecutions` method + +## 15.0.0 + +* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests + +## 14.0.0 + +* Fix pong response & chunked upload diff --git a/appwrite.gemspec b/appwrite.gemspec index 3c76b6b..99c8f2d 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '16.0.0' + spec.version = '16.1.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/lib/appwrite/client.rb b/lib/appwrite/client.rb index 2158e4c..6a8c307 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '16.0.0', + 'x-sdk-version'=> '16.1.0', 'X-Appwrite-Response-Format' => '1.7.0' } @endpoint = 'https://cloud.appwrite.io/v1'