From 48a3bf0460e27f08d18f55126a1a81af95d8fecc Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 01:31:07 +1200 Subject: [PATCH 1/6] Add time between queries --- appwrite.gemspec | 2 +- .../databases/create-line-attribute.md | 18 + .../databases/create-point-attribute.md | 18 + .../databases/create-polygon-attribute.md | 18 + .../databases/update-line-attribute.md | 19 ++ .../databases/update-point-attribute.md | 19 ++ .../databases/update-polygon-attribute.md | 19 ++ docs/examples/tablesdb/create-line-column.md | 18 + docs/examples/tablesdb/create-point-column.md | 18 + .../tablesdb/create-polygon-column.md | 18 + docs/examples/tablesdb/update-line-column.md | 19 ++ docs/examples/tablesdb/update-point-column.md | 19 ++ .../tablesdb/update-polygon-column.md | 19 ++ lib/appwrite.rb | 6 + lib/appwrite/client.rb | 2 +- lib/appwrite/enums/credit_card.rb | 2 +- lib/appwrite/enums/execution_method.rb | 1 + lib/appwrite/enums/index_type.rb | 1 + lib/appwrite/models/attribute_line.rb | 67 ++++ lib/appwrite/models/attribute_point.rb | 67 ++++ lib/appwrite/models/attribute_polygon.rb | 67 ++++ lib/appwrite/models/column_line.rb | 67 ++++ lib/appwrite/models/column_point.rb | 67 ++++ lib/appwrite/models/column_polygon.rb | 67 ++++ lib/appwrite/query.rb | 8 + lib/appwrite/services/account.rb | 4 +- lib/appwrite/services/avatars.rb | 2 +- lib/appwrite/services/databases.rb | 323 +++++++++++++++++- lib/appwrite/services/functions.rb | 2 +- lib/appwrite/services/tables_db.rb | 303 ++++++++++++++++ 30 files changed, 1272 insertions(+), 8 deletions(-) create mode 100644 docs/examples/databases/create-line-attribute.md create mode 100644 docs/examples/databases/create-point-attribute.md create mode 100644 docs/examples/databases/create-polygon-attribute.md create mode 100644 docs/examples/databases/update-line-attribute.md create mode 100644 docs/examples/databases/update-point-attribute.md create mode 100644 docs/examples/databases/update-polygon-attribute.md create mode 100644 docs/examples/tablesdb/create-line-column.md create mode 100644 docs/examples/tablesdb/create-point-column.md create mode 100644 docs/examples/tablesdb/create-polygon-column.md create mode 100644 docs/examples/tablesdb/update-line-column.md create mode 100644 docs/examples/tablesdb/update-point-column.md create mode 100644 docs/examples/tablesdb/update-polygon-column.md create mode 100644 lib/appwrite/models/attribute_line.rb create mode 100644 lib/appwrite/models/attribute_point.rb create mode 100644 lib/appwrite/models/attribute_polygon.rb create mode 100644 lib/appwrite/models/column_line.rb create mode 100644 lib/appwrite/models/column_point.rb create mode 100644 lib/appwrite/models/column_polygon.rb diff --git a/appwrite.gemspec b/appwrite.gemspec index d0a3ea4..8f2ac76 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 = '17.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-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 0000000..7980973 --- /dev/null +++ b/docs/examples/databases/create-line-attribute.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 + +databases = Databases.new(client) + +result = databases.create_line_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md new file mode 100644 index 0000000..1e852a7 --- /dev/null +++ b/docs/examples/databases/create-point-attribute.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 + +databases = Databases.new(client) + +result = databases.create_point_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md new file mode 100644 index 0000000..a939980 --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.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 + +databases = Databases.new(client) + +result = databases.create_polygon_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md new file mode 100644 index 0000000..34bfd9a --- /dev/null +++ b/docs/examples/databases/update-line-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.update_line_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md new file mode 100644 index 0000000..bc33d4d --- /dev/null +++ b/docs/examples/databases/update-point-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.update_point_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md new file mode 100644 index 0000000..04a3d9e --- /dev/null +++ b/docs/examples/databases/update-polygon-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.update_polygon_attribute( + database_id: '', + collection_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md new file mode 100644 index 0000000..e70b211 --- /dev/null +++ b/docs/examples/tablesdb/create-line-column.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_line_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md new file mode 100644 index 0000000..5f2e046 --- /dev/null +++ b/docs/examples/tablesdb/create-point-column.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_point_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md new file mode 100644 index 0000000..86a1852 --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.create_polygon_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '' # optional +) diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md new file mode 100644 index 0000000..7f71e18 --- /dev/null +++ b/docs/examples/tablesdb/update-line-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_line_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md new file mode 100644 index 0000000..ee32b54 --- /dev/null +++ b/docs/examples/tablesdb/update-point-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_point_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md new file mode 100644 index 0000000..48c68a1 --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +tables_db = TablesDB.new(client) + +result = tables_db.update_polygon_column( + database_id: '', + table_id: '', + key: '', + required: false, + default: '', # optional + new_key: '' # optional +) diff --git a/lib/appwrite.rb b/lib/appwrite.rb index 5ed20fd..616b0fe 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -60,6 +60,9 @@ require_relative 'appwrite/models/attribute_url' require_relative 'appwrite/models/attribute_datetime' require_relative 'appwrite/models/attribute_relationship' +require_relative 'appwrite/models/attribute_point' +require_relative 'appwrite/models/attribute_line' +require_relative 'appwrite/models/attribute_polygon' require_relative 'appwrite/models/table' require_relative 'appwrite/models/column_list' require_relative 'appwrite/models/column_string' @@ -72,6 +75,9 @@ require_relative 'appwrite/models/column_url' require_relative 'appwrite/models/column_datetime' require_relative 'appwrite/models/column_relationship' +require_relative 'appwrite/models/column_point' +require_relative 'appwrite/models/column_line' +require_relative 'appwrite/models/column_polygon' require_relative 'appwrite/models/index' require_relative 'appwrite/models/column_index' require_relative 'appwrite/models/row' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 85cb454..1b9842a 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'=> '17.0.0', + 'x-sdk-version'=> '17.1.0', 'X-Appwrite-Response-Format' => '1.8.0' } @endpoint = 'https://cloud.appwrite.io/v1' diff --git a/lib/appwrite/enums/credit_card.rb b/lib/appwrite/enums/credit_card.rb index f820982..137bbfc 100644 --- a/lib/appwrite/enums/credit_card.rb +++ b/lib/appwrite/enums/credit_card.rb @@ -13,7 +13,7 @@ module CreditCard MASTERCARD = 'mastercard' NARANJA = 'naranja' TARJETA_SHOPPING = 'targeta-shopping' - UNION_CHINA_PAY = 'union-china-pay' + UNION_PAY = 'unionpay' VISA = 'visa' MIR = 'mir' MAESTRO = 'maestro' diff --git a/lib/appwrite/enums/execution_method.rb b/lib/appwrite/enums/execution_method.rb index 5a16650..2e81029 100644 --- a/lib/appwrite/enums/execution_method.rb +++ b/lib/appwrite/enums/execution_method.rb @@ -7,6 +7,7 @@ module ExecutionMethod PATCH = 'PATCH' DELETE = 'DELETE' OPTIONS = 'OPTIONS' + HEAD = 'HEAD' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/index_type.rb b/lib/appwrite/enums/index_type.rb index 00f666e..4b95167 100644 --- a/lib/appwrite/enums/index_type.rb +++ b/lib/appwrite/enums/index_type.rb @@ -4,6 +4,7 @@ module IndexType KEY = 'key' FULLTEXT = 'fulltext' UNIQUE = 'unique' + SPATIAL = 'spatial' end end end \ No newline at end of file diff --git a/lib/appwrite/models/attribute_line.rb b/lib/appwrite/models/attribute_line.rb new file mode 100644 index 0000000..89f04fd --- /dev/null +++ b/lib/appwrite/models/attribute_line.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AttributeLine + 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:) + AttributeLine.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/attribute_point.rb b/lib/appwrite/models/attribute_point.rb new file mode 100644 index 0000000..d985fe4 --- /dev/null +++ b/lib/appwrite/models/attribute_point.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AttributePoint + 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:) + AttributePoint.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/attribute_polygon.rb b/lib/appwrite/models/attribute_polygon.rb new file mode 100644 index 0000000..0d511aa --- /dev/null +++ b/lib/appwrite/models/attribute_polygon.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class AttributePolygon + 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:) + AttributePolygon.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_line.rb b/lib/appwrite/models/column_line.rb new file mode 100644 index 0000000..70382e8 --- /dev/null +++ b/lib/appwrite/models/column_line.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnLine + 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:) + ColumnLine.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_point.rb b/lib/appwrite/models/column_point.rb new file mode 100644 index 0000000..704847f --- /dev/null +++ b/lib/appwrite/models/column_point.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnPoint + 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:) + ColumnPoint.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_polygon.rb b/lib/appwrite/models/column_polygon.rb new file mode 100644 index 0000000..5deca32 --- /dev/null +++ b/lib/appwrite/models/column_polygon.rb @@ -0,0 +1,67 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ColumnPolygon + 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:) + ColumnPolygon.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/query.rb b/lib/appwrite/query.rb index ad3c7f3..a9fd28b 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -136,6 +136,10 @@ def created_after(value) return Query.new("createdAfter", nil, value).to_s end + def created_between(start, ending) + return Query.new("createdBetween", nil, [start, ending]).to_s + end + def updated_before(value) return Query.new("updatedBefore", nil, value).to_s end @@ -144,6 +148,10 @@ def updated_after(value) return Query.new("updatedAfter", nil, value).to_s end + def updated_between(start, ending) + return Query.new("updatedBetween", nil, [start, ending]).to_s + end + def or(queries) return Query.new("or", nil, queries.map { |query| JSON.parse(query) }).to_s end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 6470297..5e281fb 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -882,7 +882,7 @@ def create_email_password_session(email:, password:) end # - # @deprecated This API has been deprecated. + # @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. # # Use this endpoint to create a session from token. Provide the **userId** # and **secret** parameters from the successful response of authentication @@ -922,7 +922,7 @@ def update_magic_url_session(user_id:, secret:) end # - # @deprecated This API has been deprecated. + # @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. # # Use this endpoint to create a session from token. Provide the **userId** # and **secret** parameters from the successful response of authentication diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index 04afade..657b271 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -59,7 +59,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil) # of image returned is 100x100px. # # - # @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay. + # @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100. # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100. # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 69de399..44c4f0c 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -38,7 +38,7 @@ def list(queries: nil, search: nil) end # - # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatabase` instead. + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. # # Create a new Database. # @@ -1269,6 +1269,327 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, ) end + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. + # + # Create a geometric line 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # + # @return [AttributeLine] + def create_line_attribute(database_id:, collection_id:, key:, required:, default: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::AttributeLine + ) + end + + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. + # + # Update a line 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [String] new_key New attribute key. + # + # @return [AttributeLine] + def update_line_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + 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::AttributeLine + ) + end + + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + # + # Create a geometric 2d point 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # + # @return [AttributePoint] + def create_point_attribute(database_id:, collection_id:, key:, required:, default: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::AttributePoint + ) + end + + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + # + # Update a point 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [String] new_key New attribute key. + # + # @return [AttributePoint] + def update_point_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + 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::AttributePoint + ) + end + + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + # + # Create a geometric polygon 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # + # @return [AttributePolygon] + def create_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + end + + api_params = { + key: key, + required: required, + default: default, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::AttributePolygon + ) + end + + # + # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + # + # Update a polygon 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] key Attribute Key. + # @param [] required Is attribute required? + # @param [String] default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [String] new_key New attribute key. + # + # @return [AttributePolygon] + def update_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil, new_key: nil) + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' + .gsub('{databaseId}', database_id) + .gsub('{collectionId}', collection_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + end + + if collection_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "collectionId"') + end + + if key.nil? + raise Appwrite::Exception.new('Missing required parameter: "key"') + end + + if required.nil? + raise Appwrite::Exception.new('Missing required parameter: "required"') + 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::AttributePolygon + ) + end + # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. # diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index 5f04c88..13b0526 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -732,7 +732,7 @@ def list_executions(function_id:, queries: nil) # @param [String] body HTTP body of execution. Default value is empty string. # @param [] async Execute code in the background. Default value is false. # @param [String] xpath HTTP path of execution. Path can include query params. Default value is / - # @param [ExecutionMethod] method HTTP method of execution. Default value is GET. + # @param [ExecutionMethod] method HTTP method of execution. Default value is POST. # @param [Hash] headers HTTP headers of execution. Defaults to empty. # @param [String] scheduled_at Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. # diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 5544fba..266dd5b 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -1193,6 +1193,309 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key ) end + # Create a geometric line attribute. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # + # @return [ColumnLine] + def create_line_column(database_id:, table_id:, key:, required:, default: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnLine + ) + end + + # Update a line column. Changing the `default` value will not update already + # existing documents. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnLine] + def update_line_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 = { + 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::ColumnLine + ) + end + + # Create a geometric point attribute. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # + # @return [ColumnPoint] + def create_point_column(database_id:, table_id:, key:, required:, default: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnPoint + ) + end + + # Update a point column. Changing the `default` value will not update already + # existing documents. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnPoint] + def update_point_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 = { + 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::ColumnPoint + ) + end + + # Create a geometric polygon attribute. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # + # @return [ColumnPolygon] + def create_polygon_column(database_id:, table_id:, key:, required:, default: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'POST', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ColumnPolygon + ) + end + + # Update a polygon column. Changing the `default` value will not update + # already existing documents. + # + # @param [String] database_id Database ID. + # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + # @param [String] key Column Key. + # @param [] required Is column required? + # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [String] new_key New Column Key. + # + # @return [ColumnPolygon] + def update_polygon_column(database_id:, table_id:, key:, required:, default: nil, new_key: nil) + api_path = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' + .gsub('{databaseId}', database_id) + .gsub('{tableId}', table_id) + .gsub('{key}', key) + + if database_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "databaseId"') + 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 = { + 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::ColumnPolygon + ) + end + # Create relationship column. [Learn more about relationship # columns](https://appwrite.io/docs/databases-relationships#relationship-columns). # From a628ff97a97ddec76589717b6db70632eeb45ebc Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 02:15:13 +1200 Subject: [PATCH 2/6] Update version --- appwrite.gemspec | 2 +- lib/appwrite/client.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appwrite.gemspec b/appwrite.gemspec index 8f2ac76..4b4c05c 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '17.1.0' + spec.version = '18.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/lib/appwrite/client.rb b/lib/appwrite/client.rb index 1b9842a..6a0233e 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'=> '17.1.0', + 'x-sdk-version'=> '18.0.0', 'X-Appwrite-Response-Format' => '1.8.0' } @endpoint = 'https://cloud.appwrite.io/v1' From 073415bd32c94042cb686cdf9f7e07c7a120bbbd Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 21:41:39 +1200 Subject: [PATCH 3/6] Add spatial queries --- lib/appwrite/query.rb | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index a9fd28b..e223b27 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -159,6 +159,54 @@ def or(queries) def and(queries) return Query.new("and", nil, queries.map { |query| JSON.parse(query) }).to_s end + + def distance_equal(attribute, values, distance, meters = true) + return Query.new("distanceEqual", attribute, [values, distance, meters]).to_s + end + + def distance_not_equal(attribute, values, distance, meters = true) + return Query.new("distanceNotEqual", attribute, [values, distance, meters]).to_s + end + + def distance_greater_than(attribute, values, distance, meters = true) + return Query.new("distanceGreaterThan", attribute, [values, distance, meters]).to_s + end + + def distance_less_than(attribute, values, distance, meters = true) + return Query.new("distanceLessThan", attribute, [values, distance, meters]).to_s + end + + def intersects(attribute, values) + return Query.new("intersects", attribute, values).to_s + end + + def not_intersects(attribute, values) + return Query.new("notIntersects", attribute, values).to_s + end + + def crosses(attribute, values) + return Query.new("crosses", attribute, values).to_s + end + + def not_crosses(attribute, values) + return Query.new("notCrosses", attribute, values).to_s + end + + def overlaps(attribute, values) + return Query.new("overlaps", attribute, values).to_s + end + + def not_overlaps(attribute, values) + return Query.new("notOverlaps", attribute, values).to_s + end + + def touches(attribute, values) + return Query.new("touches", attribute, values).to_s + end + + def not_touches(attribute, values) + return Query.new("notTouches", attribute, values).to_s + end end end end \ No newline at end of file From d573b1519bdf24fb685bf210d1d2b47f6f657065 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 22:01:43 +1200 Subject: [PATCH 4/6] Fix refs --- lib/appwrite/services/databases.rb | 2 +- lib/appwrite/services/tables_db.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 44c4f0c..01c8b55 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -1379,7 +1379,7 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default # # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. # - # Create a geometric 2d point attribute. + # Create a geometric point 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). diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 266dd5b..2d0225d 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -1193,7 +1193,7 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key ) end - # Create a geometric line attribute. + # Create a geometric line column. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1243,7 +1243,7 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) end # Update a line column. Changing the `default` value will not update already - # existing documents. + # existing rows. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1294,7 +1294,7 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n ) end - # Create a geometric point attribute. + # Create a geometric point column. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1344,7 +1344,7 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) end # Update a point column. Changing the `default` value will not update already - # existing documents. + # existing rows. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1395,7 +1395,7 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, ) end - # Create a geometric polygon attribute. + # Create a geometric polygon column. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1445,7 +1445,7 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil end # Update a polygon column. Changing the `default` value will not update - # already existing documents. + # already existing rows. # # @param [String] database_id Database ID. # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). From 8d9c0829c759c1f4d87876c863e14299d65c9e5a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 6 Sep 2025 04:58:03 +1200 Subject: [PATCH 5/6] Fix spatial default --- docs/examples/account/update-prefs.md | 6 +++++- docs/examples/databases/create-document.md | 8 +++++++- docs/examples/databases/create-line-attribute.md | 2 +- docs/examples/databases/create-point-attribute.md | 2 +- docs/examples/databases/create-polygon-attribute.md | 2 +- docs/examples/databases/update-line-attribute.md | 2 +- docs/examples/databases/update-point-attribute.md | 2 +- docs/examples/databases/update-polygon-attribute.md | 2 +- docs/examples/tablesdb/create-line-column.md | 2 +- docs/examples/tablesdb/create-point-column.md | 2 +- docs/examples/tablesdb/create-polygon-column.md | 2 +- docs/examples/tablesdb/create-row.md | 8 +++++++- docs/examples/tablesdb/update-line-column.md | 2 +- docs/examples/tablesdb/update-point-column.md | 2 +- docs/examples/tablesdb/update-polygon-column.md | 2 +- lib/appwrite/services/databases.rb | 12 ++++++------ lib/appwrite/services/tables_db.rb | 12 ++++++------ 17 files changed, 43 insertions(+), 27 deletions(-) diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ecfe4f4..7e4311d 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -10,5 +10,9 @@ client = Client.new account = Account.new(client) result = account.update_prefs( - prefs: {} + prefs: { + "language" => "en", + "timezone" => "UTC", + "darkTheme" => true + } ) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index e683108..22ce574 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -13,6 +13,12 @@ result = databases.create_document( database_id: '', collection_id: '', document_id: '', - data: {}, + data: { + "username" => "walter.obrien", + "email" => "walter.obrien@example.com", + "fullName" => "Walter O'Brien", + "age" => 30, + "isAdmin" => false + }, permissions: ["read("any")"] # optional ) diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 7980973..9a06ebd 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -14,5 +14,5 @@ result = databases.create_line_attribute( collection_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 1e852a7..3d69f97 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -14,5 +14,5 @@ result = databases.create_point_attribute( collection_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index a939980..24e6fff 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -14,5 +14,5 @@ result = databases.create_polygon_attribute( collection_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 34bfd9a..fc54d10 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -14,6 +14,6 @@ result = databases.update_line_attribute( collection_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index bc33d4d..69fdac8 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -14,6 +14,6 @@ result = databases.update_point_attribute( collection_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 04a3d9e..d5ecd9f 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -14,6 +14,6 @@ result = databases.update_polygon_attribute( collection_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index e70b211..371a1dd 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -14,5 +14,5 @@ result = tables_db.create_line_column( table_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 5f2e046..8694027 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -14,5 +14,5 @@ result = tables_db.create_point_column( table_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 86a1852..e7fcd72 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -14,5 +14,5 @@ result = tables_db.create_polygon_column( table_id: '', key: '', required: false, - default: '' # optional + default: [[1,2], [3, 4]] # optional ) diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 5b66bc4..5e19136 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -13,6 +13,12 @@ result = tables_db.create_row( database_id: '', table_id: '', row_id: '', - data: {}, + data: { + "username" => "walter.obrien", + "email" => "walter.obrien@example.com", + "fullName" => "Walter O'Brien", + "age" => 30, + "isAdmin" => false + }, permissions: ["read("any")"] # optional ) diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 7f71e18..627947a 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -14,6 +14,6 @@ result = tables_db.update_line_column( table_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index ee32b54..8bc5848 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -14,6 +14,6 @@ result = tables_db.update_point_column( table_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 48c68a1..5451202 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -14,6 +14,6 @@ result = tables_db.update_polygon_column( table_id: '', key: '', required: false, - default: '', # optional + default: [[1,2], [3, 4]], # optional new_key: '' # optional ) diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 01c8b55..4ce7a3d 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -1278,7 +1278,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, # @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, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. # # @return [AttributeLine] def create_line_attribute(database_id:, collection_id:, key:, required:, default: nil) @@ -1331,7 +1331,7 @@ def create_line_attribute(database_id:, collection_id:, key:, required:, default # @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 attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. # @param [String] new_key New attribute key. # # @return [AttributeLine] @@ -1385,7 +1385,7 @@ def update_line_attribute(database_id:, collection_id:, key:, required:, default # @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, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. # # @return [AttributePoint] def create_point_attribute(database_id:, collection_id:, key:, required:, default: nil) @@ -1438,7 +1438,7 @@ def create_point_attribute(database_id:, collection_id:, key:, required:, defaul # @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 attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. # @param [String] new_key New attribute key. # # @return [AttributePoint] @@ -1492,7 +1492,7 @@ def update_point_attribute(database_id:, collection_id:, key:, required:, defaul # @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, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. # # @return [AttributePolygon] def create_polygon_attribute(database_id:, collection_id:, key:, required:, default: nil) @@ -1545,7 +1545,7 @@ def create_polygon_attribute(database_id:, collection_id:, key:, required:, defa # @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 attribute when not provided, as JSON string. Cannot be set when attribute is required. + # @param [Array] default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. # @param [String] new_key New attribute key. # # @return [AttributePolygon] diff --git a/lib/appwrite/services/tables_db.rb b/lib/appwrite/services/tables_db.rb index 2d0225d..b8df615 100644 --- a/lib/appwrite/services/tables_db.rb +++ b/lib/appwrite/services/tables_db.rb @@ -1199,7 +1199,7 @@ def update_ip_column(database_id:, table_id:, key:, required:, default:, new_key # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. # # @return [ColumnLine] def create_line_column(database_id:, table_id:, key:, required:, default: nil) @@ -1249,7 +1249,7 @@ def create_line_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. # @param [String] new_key New Column Key. # # @return [ColumnLine] @@ -1300,7 +1300,7 @@ def update_line_column(database_id:, table_id:, key:, required:, default: nil, n # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. # # @return [ColumnPoint] def create_point_column(database_id:, table_id:, key:, required:, default: nil) @@ -1350,7 +1350,7 @@ def create_point_column(database_id:, table_id:, key:, required:, default: nil) # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. # @param [String] new_key New Column Key. # # @return [ColumnPoint] @@ -1401,7 +1401,7 @@ def update_point_column(database_id:, table_id:, key:, required:, default: nil, # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. # # @return [ColumnPolygon] def create_polygon_column(database_id:, table_id:, key:, required:, default: nil) @@ -1451,7 +1451,7 @@ def create_polygon_column(database_id:, table_id:, key:, required:, default: nil # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). # @param [String] key Column Key. # @param [] required Is column required? - # @param [String] default Default value for column when not provided, as JSON string. Cannot be set when column is required. + # @param [Array] default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. # @param [String] new_key New Column Key. # # @return [ColumnPolygon] From c52444b6fd3800c7b4397d939d3b95cfabd95376 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 8 Sep 2025 21:42:31 +1200 Subject: [PATCH 6/6] Update spatial queries --- lib/appwrite/query.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index e223b27..e1a6ecf 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -161,51 +161,51 @@ def and(queries) end def distance_equal(attribute, values, distance, meters = true) - return Query.new("distanceEqual", attribute, [values, distance, meters]).to_s + return Query.new("distanceEqual", attribute, [[values, distance, meters]]).to_s end def distance_not_equal(attribute, values, distance, meters = true) - return Query.new("distanceNotEqual", attribute, [values, distance, meters]).to_s + return Query.new("distanceNotEqual", attribute, [[values, distance, meters]]).to_s end def distance_greater_than(attribute, values, distance, meters = true) - return Query.new("distanceGreaterThan", attribute, [values, distance, meters]).to_s + return Query.new("distanceGreaterThan", attribute, [[values, distance, meters]]).to_s end def distance_less_than(attribute, values, distance, meters = true) - return Query.new("distanceLessThan", attribute, [values, distance, meters]).to_s + return Query.new("distanceLessThan", attribute, [[values, distance, meters]]).to_s end def intersects(attribute, values) - return Query.new("intersects", attribute, values).to_s + return Query.new("intersects", attribute, [values]).to_s end def not_intersects(attribute, values) - return Query.new("notIntersects", attribute, values).to_s + return Query.new("notIntersects", attribute, [values]).to_s end def crosses(attribute, values) - return Query.new("crosses", attribute, values).to_s + return Query.new("crosses", attribute, [values]).to_s end def not_crosses(attribute, values) - return Query.new("notCrosses", attribute, values).to_s + return Query.new("notCrosses", attribute, [values]).to_s end def overlaps(attribute, values) - return Query.new("overlaps", attribute, values).to_s + return Query.new("overlaps", attribute, [values]).to_s end def not_overlaps(attribute, values) - return Query.new("notOverlaps", attribute, values).to_s + return Query.new("notOverlaps", attribute, [values]).to_s end def touches(attribute, values) - return Query.new("touches", attribute, values).to_s + return Query.new("touches", attribute, [values]).to_s end def not_touches(attribute, values) - return Query.new("notTouches", attribute, values).to_s + return Query.new("notTouches", attribute, [values]).to_s end end end