From 32919dd8d53c513221c049e5cecdab90a1a689b1 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 01:29:56 +1200 Subject: [PATCH 1/6] Add time between queries --- .../databases/create-line-attribute.md | 16 + .../databases/create-point-attribute.md | 16 + .../databases/create-polygon-attribute.md | 16 + .../databases/update-line-attribute.md | 17 + .../databases/update-point-attribute.md | 17 + .../databases/update-polygon-attribute.md | 17 + docs/examples/tablesdb/create-line-column.md | 16 + docs/examples/tablesdb/create-point-column.md | 16 + .../tablesdb/create-polygon-column.md | 16 + docs/examples/tablesdb/update-line-column.md | 17 + docs/examples/tablesdb/update-point-column.md | 17 + .../tablesdb/update-polygon-column.md | 17 + package.json | 2 +- src/client.ts | 4 +- src/enums/credit-card.ts | 2 +- src/enums/execution-method.ts | 1 + src/enums/index-type.ts | 1 + src/models.ts | 272 ++++++++- src/query.ts | 20 + src/services/account.ts | 4 +- src/services/avatars.ts | 4 +- src/services/databases.ts | 551 +++++++++++++++++- src/services/functions.ts | 4 +- src/services/tables-db.ts | 534 +++++++++++++++++ 24 files changed, 1567 insertions(+), 30 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 diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 0000000..36584b9 --- /dev/null +++ b/docs/examples/databases/create-line-attribute.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createLineAttribute({ + databaseId: '', + collectionId: '', + 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..9aba8c3 --- /dev/null +++ b/docs/examples/databases/create-point-attribute.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createPointAttribute({ + databaseId: '', + collectionId: '', + 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..34e1c84 --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createPolygonAttribute({ + databaseId: '', + collectionId: '', + 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..7d04a6e --- /dev/null +++ b/docs/examples/databases/update-line-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateLineAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // 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..092f85c --- /dev/null +++ b/docs/examples/databases/update-point-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updatePointAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // 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..04c1467 --- /dev/null +++ b/docs/examples/databases/update-polygon-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updatePolygonAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // 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..c9d2782 --- /dev/null +++ b/docs/examples/tablesdb/create-line-column.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createLineColumn({ + databaseId: '', + tableId: '', + 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..ec29e1d --- /dev/null +++ b/docs/examples/tablesdb/create-point-column.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createPointColumn({ + databaseId: '', + tableId: '', + 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..2adda2e --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createPolygonColumn({ + databaseId: '', + tableId: '', + 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..68b86da --- /dev/null +++ b/docs/examples/tablesdb/update-line-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateLineColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // 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..c148499 --- /dev/null +++ b/docs/examples/tablesdb/update-point-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updatePointColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // 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..0805b41 --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updatePolygonColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + newKey: '' // optional +}); diff --git a/package.json b/package.json index 85f39d0..e679309 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "18.0.0", + "version": "18.1.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index c27ae81..0abbc61 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/18.0.0'; + let ua = 'AppwriteNodeJSSDK/18.1.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '18.0.0', + 'x-sdk-version': '18.1.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts index a96c73a..e6ce242 100644 --- a/src/enums/credit-card.ts +++ b/src/enums/credit-card.ts @@ -11,7 +11,7 @@ export enum CreditCard { Mastercard = 'mastercard', Naranja = 'naranja', TarjetaShopping = 'targeta-shopping', - UnionChinaPay = 'union-china-pay', + UnionPay = 'unionpay', Visa = 'visa', MIR = 'mir', Maestro = 'maestro', diff --git a/src/enums/execution-method.ts b/src/enums/execution-method.ts index fc63b07..39d4c1e 100644 --- a/src/enums/execution-method.ts +++ b/src/enums/execution-method.ts @@ -5,4 +5,5 @@ export enum ExecutionMethod { PATCH = 'PATCH', DELETE = 'DELETE', OPTIONS = 'OPTIONS', + HEAD = 'HEAD', } \ No newline at end of file diff --git a/src/enums/index-type.ts b/src/enums/index-type.ts index 3017b1a..e5b5bba 100644 --- a/src/enums/index-type.ts +++ b/src/enums/index-type.ts @@ -2,4 +2,5 @@ export enum IndexType { Key = 'key', Fulltext = 'fulltext', Unique = 'unique', + Spatial = 'spatial', } \ No newline at end of file diff --git a/src/models.ts b/src/models.ts index 2d0018f..a033c8f 100644 --- a/src/models.ts +++ b/src/models.ts @@ -564,7 +564,7 @@ export namespace Models { /** * Collection attributes. */ - attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeString)[]; /** * Collection indexes. */ @@ -582,7 +582,7 @@ export namespace Models { /** * List of attributes. */ - attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeString)[]; } /** @@ -1073,6 +1073,132 @@ export namespace Models { side: string; } + /** + * AttributePoint + */ + export type AttributePoint = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: object; + } + + /** + * AttributeLine + */ + export type AttributeLine = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: object; + } + + /** + * AttributePolygon + */ + export type AttributePolygon = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: object; + } + /** * Table */ @@ -1112,7 +1238,7 @@ export namespace Models { /** * Table columns. */ - columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; + columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnString)[]; /** * Table indexes. */ @@ -1130,7 +1256,7 @@ export namespace Models { /** * List of columns. */ - columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; + columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnString)[]; } /** @@ -1621,6 +1747,132 @@ export namespace Models { side: string; } + /** + * ColumnPoint + */ + export type ColumnPoint = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: object; + } + + /** + * ColumnLine + */ + export type ColumnLine = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: object; + } + + /** + * ColumnPolygon + */ + export type ColumnPolygon = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: object; + } + /** * Index */ @@ -1724,15 +1976,15 @@ export namespace Models { /** * Row automatically incrementing ID. */ - $sequence: number; + readonly $sequence: number; /** * Table ID. */ - $tableId: string; + readonly $tableId: string; /** * Database ID. */ - $databaseId: string; + readonly $databaseId: string; /** * Row creation date in ISO 8601 format. */ @@ -1763,15 +2015,15 @@ export namespace Models { /** * Document automatically incrementing ID. */ - $sequence: number; + readonly $sequence: number; /** * Collection ID. */ - $collectionId: string; + readonly $collectionId: string; /** * Database ID. */ - $databaseId: string; + readonly $databaseId: string; /** * Document creation date in ISO 8601 format. */ diff --git a/src/query.ts b/src/query.ts index ed016cb..776dd00 100644 --- a/src/query.ts +++ b/src/query.ts @@ -311,6 +311,16 @@ export class Query { static createdAfter = (value: string): string => new Query("createdAfter", undefined, value).toString(); + /** + * Filter resources where document was created between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static createdBetween = (start: string, end: string): string => + new Query("createdBetween", undefined, [start, end] as QueryTypesList).toString(); + /** * Filter resources where document was updated before date. * @@ -329,6 +339,16 @@ export class Query { static updatedAfter = (value: string): string => new Query("updatedAfter", undefined, value).toString(); + /** + * Filter resources where document was updated between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static updatedBetween = (start: string, end: string): string => + new Query("updatedBetween", undefined, [start, end] as QueryTypesList).toString(); + /** * Combine multiple queries using logical OR operator. * diff --git a/src/services/account.ts b/src/services/account.ts index 4efa6ee..979d905 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1750,7 +1750,7 @@ export class Account { * @param {string} params.secret - Valid verification token. * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated. + * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ updateMagicURLSession(params: { userId: string, secret: string }): Promise; /** @@ -1817,7 +1817,7 @@ export class Account { * @param {string} params.secret - Valid verification token. * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated. + * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ updatePhoneSession(params: { userId: string, secret: string }): Promise; /** diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 07071c0..42013a1 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -96,7 +96,7 @@ export class Avatars { * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * - * @param {CreditCard} params.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} params.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 {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. @@ -110,7 +110,7 @@ export class Avatars { * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size 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 {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. diff --git a/src/services/databases.ts b/src/services/databases.ts index a69365c..272be47 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -81,7 +81,7 @@ export class Databases { * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. * @throws {AppwriteException} * @returns {Promise} - * @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(params: { databaseId: string, name: string, enabled?: boolean }): Promise; /** @@ -2194,6 +2194,546 @@ export class Databases { ); } + /** + * Create a geometric line attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. + */ + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric line attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. + */ + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric 2d point attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + */ + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric 2d point attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createPointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + */ + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + */ + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric polygon attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createPolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + */ + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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 {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -3065,9 +3605,6 @@ export class Databases { if (typeof data === 'undefined') { throw new AppwriteException('Missing required parameter: "data"'); } - delete data?.$sequence; - delete data?.$collectionId; - delete data?.$databaseId; const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; @@ -3517,9 +4054,6 @@ export class Databases { if (typeof data === 'undefined') { throw new AppwriteException('Missing required parameter: "data"'); } - delete data?.$sequence; - delete data?.$collectionId; - delete data?.$databaseId; const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); const payload: Payload = {}; @@ -3602,9 +4136,6 @@ export class Databases { if (typeof documentId === 'undefined') { throw new AppwriteException('Missing required parameter: "documentId"'); } - delete data?.$sequence; - delete data?.$collectionId; - delete data?.$databaseId; const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); const payload: Payload = {}; diff --git a/src/services/functions.ts b/src/services/functions.ts index 113a84e..6c0239d 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1375,7 +1375,7 @@ export class Functions { * @param {string} params.body - HTTP body of execution. Default value is empty string. * @param {boolean} params.async - Execute code in the background. Default value is false. * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is GET. + * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. * @param {object} params.headers - HTTP headers of execution. Defaults to empty. * @param {string} params.scheduledAt - 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. * @throws {AppwriteException} @@ -1389,7 +1389,7 @@ export class Functions { * @param {string} body - HTTP body of execution. Default value is empty string. * @param {boolean} 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 {object} headers - HTTP headers of execution. Defaults to empty. * @param {string} scheduledAt - 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. * @throws {AppwriteException} diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index dfe0e1b..59f1a6f 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2167,6 +2167,540 @@ export class TablesDB { ); } + /** + * Create a geometric line attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + */ + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric line attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a line column. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a line column. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric point attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + */ + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric point attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createPointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point column. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a point column. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + */ + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + /** + * Create a geometric polygon attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createPolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon column. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + /** + * Update a polygon column. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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 {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * From d4f9bb5e86aa54bbed3dad0b63c5d95b5a9377ef Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 02:13:59 +1200 Subject: [PATCH 2/6] Update version --- package.json | 2 +- src/client.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e679309..58e2b24 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "18.1.0", + "version": "19.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 0abbc61..9e577e3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/18.1.0'; + let ua = 'AppwriteNodeJSSDK/19.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '18.1.0', + 'x-sdk-version': '19.0.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; From 5d2d5203ec02a46a75e352e41864f76b16a134e0 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 21:40:30 +1200 Subject: [PATCH 3/6] Add spatial queries --- src/models.ts | 12 ++--- src/query.ts | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 6 deletions(-) diff --git a/src/models.ts b/src/models.ts index a033c8f..84e76dc 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1976,15 +1976,15 @@ export namespace Models { /** * Row automatically incrementing ID. */ - readonly $sequence: number; + $sequence: number; /** * Table ID. */ - readonly $tableId: string; + $tableId: string; /** * Database ID. */ - readonly $databaseId: string; + $databaseId: string; /** * Row creation date in ISO 8601 format. */ @@ -2015,15 +2015,15 @@ export namespace Models { /** * Document automatically incrementing ID. */ - readonly $sequence: number; + $sequence: number; /** * Collection ID. */ - readonly $collectionId: string; + $collectionId: string; /** * Database ID. */ - readonly $databaseId: string; + $databaseId: string; /** * Document creation date in ISO 8601 format. */ diff --git a/src/query.ts b/src/query.ts index 776dd00..9115ffd 100644 --- a/src/query.ts +++ b/src/query.ts @@ -366,4 +366,132 @@ export class Query { */ static and = (queries: string[]) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString(); + + /** + * Filter resources where attribute is at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is not at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance less than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString(); + + /** + * Filter resources where attribute intersects with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static intersects = (attribute: string, values: any[]): string => + new Query("intersects", attribute, values).toString(); + + /** + * Filter resources where attribute does not intersect with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notIntersects = (attribute: string, values: any[]): string => + new Query("notIntersects", attribute, values).toString(); + + /** + * Filter resources where attribute crosses the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static crosses = (attribute: string, values: any[]): string => + new Query("crosses", attribute, values).toString(); + + /** + * Filter resources where attribute does not cross the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notCrosses = (attribute: string, values: any[]): string => + new Query("notCrosses", attribute, values).toString(); + + /** + * Filter resources where attribute overlaps with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static overlaps = (attribute: string, values: any[]): string => + new Query("overlaps", attribute, values).toString(); + + /** + * Filter resources where attribute does not overlap with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notOverlaps = (attribute: string, values: any[]): string => + new Query("notOverlaps", attribute, values).toString(); + + /** + * Filter resources where attribute touches the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static touches = (attribute: string, values: any[]): string => + new Query("touches", attribute, values).toString(); + + /** + * Filter resources where attribute does not touch the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notTouches = (attribute: string, values: any[]): string => + new Query("notTouches", attribute, values).toString(); } From 3bf0920b3553986f4309c25ff74015d866e605ed Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 22:00:33 +1200 Subject: [PATCH 4/6] Fix refs --- src/services/databases.ts | 4 ++-- src/services/tables-db.ts | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/services/databases.ts b/src/services/databases.ts index 272be47..69e7f48 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2375,7 +2375,7 @@ export class Databases { } /** - * Create a geometric 2d point attribute. + * Create a geometric point attribute. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2388,7 +2388,7 @@ export class Databases { */ createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; /** - * Create a geometric 2d point attribute. + * Create a geometric point attribute. * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 59f1a6f..27bb4df 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2168,7 +2168,7 @@ export class TablesDB { } /** - * Create a geometric line attribute. + * Create a geometric line column. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2180,7 +2180,7 @@ export class TablesDB { */ createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; /** - * Create a geometric line attribute. + * Create a geometric line column. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2255,7 +2255,7 @@ export class TablesDB { } /** - * Update a line column. Changing the `default` value will not update already existing documents. + * Update a line column. Changing the `default` value will not update already existing rows. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2268,7 +2268,7 @@ export class TablesDB { */ updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a line column. Changing the `default` value will not update already existing documents. + * Update a line column. Changing the `default` value will not update already existing rows. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2346,7 +2346,7 @@ export class TablesDB { } /** - * Create a geometric point attribute. + * Create a geometric point column. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2358,7 +2358,7 @@ export class TablesDB { */ createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; /** - * Create a geometric point attribute. + * Create a geometric point column. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2433,7 +2433,7 @@ export class TablesDB { } /** - * Update a point column. Changing the `default` value will not update already existing documents. + * Update a point column. Changing the `default` value will not update already existing rows. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2446,7 +2446,7 @@ export class TablesDB { */ updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a point column. Changing the `default` value will not update already existing documents. + * Update a point column. Changing the `default` value will not update already existing rows. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2524,7 +2524,7 @@ export class TablesDB { } /** - * Create a geometric polygon attribute. + * Create a geometric polygon column. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2536,7 +2536,7 @@ export class TablesDB { */ createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; /** - * Create a geometric polygon attribute. + * Create a geometric polygon column. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2611,7 +2611,7 @@ export class TablesDB { } /** - * Update a polygon column. Changing the `default` value will not update already existing documents. + * Update a polygon column. Changing the `default` value will not update already existing rows. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -2624,7 +2624,7 @@ export class TablesDB { */ updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a polygon column. Changing the `default` value will not update already existing documents. + * Update a polygon column. Changing the `default` value will not update already existing rows. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). From ffe3b2978e7ebad2fb1c9a34989458b1f0a9ac30 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 6 Sep 2025 04:56:52 +1200 Subject: [PATCH 5/6] Fix spatial default --- docs/examples/account/update-prefs.md | 6 +- docs/examples/databases/create-document.md | 8 +- .../databases/create-line-attribute.md | 2 +- .../databases/create-point-attribute.md | 2 +- .../databases/create-polygon-attribute.md | 2 +- .../databases/update-line-attribute.md | 2 +- .../databases/update-point-attribute.md | 2 +- .../databases/update-polygon-attribute.md | 2 +- docs/examples/tablesdb/create-line-column.md | 2 +- docs/examples/tablesdb/create-point-column.md | 2 +- .../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 +- .../tablesdb/update-polygon-column.md | 2 +- src/models.ts | 12 +- src/services/databases.ts | 108 +++++++++--------- src/services/tables-db.ts | 108 +++++++++--------- 18 files changed, 145 insertions(+), 129 deletions(-) diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index 113f867..ba41cf8 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -8,5 +8,9 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.updatePrefs({ - 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 39442d1..175e063 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -11,6 +11,12 @@ const result = await databases.createDocument({ databaseId: '', collectionId: '', documentId: '', - 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 36584b9..2b356de 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createLineAttribute({ collectionId: '', 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 9aba8c3..3733d73 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createPointAttribute({ collectionId: '', 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 34e1c84..0fbe7de 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createPolygonAttribute({ collectionId: '', 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 7d04a6e..dfc6a30 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updateLineAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index 092f85c..9587f4f 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updatePointAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 04c1467..f3df251 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updatePolygonAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index c9d2782..719f95b 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createLineColumn({ tableId: '', 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 ec29e1d..4dbba23 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createPointColumn({ tableId: '', 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 2adda2e..76dabf3 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createPolygonColumn({ tableId: '', 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 aa92423..29ddab6 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -11,6 +11,12 @@ const result = await tablesDB.createRow({ databaseId: '', tableId: '', rowId: '', - 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 68b86da..8c00645 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updateLineColumn({ tableId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index c148499..5ece8d8 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updatePointColumn({ tableId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 0805b41..0649a84 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updatePolygonColumn({ tableId: '', key: '', required: false, - default: '', // optional + default: [[1,2], [3, 4]], // optional newKey: '' // optional }); diff --git a/src/models.ts b/src/models.ts index 84e76dc..c08b303 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1112,7 +1112,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: object; + default?: any[]; } /** @@ -1154,7 +1154,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: object; + default?: any[]; } /** @@ -1196,7 +1196,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: object; + default?: any[]; } /** @@ -1786,7 +1786,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: object; + default?: any[]; } /** @@ -1828,7 +1828,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: object; + default?: any[]; } /** @@ -1870,7 +1870,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: object; + default?: any[]; } /** diff --git a/src/services/databases.ts b/src/services/databases.ts index 69e7f48..a23afe5 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2201,12 +2201,12 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. */ - createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric line attribute. * @@ -2214,27 +2214,27 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; createLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2289,13 +2289,13 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - 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} params.newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. */ - updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a line attribute. Changing the `default` value will not update already existing documents. * @@ -2303,28 +2303,28 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - 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} newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updateLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } @@ -2381,12 +2381,12 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. */ - createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric point attribute. * @@ -2394,27 +2394,27 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2469,13 +2469,13 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - 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} params.newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. */ - updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a point attribute. Changing the `default` value will not update already existing documents. * @@ -2483,28 +2483,28 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - 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} newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } @@ -2561,12 +2561,12 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. */ - createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }): Promise; + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric polygon attribute. * @@ -2574,27 +2574,27 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise; + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2649,13 +2649,13 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} params.xdefault - 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} params.newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. */ - updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a polygon attribute. Changing the `default` value will not update already existing documents. * @@ -2663,28 +2663,28 @@ export class Databases { * @param {string} collectionId - 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 {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param {any[]} xdefault - 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} newKey - New attribute key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 27bb4df..096f07e 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2174,11 +2174,11 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - 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. * @throws {AppwriteException} * @returns {Promise} */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric line column. * @@ -2186,27 +2186,27 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; createLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2261,12 +2261,12 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - 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} params.newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a line column. Changing the `default` value will not update already existing rows. * @@ -2274,28 +2274,28 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - 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} newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updateLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } @@ -2352,11 +2352,11 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @throws {AppwriteException} * @returns {Promise} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric point column. * @@ -2364,27 +2364,27 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2439,12 +2439,12 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - 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} params.newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a point column. Changing the `default` value will not update already existing rows. * @@ -2452,28 +2452,28 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - 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} newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } @@ -2530,11 +2530,11 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - 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. * @throws {AppwriteException} * @returns {Promise} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }): Promise; + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric polygon column. * @@ -2542,27 +2542,27 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - 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. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string): Promise; + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string + xdefault: rest[3] as any[] }; } @@ -2617,12 +2617,12 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} params.xdefault - 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} params.newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a polygon column. Changing the `default` value will not update already existing rows. * @@ -2630,28 +2630,28 @@ export class TablesDB { * @param {string} tableId - 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 {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param {any[]} xdefault - 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} newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as string, + xdefault: rest[3] as any[], newKey: rest[4] as string }; } From 49cdf79a91654cc4fd4fcef51a3630aeffb751da Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 8 Sep 2025 21:41:15 +1200 Subject: [PATCH 6/6] Update spatial queries --- src/query.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/query.ts b/src/query.ts index 9115ffd..ddaa3f2 100644 --- a/src/query.ts +++ b/src/query.ts @@ -1,5 +1,5 @@ type QueryTypesSingle = string | number | boolean; -export type QueryTypesList = string[] | number[] | boolean[] | Query[]; +export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[]; export type QueryTypes = QueryTypesSingle | QueryTypesList; type AttributesTypes = string | string[]; @@ -52,20 +52,20 @@ export class Query { * Filter resources where attribute is equal to value. * * @param {string} attribute - * @param {QueryTypes} value + * @param {QueryTypes | any[]} value * @returns {string} */ - static equal = (attribute: string, value: QueryTypes): string => + static equal = (attribute: string, value: QueryTypes | any[]): string => new Query("equal", attribute, value).toString(); /** * Filter resources where attribute is not equal to value. * * @param {string} attribute - * @param {QueryTypes} value + * @param {QueryTypes | any[]} value * @returns {string} */ - static notEqual = (attribute: string, value: QueryTypes): string => + static notEqual = (attribute: string, value: QueryTypes | any[]): string => new Query("notEqual", attribute, value).toString(); /** @@ -238,17 +238,17 @@ export class Query { * @param {string | string[]} value * @returns {string} */ - static contains = (attribute: string, value: string | string[]): string => + static contains = (attribute: string, value: string | any[]): string => new Query("contains", attribute, value).toString(); /** * Filter resources where attribute does not contain the specified value. * * @param {string} attribute - * @param {string | string[]} value + * @param {string | any[]} value * @returns {string} */ - static notContains = (attribute: string, value: string | string[]): string => + static notContains = (attribute: string, value: string | any[]): string => new Query("notContains", attribute, value).toString(); /** @@ -377,7 +377,7 @@ export class Query { * @returns {string} */ static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString(); + new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); /** * Filter resources where attribute is not at a specific distance from the given coordinates. @@ -389,7 +389,7 @@ export class Query { * @returns {string} */ static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString(); + new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); /** * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. @@ -401,7 +401,7 @@ export class Query { * @returns {string} */ static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString(); + new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); /** * Filter resources where attribute is at a distance less than the specified value from the given coordinates. @@ -413,7 +413,7 @@ export class Query { * @returns {string} */ static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString(); + new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); /** * Filter resources where attribute intersects with the given geometry. @@ -423,7 +423,7 @@ export class Query { * @returns {string} */ static intersects = (attribute: string, values: any[]): string => - new Query("intersects", attribute, values).toString(); + new Query("intersects", attribute, [values]).toString(); /** * Filter resources where attribute does not intersect with the given geometry. @@ -433,7 +433,7 @@ export class Query { * @returns {string} */ static notIntersects = (attribute: string, values: any[]): string => - new Query("notIntersects", attribute, values).toString(); + new Query("notIntersects", attribute, [values]).toString(); /** * Filter resources where attribute crosses the given geometry. @@ -443,7 +443,7 @@ export class Query { * @returns {string} */ static crosses = (attribute: string, values: any[]): string => - new Query("crosses", attribute, values).toString(); + new Query("crosses", attribute, [values]).toString(); /** * Filter resources where attribute does not cross the given geometry. @@ -453,7 +453,7 @@ export class Query { * @returns {string} */ static notCrosses = (attribute: string, values: any[]): string => - new Query("notCrosses", attribute, values).toString(); + new Query("notCrosses", attribute, [values]).toString(); /** * Filter resources where attribute overlaps with the given geometry. @@ -463,7 +463,7 @@ export class Query { * @returns {string} */ static overlaps = (attribute: string, values: any[]): string => - new Query("overlaps", attribute, values).toString(); + new Query("overlaps", attribute, [values]).toString(); /** * Filter resources where attribute does not overlap with the given geometry. @@ -473,7 +473,7 @@ export class Query { * @returns {string} */ static notOverlaps = (attribute: string, values: any[]): string => - new Query("notOverlaps", attribute, values).toString(); + new Query("notOverlaps", attribute, [values]).toString(); /** * Filter resources where attribute touches the given geometry. @@ -483,7 +483,7 @@ export class Query { * @returns {string} */ static touches = (attribute: string, values: any[]): string => - new Query("touches", attribute, values).toString(); + new Query("touches", attribute, [values]).toString(); /** * Filter resources where attribute does not touch the given geometry. @@ -493,5 +493,5 @@ export class Query { * @returns {string} */ static notTouches = (attribute: string, values: any[]): string => - new Query("notTouches", attribute, values).toString(); + new Query("notTouches", attribute, [values]).toString(); }