diff --git a/CHANGELOG.md b/CHANGELOG.md index 272f9b6..61856a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 20.1.0 + +* Added ability to create columns and indexes synchronously while creating a table + ## 20.0.0 * Rename `VCSDeploymentType` enum to `VCSReferenceType` diff --git a/appwrite.gemspec b/appwrite.gemspec index 13565d4..9b7c7d8 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '20.0.0' + spec.version = '20.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/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index bcb25d6..d24b239 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index be5fc1c..d38a7c3 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index d75e310..6fb295c 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 8e5b6b7..682c247 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 9537d1f..ea19378 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index ba34779..e5da228 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -6,6 +6,7 @@ include Appwrite::Enums 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 account = Account.new(client) diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 52bc5d6..60543c9 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -6,6 +6,7 @@ include Appwrite::Enums 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 account = Account.new(client) diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 81bedd0..d1f2e1e 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 4b8ce21..6d606b5 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 84228b8..259e25e 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index c96820f..27257c8 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index b81c485..307b9a3 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -5,6 +5,7 @@ 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 account = Account.new(client) diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 178b5a5..ab6233c 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -17,5 +17,7 @@ result = databases.create_collection( name: '', permissions: [Permission.read(Role.any())], # optional document_security: false, # optional - enabled: false # optional + enabled: false, # optional + attributes: [], # optional + indexes: [] # optional ) diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index 6a1a0e9..ba09b9d 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -17,5 +17,7 @@ result = tables_db.create_table( name: '', permissions: [Permission.read(Role.any())], # optional row_security: false, # optional - enabled: false # optional + enabled: false, # optional + columns: [], # optional + indexes: [] # optional ) diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index b47f296..bc09ceb 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'=> '20.0.0', + 'x-sdk-version'=> '20.1.0', 'X-Appwrite-Response-Format' => '1.8.0' } @endpoint = 'https://cloud.appwrite.io/v1' diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 1ebbc5e..0c01f9a 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -405,9 +405,11 @@ def list_collections(database_id:, queries: nil, search: nil, total: nil) # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Collection] - def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) + def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil, attributes: nil, indexes: nil) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) @@ -429,6 +431,8 @@ def create_collection(database_id:, collection_id:, name:, permissions: nil, doc permissions: permissions, documentSecurity: document_security, enabled: enabled, + attributes: attributes, + indexes: indexes, } api_headers = { diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 09457ca..4c657ab 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -384,9 +384,11 @@ def list_tables(database_id:, queries: nil, search: nil, total: nil) # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] row_security Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + # @param [Array] columns Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). # # @return [Table] - def create_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil) + def create_table(database_id:, table_id:, name:, permissions: nil, row_security: nil, enabled: nil, columns: nil, indexes: nil) api_path = '/tablesdb/{databaseId}/tables' .gsub('{databaseId}', database_id) @@ -408,6 +410,8 @@ def create_table(database_id:, table_id:, name:, permissions: nil, row_security: permissions: permissions, rowSecurity: row_security, enabled: enabled, + columns: columns, + indexes: indexes, } api_headers = {