diff --git a/appwrite.gemspec b/appwrite.gemspec index d0a3ea4..4b4c05c 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 = '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/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 new file mode 100644 index 0000000..9a06ebd --- /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: [[1,2], [3, 4]] # 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..3d69f97 --- /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: [[1,2], [3, 4]] # 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..24e6fff --- /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: [[1,2], [3, 4]] # 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..fc54d10 --- /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: [[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 new file mode 100644 index 0000000..69fdac8 --- /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: [[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 new file mode 100644 index 0000000..d5ecd9f --- /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: [[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 new file mode 100644 index 0000000..371a1dd --- /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: [[1,2], [3, 4]] # 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..8694027 --- /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: [[1,2], [3, 4]] # 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..e7fcd72 --- /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: [[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 new file mode 100644 index 0000000..627947a --- /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: [[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 new file mode 100644 index 0000000..8bc5848 --- /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: [[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 new file mode 100644 index 0000000..5451202 --- /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: [[1,2], [3, 4]], # 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..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.0.0', + 'x-sdk-version'=> '18.0.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..e1a6ecf 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 @@ -151,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 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..4ce7a3d 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 [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) + 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 [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] + 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 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 [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) + 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 [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] + 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 [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) + 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 [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] + 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..b8df615 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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) + 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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] + 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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) + 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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] + 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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) + 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 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). + # @param [String] key Column Key. + # @param [] required Is column 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] + 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). #