From 96156c35dcecf76ae7f4c130e0b1d197214f7ba1 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 18 Jul 2025 12:49:31 +1200 Subject: [PATCH 1/3] Add inc/dec --- .github/workflows/publish.yml | 2 +- CHANGELOG.md | 6 +- docs/examples/databases/create-document.md | 1 + .../databases/decrement-document-attribute.md | 17 ++++ .../databases/increment-document-attribute.md | 17 ++++ package.json | 2 +- src/client.ts | 4 +- src/models.ts | 8 ++ src/services/databases.ts | 92 +++++++++++++++++++ 9 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 docs/examples/databases/decrement-document-attribute.md create mode 100644 docs/examples/databases/increment-document-attribute.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a781772..9e8e716 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,4 +39,4 @@ jobs: - name: Publish run: npm publish --tag ${{ steps.release_tag.outputs.tag }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6898b..d7261b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,13 +28,13 @@ ## 15.0.1 * Remove titles from all function descriptions -* Fix typing for collection "attribute" key +* Fix typing for collection "attribute" key * Remove unnecessary awaits and asyncs * Ensure `AppwriteException` response is always string ## 15.0.0 -* Fix: pong response & chunked upload +* Fix: pong response & chunked upload ## 14.2.0 @@ -65,4 +65,4 @@ * Rename `templateBranch` to `templateVersion` in `createFunction()`. * Rename `downloadDeployment()` to `getDeploymentDownload()` -> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. \ No newline at end of file +> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 44cfc3c..6d784d0 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,6 +2,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setAdmin('') // .setSession('') // The user session to authenticate with .setKey('') // Your secret API key .setJWT(''); // Your secret JSON Web Token diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..6bfc5f1 --- /dev/null +++ b/docs/examples/databases/decrement-document-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.decrementDocumentAttribute( + '', // databaseId + '', // collectionId + '', // documentId + '', // attribute + null, // value (optional) + null // min (optional) +); diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..0ba0245 --- /dev/null +++ b/docs/examples/databases/increment-document-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.incrementDocumentAttribute( + '', // databaseId + '', // collectionId + '', // documentId + '', // attribute + null, // value (optional) + null // max (optional) +); diff --git a/package.json b/package.json index ca074ab..ae74ea1 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": "17.1.0", + "version": "17.2.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 19025c7..7b74a1e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/17.1.0'; + let ua = 'AppwriteNodeJSSDK/17.2.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': '17.1.0', + 'x-sdk-version': '17.2.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.7.0', }; diff --git a/src/models.ts b/src/models.ts index ed9cf51..d3aca77 100644 --- a/src/models.ts +++ b/src/models.ts @@ -545,6 +545,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** * AttributeInteger @@ -1024,6 +1028,10 @@ export namespace Models { * Document ID. */ $id: string; + /** + * Document automatically incrementing ID. + */ + $sequence: number; /** * Collection ID. */ diff --git a/src/services/databases.ts b/src/services/databases.ts index 4d2f434..f0f2cb8 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1973,6 +1973,98 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** + * Decrement a specific attribute of a document by a given value. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {string} attribute + * @param {number} value + * @param {number} min + * @throws {AppwriteException} + * @returns {Promise} + */ + decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + 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, + ); + } + /** + * Increment a specific attribute of a document by a given value. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {string} attribute + * @param {number} value + * @param {number} max + * @throws {AppwriteException} + * @returns {Promise} + */ + incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + 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, + ); + } /** * List indexes in the collection. * From 4192f52ecd246f1c2cb76bacb7be6ad5234a7e20 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Jul 2025 16:16:00 +0000 Subject: [PATCH 2/3] chore: regenerate --- README.md | 4 +- docs/examples/databases/create-document.md | 1 - docs/examples/databases/create-documents.md | 1 + docs/examples/databases/upsert-document.md | 9 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 17 + .../examples/tables/create-datetime-column.md | 17 + docs/examples/tables/create-email-column.md | 17 + docs/examples/tables/create-enum-column.md | 18 + docs/examples/tables/create-float-column.md | 19 + docs/examples/tables/create-index.md | 18 + docs/examples/tables/create-integer-column.md | 19 + docs/examples/tables/create-ip-column.md | 17 + .../tables/create-relationship-column.md | 19 + docs/examples/tables/create-row.md | 17 + docs/examples/tables/create-rows.md | 14 + docs/examples/tables/create-string-column.md | 19 + docs/examples/tables/create-url-column.md | 17 + docs/examples/tables/create.md | 17 + docs/examples/tables/decrement-row-column.md | 17 + docs/examples/tables/delete-column.md | 14 + docs/examples/tables/delete-index.md | 14 + docs/examples/tables/delete-row.md | 14 + docs/examples/tables/delete-rows.md | 14 + docs/examples/tables/delete.md | 13 + docs/examples/tables/get-column.md | 14 + docs/examples/tables/get-index.md | 14 + docs/examples/tables/get-row.md | 15 + docs/examples/tables/get.md | 13 + docs/examples/tables/increment-row-column.md | 17 + docs/examples/tables/list-columns.md | 14 + docs/examples/tables/list-indexes.md | 14 + docs/examples/tables/list-rows.md | 14 + docs/examples/tables/list.md | 14 + docs/examples/tables/update-boolean-column.md | 17 + .../examples/tables/update-datetime-column.md | 17 + docs/examples/tables/update-email-column.md | 17 + docs/examples/tables/update-enum-column.md | 18 + docs/examples/tables/update-float-column.md | 19 + docs/examples/tables/update-integer-column.md | 19 + docs/examples/tables/update-ip-column.md | 17 + .../tables/update-relationship-column.md | 16 + docs/examples/tables/update-row.md | 16 + docs/examples/tables/update-rows.md | 15 + docs/examples/tables/update-string-column.md | 18 + docs/examples/tables/update-url-column.md | 17 + docs/examples/tables/update.md | 17 + docs/examples/tables/upsert-row.md | 15 + docs/examples/tables/upsert-rows.md | 13 + package.json | 2 +- src/client.ts | 6 +- src/index.ts | 1 + src/models.ts | 874 ++++++- src/services/account.ts | 106 +- src/services/avatars.ts | 46 +- src/services/databases.ts | 197 +- src/services/functions.ts | 41 +- src/services/graphql.ts | 1 + src/services/health.ts | 23 +- src/services/locale.ts | 11 +- src/services/messaging.ts | 61 +- src/services/sites.ts | 32 +- src/services/storage.ts | 26 +- src/services/tables.ts | 2085 +++++++++++++++++ src/services/teams.ts | 46 +- src/services/tokens.ts | 4 + src/services/users.ts | 93 +- 67 files changed, 4147 insertions(+), 239 deletions(-) create mode 100644 docs/examples/tables/create-boolean-column.md create mode 100644 docs/examples/tables/create-datetime-column.md create mode 100644 docs/examples/tables/create-email-column.md create mode 100644 docs/examples/tables/create-enum-column.md create mode 100644 docs/examples/tables/create-float-column.md create mode 100644 docs/examples/tables/create-index.md create mode 100644 docs/examples/tables/create-integer-column.md create mode 100644 docs/examples/tables/create-ip-column.md create mode 100644 docs/examples/tables/create-relationship-column.md create mode 100644 docs/examples/tables/create-row.md create mode 100644 docs/examples/tables/create-rows.md create mode 100644 docs/examples/tables/create-string-column.md create mode 100644 docs/examples/tables/create-url-column.md create mode 100644 docs/examples/tables/create.md create mode 100644 docs/examples/tables/decrement-row-column.md create mode 100644 docs/examples/tables/delete-column.md create mode 100644 docs/examples/tables/delete-index.md create mode 100644 docs/examples/tables/delete-row.md create mode 100644 docs/examples/tables/delete-rows.md create mode 100644 docs/examples/tables/delete.md create mode 100644 docs/examples/tables/get-column.md create mode 100644 docs/examples/tables/get-index.md create mode 100644 docs/examples/tables/get-row.md create mode 100644 docs/examples/tables/get.md create mode 100644 docs/examples/tables/increment-row-column.md create mode 100644 docs/examples/tables/list-columns.md create mode 100644 docs/examples/tables/list-indexes.md create mode 100644 docs/examples/tables/list-rows.md create mode 100644 docs/examples/tables/list.md create mode 100644 docs/examples/tables/update-boolean-column.md create mode 100644 docs/examples/tables/update-datetime-column.md create mode 100644 docs/examples/tables/update-email-column.md create mode 100644 docs/examples/tables/update-enum-column.md create mode 100644 docs/examples/tables/update-float-column.md create mode 100644 docs/examples/tables/update-integer-column.md create mode 100644 docs/examples/tables/update-ip-column.md create mode 100644 docs/examples/tables/update-relationship-column.md create mode 100644 docs/examples/tables/update-row.md create mode 100644 docs/examples/tables/update-rows.md create mode 100644 docs/examples/tables/update-string-column.md create mode 100644 docs/examples/tables/update-url-column.md create mode 100644 docs/examples/tables/update.md create mode 100644 docs/examples/tables/upsert-row.md create mode 100644 docs/examples/tables/upsert-rows.md create mode 100644 src/services/tables.ts diff --git a/README.md b/README.md index fe7f3dc..9f5e664 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Node.js SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 6d784d0..44cfc3c 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,7 +2,6 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setAdmin('') // .setSession('') // The user session to authenticate with .setKey('') // Your secret API key .setJWT(''); // Your secret JSON Web Token diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 1b20882..7ecaa6b 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -2,6 +2,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setAdmin('') // .setKey(''); // Your secret API key const databases = new sdk.Databases(client); diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index fcc62d6..7f2ffba 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -2,15 +2,14 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with + .setSession('') // The user session to authenticate with + .setKey('') // Your secret API key + .setJWT(''); // Your secret JSON Web Token const databases = new sdk.Databases(client); const result = await databases.upsertDocument( '', // databaseId '', // collectionId - '', // documentId - {}, // data - ["read("any")"] // permissions (optional) + '' // documentId ); diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 425b7ba..52f7b55 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -2,13 +2,12 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID + .setAdmin('') // .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.upsertDocuments( '', // databaseId - '', // collectionId - [] // documents + '' // collectionId ); diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md new file mode 100644 index 0000000..64893d7 --- /dev/null +++ b/docs/examples/tables/create-boolean-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 tables = new sdk.Tables(client); + +const result = await tables.createBooleanColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + false, // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md new file mode 100644 index 0000000..0d63244 --- /dev/null +++ b/docs/examples/tables/create-datetime-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 tables = new sdk.Tables(client); + +const result = await tables.createDatetimeColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md new file mode 100644 index 0000000..2257fdd --- /dev/null +++ b/docs/examples/tables/create-email-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 tables = new sdk.Tables(client); + +const result = await tables.createEmailColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + 'email@example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md new file mode 100644 index 0000000..dbc75fe --- /dev/null +++ b/docs/examples/tables/create-enum-column.md @@ -0,0 +1,18 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createEnumColumn( + '', // databaseId + '', // tableId + '', // key + [], // elements + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md new file mode 100644 index 0000000..690b584 --- /dev/null +++ b/docs/examples/tables/create-float-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createFloatColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-index.md b/docs/examples/tables/create-index.md new file mode 100644 index 0000000..aef047b --- /dev/null +++ b/docs/examples/tables/create-index.md @@ -0,0 +1,18 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createIndex( + '', // databaseId + '', // tableId + '', // key + sdk.IndexType.Key, // type + [], // columns + [], // orders (optional) + [] // lengths (optional) +); diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md new file mode 100644 index 0000000..05e66b5 --- /dev/null +++ b/docs/examples/tables/create-integer-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createIntegerColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md new file mode 100644 index 0000000..69b5c63 --- /dev/null +++ b/docs/examples/tables/create-ip-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 tables = new sdk.Tables(client); + +const result = await tables.createIpColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md new file mode 100644 index 0000000..b6e7fa5 --- /dev/null +++ b/docs/examples/tables/create-relationship-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createRelationshipColumn( + '', // databaseId + '', // tableId + '', // relatedTableId + sdk.RelationshipType.OneToOne, // type + false, // twoWay (optional) + '', // key (optional) + '', // twoWayKey (optional) + sdk.RelationMutate.Cascade // onDelete (optional) +); diff --git a/docs/examples/tables/create-row.md b/docs/examples/tables/create-row.md new file mode 100644 index 0000000..84da608 --- /dev/null +++ b/docs/examples/tables/create-row.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // Your secret API key + .setJWT(''); // Your secret JSON Web Token + +const tables = new sdk.Tables(client); + +const result = await tables.createRow( + '', // databaseId + '', // tableId + '', // rowId + {}, // data + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md new file mode 100644 index 0000000..6a6918b --- /dev/null +++ b/docs/examples/tables/create-rows.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setAdmin('') // + .setKey(''); // Your secret API key + +const tables = new sdk.Tables(client); + +const result = await tables.createRows( + '', // databaseId + '', // tableId + [] // rows +); diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md new file mode 100644 index 0000000..8e14cb4 --- /dev/null +++ b/docs/examples/tables/create-string-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.createStringColumn( + '', // databaseId + '', // tableId + '', // key + 1, // size + false, // required + '', // default (optional) + false, // array (optional) + false // encrypt (optional) +); diff --git a/docs/examples/tables/create-url-column.md b/docs/examples/tables/create-url-column.md new file mode 100644 index 0000000..73cdfa3 --- /dev/null +++ b/docs/examples/tables/create-url-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 tables = new sdk.Tables(client); + +const result = await tables.createUrlColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + 'https://example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md new file mode 100644 index 0000000..54d6bc6 --- /dev/null +++ b/docs/examples/tables/create.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 tables = new sdk.Tables(client); + +const result = await tables.create( + '', // databaseId + '', // tableId + '', // name + ["read("any")"], // permissions (optional) + false, // rowSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md new file mode 100644 index 0000000..2e7df6a --- /dev/null +++ b/docs/examples/tables/decrement-row-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 tables = new sdk.Tables(client); + +const result = await tables.decrementRowColumn( + '', // databaseId + '', // tableId + '', // rowId + '', // column + null, // value (optional) + null // min (optional) +); diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md new file mode 100644 index 0000000..a892c61 --- /dev/null +++ b/docs/examples/tables/delete-column.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.deleteColumn( + '', // databaseId + '', // tableId + '' // key +); diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md new file mode 100644 index 0000000..f6bc791 --- /dev/null +++ b/docs/examples/tables/delete-index.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.deleteIndex( + '', // databaseId + '', // tableId + '' // key +); diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md new file mode 100644 index 0000000..5bc60cd --- /dev/null +++ b/docs/examples/tables/delete-row.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const tables = new sdk.Tables(client); + +const result = await tables.deleteRow( + '', // databaseId + '', // tableId + '' // rowId +); diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md new file mode 100644 index 0000000..11b16b7 --- /dev/null +++ b/docs/examples/tables/delete-rows.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.deleteRows( + '', // databaseId + '', // tableId + [] // queries (optional) +); diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md new file mode 100644 index 0000000..fed3eee --- /dev/null +++ b/docs/examples/tables/delete.md @@ -0,0 +1,13 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.delete( + '', // databaseId + '' // tableId +); diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md new file mode 100644 index 0000000..daa20e1 --- /dev/null +++ b/docs/examples/tables/get-column.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.getColumn( + '', // databaseId + '', // tableId + '' // key +); diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md new file mode 100644 index 0000000..56ba871 --- /dev/null +++ b/docs/examples/tables/get-index.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.getIndex( + '', // databaseId + '', // tableId + '' // key +); diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md new file mode 100644 index 0000000..df952d9 --- /dev/null +++ b/docs/examples/tables/get-row.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const tables = new sdk.Tables(client); + +const result = await tables.getRow( + '', // databaseId + '', // tableId + '', // rowId + [] // queries (optional) +); diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md new file mode 100644 index 0000000..b078574 --- /dev/null +++ b/docs/examples/tables/get.md @@ -0,0 +1,13 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.get( + '', // databaseId + '' // tableId +); diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md new file mode 100644 index 0000000..bb5856c --- /dev/null +++ b/docs/examples/tables/increment-row-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 tables = new sdk.Tables(client); + +const result = await tables.incrementRowColumn( + '', // databaseId + '', // tableId + '', // rowId + '', // column + null, // value (optional) + null // max (optional) +); diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md new file mode 100644 index 0000000..f9af43b --- /dev/null +++ b/docs/examples/tables/list-columns.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.listColumns( + '', // databaseId + '', // tableId + [] // queries (optional) +); diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md new file mode 100644 index 0000000..7eaf4b8 --- /dev/null +++ b/docs/examples/tables/list-indexes.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.listIndexes( + '', // databaseId + '', // tableId + [] // queries (optional) +); diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md new file mode 100644 index 0000000..aa5b341 --- /dev/null +++ b/docs/examples/tables/list-rows.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const tables = new sdk.Tables(client); + +const result = await tables.listRows( + '', // databaseId + '', // tableId + [] // queries (optional) +); diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md new file mode 100644 index 0000000..872a98d --- /dev/null +++ b/docs/examples/tables/list.md @@ -0,0 +1,14 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.list( + '', // databaseId + [], // queries (optional) + '' // search (optional) +); diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md new file mode 100644 index 0000000..84ff5d2 --- /dev/null +++ b/docs/examples/tables/update-boolean-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 tables = new sdk.Tables(client); + +const result = await tables.updateBooleanColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + false, // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md new file mode 100644 index 0000000..c02559a --- /dev/null +++ b/docs/examples/tables/update-datetime-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 tables = new sdk.Tables(client); + +const result = await tables.updateDatetimeColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md new file mode 100644 index 0000000..9560b60 --- /dev/null +++ b/docs/examples/tables/update-email-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 tables = new sdk.Tables(client); + +const result = await tables.updateEmailColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + 'email@example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md new file mode 100644 index 0000000..861fce6 --- /dev/null +++ b/docs/examples/tables/update-enum-column.md @@ -0,0 +1,18 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.updateEnumColumn( + '', // databaseId + '', // tableId + '', // key + [], // elements + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md new file mode 100644 index 0000000..01845ca --- /dev/null +++ b/docs/examples/tables/update-float-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.updateFloatColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md new file mode 100644 index 0000000..0b74322 --- /dev/null +++ b/docs/examples/tables/update-integer-column.md @@ -0,0 +1,19 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.updateIntegerColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md new file mode 100644 index 0000000..6ba5ecc --- /dev/null +++ b/docs/examples/tables/update-ip-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 tables = new sdk.Tables(client); + +const result = await tables.updateIpColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md new file mode 100644 index 0000000..3409b8c --- /dev/null +++ b/docs/examples/tables/update-relationship-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 tables = new sdk.Tables(client); + +const result = await tables.updateRelationshipColumn( + '', // databaseId + '', // tableId + '', // key + sdk.RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md new file mode 100644 index 0000000..ff8e98e --- /dev/null +++ b/docs/examples/tables/update-row.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 + .setSession(''); // The user session to authenticate with + +const tables = new sdk.Tables(client); + +const result = await tables.updateRow( + '', // databaseId + '', // tableId + '', // rowId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md new file mode 100644 index 0000000..72cef07 --- /dev/null +++ b/docs/examples/tables/update-rows.md @@ -0,0 +1,15 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.updateRows( + '', // databaseId + '', // tableId + {}, // data (optional) + [] // queries (optional) +); diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md new file mode 100644 index 0000000..f9445a5 --- /dev/null +++ b/docs/examples/tables/update-string-column.md @@ -0,0 +1,18 @@ +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 tables = new sdk.Tables(client); + +const result = await tables.updateStringColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + '', // default + 1, // size (optional) + '' // newKey (optional) +); diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md new file mode 100644 index 0000000..c6ffdf3 --- /dev/null +++ b/docs/examples/tables/update-url-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 tables = new sdk.Tables(client); + +const result = await tables.updateUrlColumn( + '', // databaseId + '', // tableId + '', // key + false, // required + 'https://example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md new file mode 100644 index 0000000..4fd981f --- /dev/null +++ b/docs/examples/tables/update.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 tables = new sdk.Tables(client); + +const result = await tables.update( + '', // databaseId + '', // tableId + '', // name + ["read("any")"], // permissions (optional) + false, // rowSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md new file mode 100644 index 0000000..2b08d56 --- /dev/null +++ b/docs/examples/tables/upsert-row.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // Your secret API key + .setJWT(''); // Your secret JSON Web Token + +const tables = new sdk.Tables(client); + +const result = await tables.upsertRow( + '', // databaseId + '', // tableId + '' // rowId +); diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md new file mode 100644 index 0000000..75d681d --- /dev/null +++ b/docs/examples/tables/upsert-rows.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setAdmin('') // + .setKey(''); // Your secret API key + +const tables = new sdk.Tables(client); + +const result = await tables.upsertRows( + '', // databaseId + '' // tableId +); diff --git a/package.json b/package.json index ae74ea1..85f39d0 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": "17.2.0", + "version": "18.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 7b74a1e..c27ae81 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/17.2.0'; + let ua = 'AppwriteNodeJSSDK/18.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,9 +82,9 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '17.2.0', + 'x-sdk-version': '18.0.0', 'user-agent' : getUserAgent(), - 'X-Appwrite-Response-Format': '1.7.0', + 'X-Appwrite-Response-Format': '1.8.0', }; /** diff --git a/src/index.ts b/src/index.ts index 849d8b1..1887d3b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Avatars } from './services/avatars'; export { Databases } from './services/databases'; +export { Tables } from './services/tables'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Health } from './services/health'; diff --git a/src/models.ts b/src/models.ts index d3aca77..3716035 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2,12 +2,29 @@ * Appwrite Models */ export namespace Models { + + declare const __default: unique symbol; + + /** + * Rows List + */ + export type RowList = { + /** + * Total number of rows rows that matched your query. + */ + total: number; + /** + * List of rows. + */ + rows: Row[]; + } + /** * Documents List */ - export type DocumentList = { + export type DocumentList = { /** - * Total number of documents documents that matched your query. + * Total number of documents rows that matched your query. */ total: number; /** @@ -15,12 +32,27 @@ export namespace Models { */ documents: Document[]; } + + /** + * Tables List + */ + export type TableList = { + /** + * Total number of tables rows that matched your query. + */ + total: number; + /** + * List of tables. + */ + tables: Table[]; + } + /** * Collections List */ export type CollectionList = { /** - * Total number of collections documents that matched your query. + * Total number of collections rows that matched your query. */ total: number; /** @@ -28,12 +60,13 @@ export namespace Models { */ collections: Collection[]; } + /** * Databases List */ export type DatabaseList = { /** - * Total number of databases documents that matched your query. + * Total number of databases rows that matched your query. */ total: number; /** @@ -41,12 +74,13 @@ export namespace Models { */ databases: Database[]; } + /** * Indexes List */ export type IndexList = { /** - * Total number of indexes documents that matched your query. + * Total number of indexes rows that matched your query. */ total: number; /** @@ -54,12 +88,27 @@ export namespace Models { */ indexes: Index[]; } + + /** + * Column Indexes List + */ + export type ColumnIndexList = { + /** + * Total number of indexes rows that matched your query. + */ + total: number; + /** + * List of indexes. + */ + indexes: ColumnIndex[]; + } + /** * Users List */ - export type UserList = { + export type UserList = { /** - * Total number of users documents that matched your query. + * Total number of users rows that matched your query. */ total: number; /** @@ -67,12 +116,13 @@ export namespace Models { */ users: User[]; } + /** * Sessions List */ export type SessionList = { /** - * Total number of sessions documents that matched your query. + * Total number of sessions rows that matched your query. */ total: number; /** @@ -80,12 +130,13 @@ export namespace Models { */ sessions: Session[]; } + /** * Identities List */ export type IdentityList = { /** - * Total number of identities documents that matched your query. + * Total number of identities rows that matched your query. */ total: number; /** @@ -93,12 +144,13 @@ export namespace Models { */ identities: Identity[]; } + /** * Logs List */ export type LogList = { /** - * Total number of logs documents that matched your query. + * Total number of logs rows that matched your query. */ total: number; /** @@ -106,12 +158,13 @@ export namespace Models { */ logs: Log[]; } + /** * Files List */ export type FileList = { /** - * Total number of files documents that matched your query. + * Total number of files rows that matched your query. */ total: number; /** @@ -119,12 +172,13 @@ export namespace Models { */ files: File[]; } + /** * Buckets List */ export type BucketList = { /** - * Total number of buckets documents that matched your query. + * Total number of buckets rows that matched your query. */ total: number; /** @@ -132,12 +186,13 @@ export namespace Models { */ buckets: Bucket[]; } + /** * Resource Tokens List */ export type ResourceTokenList = { /** - * Total number of tokens documents that matched your query. + * Total number of tokens rows that matched your query. */ total: number; /** @@ -145,12 +200,13 @@ export namespace Models { */ tokens: ResourceToken[]; } + /** * Teams List */ - export type TeamList = { + export type TeamList = { /** - * Total number of teams documents that matched your query. + * Total number of teams rows that matched your query. */ total: number; /** @@ -158,12 +214,13 @@ export namespace Models { */ teams: Team[]; } + /** * Memberships List */ export type MembershipList = { /** - * Total number of memberships documents that matched your query. + * Total number of memberships rows that matched your query. */ total: number; /** @@ -171,12 +228,13 @@ export namespace Models { */ memberships: Membership[]; } + /** * Sites List */ export type SiteList = { /** - * Total number of sites documents that matched your query. + * Total number of sites rows that matched your query. */ total: number; /** @@ -184,12 +242,13 @@ export namespace Models { */ sites: Site[]; } + /** * Functions List */ export type FunctionList = { /** - * Total number of functions documents that matched your query. + * Total number of functions rows that matched your query. */ total: number; /** @@ -197,12 +256,13 @@ export namespace Models { */ functions: Function[]; } + /** * Frameworks List */ export type FrameworkList = { /** - * Total number of frameworks documents that matched your query. + * Total number of frameworks rows that matched your query. */ total: number; /** @@ -210,12 +270,13 @@ export namespace Models { */ frameworks: Framework[]; } + /** * Runtimes List */ export type RuntimeList = { /** - * Total number of runtimes documents that matched your query. + * Total number of runtimes rows that matched your query. */ total: number; /** @@ -223,12 +284,13 @@ export namespace Models { */ runtimes: Runtime[]; } + /** * Deployments List */ export type DeploymentList = { /** - * Total number of deployments documents that matched your query. + * Total number of deployments rows that matched your query. */ total: number; /** @@ -236,12 +298,13 @@ export namespace Models { */ deployments: Deployment[]; } + /** * Executions List */ export type ExecutionList = { /** - * Total number of executions documents that matched your query. + * Total number of executions rows that matched your query. */ total: number; /** @@ -249,12 +312,13 @@ export namespace Models { */ executions: Execution[]; } + /** * Countries List */ export type CountryList = { /** - * Total number of countries documents that matched your query. + * Total number of countries rows that matched your query. */ total: number; /** @@ -262,12 +326,13 @@ export namespace Models { */ countries: Country[]; } + /** * Continents List */ export type ContinentList = { /** - * Total number of continents documents that matched your query. + * Total number of continents rows that matched your query. */ total: number; /** @@ -275,12 +340,13 @@ export namespace Models { */ continents: Continent[]; } + /** * Languages List */ export type LanguageList = { /** - * Total number of languages documents that matched your query. + * Total number of languages rows that matched your query. */ total: number; /** @@ -288,12 +354,13 @@ export namespace Models { */ languages: Language[]; } + /** * Currencies List */ export type CurrencyList = { /** - * Total number of currencies documents that matched your query. + * Total number of currencies rows that matched your query. */ total: number; /** @@ -301,12 +368,13 @@ export namespace Models { */ currencies: Currency[]; } + /** * Phones List */ export type PhoneList = { /** - * Total number of phones documents that matched your query. + * Total number of phones rows that matched your query. */ total: number; /** @@ -314,12 +382,13 @@ export namespace Models { */ phones: Phone[]; } + /** * Variables List */ export type VariableList = { /** - * Total number of variables documents that matched your query. + * Total number of variables rows that matched your query. */ total: number; /** @@ -327,12 +396,13 @@ export namespace Models { */ variables: Variable[]; } + /** * Locale codes list */ export type LocaleCodeList = { /** - * Total number of localeCodes documents that matched your query. + * Total number of localeCodes rows that matched your query. */ total: number; /** @@ -340,12 +410,13 @@ export namespace Models { */ localeCodes: LocaleCode[]; } + /** * Provider list */ export type ProviderList = { /** - * Total number of providers documents that matched your query. + * Total number of providers rows that matched your query. */ total: number; /** @@ -353,12 +424,13 @@ export namespace Models { */ providers: Provider[]; } + /** * Message list */ export type MessageList = { /** - * Total number of messages documents that matched your query. + * Total number of messages rows that matched your query. */ total: number; /** @@ -366,12 +438,13 @@ export namespace Models { */ messages: Message[]; } + /** * Topic list */ export type TopicList = { /** - * Total number of topics documents that matched your query. + * Total number of topics rows that matched your query. */ total: number; /** @@ -379,12 +452,13 @@ export namespace Models { */ topics: Topic[]; } + /** * Subscriber list */ export type SubscriberList = { /** - * Total number of subscribers documents that matched your query. + * Total number of subscribers rows that matched your query. */ total: number; /** @@ -392,12 +466,13 @@ export namespace Models { */ subscribers: Subscriber[]; } + /** * Target list */ export type TargetList = { /** - * Total number of targets documents that matched your query. + * Total number of targets rows that matched your query. */ total: number; /** @@ -405,12 +480,13 @@ export namespace Models { */ targets: Target[]; } + /** * Specifications List */ export type SpecificationList = { /** - * Total number of specifications documents that matched your query. + * Total number of specifications rows that matched your query. */ total: number; /** @@ -418,6 +494,7 @@ export namespace Models { */ specifications: Specification[]; } + /** * Database */ @@ -443,6 +520,7 @@ export namespace Models { */ enabled: boolean; } + /** * Collection */ @@ -488,6 +566,7 @@ export namespace Models { */ indexes: Index[]; } + /** * Attributes List */ @@ -501,6 +580,7 @@ export namespace Models { */ attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; } + /** * AttributeString */ @@ -550,6 +630,7 @@ export namespace Models { */ encrypt?: boolean; } + /** * AttributeInteger */ @@ -599,6 +680,7 @@ export namespace Models { */ default?: number; } + /** * AttributeFloat */ @@ -648,6 +730,7 @@ export namespace Models { */ default?: number; } + /** * AttributeBoolean */ @@ -689,6 +772,7 @@ export namespace Models { */ default?: boolean; } + /** * AttributeEmail */ @@ -734,6 +818,7 @@ export namespace Models { */ default?: string; } + /** * AttributeEnum */ @@ -783,6 +868,7 @@ export namespace Models { */ default?: string; } + /** * AttributeIP */ @@ -828,6 +914,7 @@ export namespace Models { */ default?: string; } + /** * AttributeURL */ @@ -873,6 +960,7 @@ export namespace Models { */ default?: string; } + /** * AttributeDatetime */ @@ -918,6 +1006,7 @@ export namespace Models { */ default?: string; } + /** * AttributeRelationship */ @@ -979,6 +1068,555 @@ export namespace Models { */ side: string; } + + /** + * Table + */ + export type Table = { + /** + * Table ID. + */ + $id: string; + /** + * Table creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Table update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Database ID. + */ + databaseId: string; + /** + * Table name. + */ + name: string; + /** + * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + enabled: boolean; + /** + * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + rowSecurity: boolean; + /** + * Table columns. + */ + columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; + /** + * Table indexes. + */ + indexes: ColumnIndex[]; + } + + /** + * Columns List + */ + export type ColumnList = { + /** + * Total number of columns in the given table. + */ + total: number; + /** + * List of columns. + */ + columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; + } + + /** + * ColumnString + */ + export type ColumnString = { + /** + * 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; + /** + * Column size. + */ + size: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnInteger + */ + export type ColumnInteger = { + /** + * 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; + /** + * Minimum value to enforce for new documents. + */ + min?: number; + /** + * Maximum value to enforce for new documents. + */ + max?: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number; + } + + /** + * ColumnFloat + */ + export type ColumnFloat = { + /** + * 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; + /** + * Minimum value to enforce for new documents. + */ + min?: number; + /** + * Maximum value to enforce for new documents. + */ + max?: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number; + } + + /** + * ColumnBoolean + */ + export type ColumnBoolean = { + /** + * 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 attribute when not provided. Cannot be set when attribute is required. + */ + default?: boolean; + } + + /** + * ColumnEmail + */ + export type ColumnEmail = { + /** + * 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; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * ColumnEnum + */ + export type ColumnEnum = { + /** + * 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; + /** + * Array of elements in enumerated type. + */ + elements: string[]; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * ColumnIP + */ + export type ColumnIp = { + /** + * 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; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * ColumnURL + */ + export type ColumnUrl = { + /** + * 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; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnDatetime + */ + export type ColumnDatetime = { + /** + * 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; + /** + * ISO 8601 format. + */ + format: string; + /** + * Default value for attribute when not provided. Only null is optional + */ + default?: string; + } + + /** + * ColumnRelationship + */ + export type ColumnRelationship = { + /** + * 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; + /** + * The ID of the related table. + */ + relatedTable: string; + /** + * The type of the relationship. + */ + relationType: string; + /** + * Is the relationship two-way? + */ + twoWay: boolean; + /** + * The key of the two-way relationship. + */ + twoWayKey: string; + /** + * How deleting the parent document will propagate to child documents. + */ + onDelete: string; + /** + * Whether this is the parent or child side of the relationship + */ + side: string; + } + /** * Index */ @@ -1020,6 +1658,94 @@ export namespace Models { */ $updatedAt: string; } + + /** + * Index + */ + export type ColumnIndex = { + /** + * Index Key. + */ + key: string; + /** + * Index type. + */ + type: string; + /** + * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** + * Index columns. + */ + columns: string[]; + /** + * Index columns length. + */ + lengths: number[]; + /** + * Index orders. + */ + orders?: string[]; + /** + * Index creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Index update date in ISO 8601 format. + */ + $updatedAt: string; + } + + /** + * Row + */ + export type Row = { + /** + * Row ID. + */ + $id: string; + /** + * Row automatically incrementing ID. + */ + $sequence: number; + /** + * Table ID. + */ + $tableId: string; + /** + * Database ID. + */ + $databaseId: string; + /** + * Row creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Row update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + } + + export type DefaultRow = Row & { + [key: string]: any; + [__default]: true; + }; + + export type DataWithoutRowKeys = { + [K in string]: any; + } & { + [K in keyof Row]?: never; + }; + /** * Document */ @@ -1052,8 +1778,19 @@ export namespace Models { * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ $permissions: string[]; - [key: string]: any; } + + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; + + export type DataWithoutDocumentKeys = { + [K in string]: any; + } & { + [K in keyof Document]?: never; + }; + /** * Log */ @@ -1143,10 +1880,11 @@ export namespace Models { */ countryName: string; } + /** * User */ - export type User = { + export type User = { /** * User ID. */ @@ -1224,6 +1962,7 @@ export namespace Models { */ accessedAt: string; } + /** * AlgoMD5 */ @@ -1233,6 +1972,7 @@ export namespace Models { */ type: string; } + /** * AlgoSHA */ @@ -1242,6 +1982,7 @@ export namespace Models { */ type: string; } + /** * AlgoPHPass */ @@ -1251,6 +1992,7 @@ export namespace Models { */ type: string; } + /** * AlgoBcrypt */ @@ -1260,6 +2002,7 @@ export namespace Models { */ type: string; } + /** * AlgoScrypt */ @@ -1285,6 +2028,7 @@ export namespace Models { */ length: number; } + /** * AlgoScryptModified */ @@ -1306,6 +2050,7 @@ export namespace Models { */ signerKey: string; } + /** * AlgoArgon2 */ @@ -1327,12 +2072,24 @@ export namespace Models { */ threads: number; } + /** * Preferences */ export type Preferences = { - [key: string]: any; } + + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + + export type DataWithoutPreferencesKeys = { + [K in string]: any; + } & { + [K in keyof Preferences]?: never; + }; + /** * Session */ @@ -1454,6 +2211,7 @@ export namespace Models { */ mfaUpdatedAt: string; } + /** * Identity */ @@ -1499,6 +2257,7 @@ export namespace Models { */ providerRefreshToken: string; } + /** * Token */ @@ -1528,6 +2287,7 @@ export namespace Models { */ phrase: string; } + /** * JWT */ @@ -1537,6 +2297,7 @@ export namespace Models { */ jwt: string; } + /** * Locale */ @@ -1570,6 +2331,7 @@ export namespace Models { */ currency: string; } + /** * LocaleCode */ @@ -1583,6 +2345,7 @@ export namespace Models { */ name: string; } + /** * File */ @@ -1632,6 +2395,7 @@ export namespace Models { */ chunksUploaded: number; } + /** * Bucket */ @@ -1685,6 +2449,7 @@ export namespace Models { */ antivirus: boolean; } + /** * ResourceToken */ @@ -1718,10 +2483,11 @@ export namespace Models { */ accessedAt: string; } + /** * Team */ - export type Team = { + export type Team = { /** * Team ID. */ @@ -1747,6 +2513,7 @@ export namespace Models { */ prefs: Preferences; } + /** * Membership */ @@ -1804,6 +2571,7 @@ export namespace Models { */ roles: string[]; } + /** * Site */ @@ -1925,6 +2693,7 @@ export namespace Models { */ fallbackFile: string; } + /** * Function */ @@ -2042,6 +2811,7 @@ export namespace Models { */ specification: string; } + /** * Runtime */ @@ -2079,6 +2849,7 @@ export namespace Models { */ supports: string[]; } + /** * Framework */ @@ -2104,6 +2875,7 @@ export namespace Models { */ adapters: FrameworkAdapter[]; } + /** * Framework Adapter */ @@ -2129,6 +2901,7 @@ export namespace Models { */ fallbackFile: string; } + /** * Deployment */ @@ -2242,6 +3015,7 @@ export namespace Models { */ providerBranchUrl: string; } + /** * Execution */ @@ -2315,6 +3089,7 @@ export namespace Models { */ scheduledAt?: string; } + /** * Variable */ @@ -2352,6 +3127,7 @@ export namespace Models { */ resourceId: string; } + /** * Country */ @@ -2365,6 +3141,7 @@ export namespace Models { */ code: string; } + /** * Continent */ @@ -2378,6 +3155,7 @@ export namespace Models { */ code: string; } + /** * Language */ @@ -2395,6 +3173,7 @@ export namespace Models { */ nativeName: string; } + /** * Currency */ @@ -2428,6 +3207,7 @@ export namespace Models { */ namePlural: string; } + /** * Phone */ @@ -2445,6 +3225,7 @@ export namespace Models { */ countryName: string; } + /** * Health Antivirus */ @@ -2458,6 +3239,7 @@ export namespace Models { */ status: string; } + /** * Health Queue */ @@ -2467,6 +3249,7 @@ export namespace Models { */ size: number; } + /** * Health Status */ @@ -2484,6 +3267,7 @@ export namespace Models { */ status: string; } + /** * Health Certificate */ @@ -2513,6 +3297,7 @@ export namespace Models { */ signatureTypeSN: string; } + /** * Health Time */ @@ -2530,6 +3315,7 @@ export namespace Models { */ diff: number; } + /** * Headers */ @@ -2543,6 +3329,7 @@ export namespace Models { */ value: string; } + /** * Specification */ @@ -2564,6 +3351,7 @@ export namespace Models { */ slug: string; } + /** * MFA Challenge */ @@ -2585,6 +3373,7 @@ export namespace Models { */ expire: string; } + /** * MFA Recovery Codes */ @@ -2594,6 +3383,7 @@ export namespace Models { */ recoveryCodes: string[]; } + /** * MFAType */ @@ -2607,6 +3397,7 @@ export namespace Models { */ uri: string; } + /** * MFAFactors */ @@ -2628,6 +3419,7 @@ export namespace Models { */ recoveryCode: boolean; } + /** * Provider */ @@ -2669,6 +3461,7 @@ export namespace Models { */ options?: object; } + /** * Message */ @@ -2726,6 +3519,7 @@ export namespace Models { */ status: string; } + /** * Topic */ @@ -2763,6 +3557,7 @@ export namespace Models { */ subscribe: string[]; } + /** * Subscriber */ @@ -2804,6 +3599,7 @@ export namespace Models { */ providerType: string; } + /** * Target */ diff --git a/src/services/account.ts b/src/services/account.ts index 7d1b34c..26e440c 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -17,7 +17,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - get(): Promise> { + get(): Promise> { const apiPath = '/account'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -32,6 +32,7 @@ export class Account { payload, ); } + /** * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). * @@ -42,7 +43,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - create(userId: string, email: string, password: string, name?: string): Promise> { + create(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -79,17 +80,18 @@ export class Account { payload, ); } + /** * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. -This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * * * @param {string} email * @param {string} password * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(email: string, password: string): Promise> { + updateEmail(email: string, password: string): Promise> { if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -117,6 +119,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the list of identities for the currently logged in user. * @@ -142,6 +145,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Delete an identity by its unique ID. * @@ -168,6 +172,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. * @@ -190,6 +195,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * @@ -215,6 +221,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Enable or disable MFA on an account. * @@ -222,7 +229,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(mfa: boolean): Promise> { + updateMFA(mfa: boolean): Promise> { if (typeof mfa === 'undefined') { throw new AppwriteException('Missing required parameter: "mfa"'); } @@ -244,6 +251,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -270,6 +278,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -278,7 +287,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { + updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -303,6 +312,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Delete an authenticator for a user by ID. * @@ -329,6 +339,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -358,6 +369,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -394,6 +406,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * List the factors available on the account to be used as a MFA challange. * @@ -415,6 +428,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. * @@ -436,6 +450,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -458,6 +473,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. * @@ -480,6 +496,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user account name. * @@ -487,7 +504,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateName(name: string): Promise> { + updateName(name: string): Promise> { if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } @@ -509,6 +526,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * @@ -517,7 +535,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(password: string, oldPassword?: string): Promise> { + updatePassword(password: string, oldPassword?: string): Promise> { if (typeof password === 'undefined') { throw new AppwriteException('Missing required parameter: "password"'); } @@ -542,6 +560,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. * @@ -550,7 +569,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(phone: string, password: string): Promise> { + updatePhone(phone: string, password: string): Promise> { if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); } @@ -578,13 +597,14 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(): Promise { + getPrefs(): Promise { const apiPath = '/account/prefs'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -599,6 +619,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. * @@ -606,7 +627,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePrefs(prefs: Partial): Promise> { + updatePrefs(prefs: Partial): Promise> { if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); } @@ -628,6 +649,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. * @@ -664,10 +686,11 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. - -Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. * * @param {string} userId * @param {string} secret @@ -709,6 +732,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Get the list of active sessions across different devices for the currently logged in user. * @@ -730,6 +754,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Delete all sessions from the user account and remove any sessions cookies from the end client. * @@ -752,6 +777,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). * @@ -774,10 +800,11 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} email * @param {string} password @@ -812,6 +839,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -819,6 +847,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @param {string} secret * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated. */ updateMagicURLSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { @@ -848,6 +877,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -855,6 +885,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @param {string} secret * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated. */ updatePhoneSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { @@ -884,6 +915,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -920,6 +952,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. * @@ -945,6 +978,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. * @@ -971,6 +1005,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. * @@ -997,13 +1032,14 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead. * * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(): Promise> { + updateStatus(): Promise> { const apiPath = '/account/status'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1019,10 +1055,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} userId * @param {string} email @@ -1061,11 +1098,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * * * @param {string} userId * @param {string} email @@ -1108,12 +1146,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. - -If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {OAuthProvider} provider * @param {string} success @@ -1149,10 +1188,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload ); } + /** * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} userId * @param {string} phone @@ -1187,11 +1227,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - -Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * * * @param {string} url * @throws {AppwriteException} @@ -1219,6 +1260,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -1255,6 +1297,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. * @@ -1277,6 +1320,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. * diff --git a/src/services/avatars.ts b/src/services/avatars.ts index c977c9b..1ef7d79 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -13,8 +13,8 @@ export class Avatars { /** * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - -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. + * + * 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 {Browser} code * @param {number} width @@ -51,11 +51,12 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - -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. - + * + * 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 * @param {number} width @@ -92,10 +93,11 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - -This endpoint does not follow HTTP redirects. + * + * This endpoint does not follow HTTP redirects. * * @param {string} url * @throws {AppwriteException} @@ -123,11 +125,12 @@ This endpoint does not follow HTTP redirects. 'arrayBuffer' ); } + /** * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - -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. - + * + * 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 {Flag} code * @param {number} width @@ -164,12 +167,13 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - -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 400x400px. - -This endpoint does not follow HTTP redirects. + * + * 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 400x400px. + * + * This endpoint does not follow HTTP redirects. * * @param {string} url * @param {number} width @@ -205,13 +209,14 @@ This endpoint does not follow HTTP redirects. 'arrayBuffer' ); } + /** * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - -You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - -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. - + * + * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + * + * 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 {string} name * @param {number} width @@ -248,9 +253,10 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - + * * * @param {string} text * @param {number} size diff --git a/src/services/databases.ts b/src/services/databases.ts index f0f2cb8..c51e3d7 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -40,9 +40,10 @@ export class Databases { payload, ); } + /** * Create a new Database. - + * * * @param {string} databaseId * @param {string} name @@ -81,6 +82,7 @@ export class Databases { payload, ); } + /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -106,6 +108,7 @@ export class Databases { payload, ); } + /** * Update a database by its unique ID. * @@ -143,6 +146,7 @@ export class Databases { payload, ); } + /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -169,6 +173,7 @@ export class Databases { payload, ); } + /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -177,6 +182,7 @@ export class Databases { * @param {string} search * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.list` instead. */ listCollections(databaseId: string, queries?: string[], search?: string): Promise { if (typeof databaseId === 'undefined') { @@ -202,6 +208,7 @@ export class Databases { payload, ); } + /** * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * @@ -213,6 +220,7 @@ export class Databases { * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.create` instead. */ createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -254,6 +262,7 @@ export class Databases { payload, ); } + /** * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * @@ -261,6 +270,7 @@ export class Databases { * @param {string} collectionId * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.get` instead. */ getCollection(databaseId: string, collectionId: string): Promise { if (typeof databaseId === 'undefined') { @@ -283,6 +293,7 @@ export class Databases { payload, ); } + /** * Update a collection by its unique ID. * @@ -294,6 +305,7 @@ export class Databases { * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.update` instead. */ updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -332,6 +344,7 @@ export class Databases { payload, ); } + /** * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * @@ -339,6 +352,7 @@ export class Databases { * @param {string} collectionId * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.delete` instead. */ deleteCollection(databaseId: string, collectionId: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -362,6 +376,7 @@ export class Databases { payload, ); } + /** * List attributes in the collection. * @@ -370,6 +385,7 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listColumns` instead. */ listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -395,9 +411,10 @@ export class Databases { payload, ); } + /** * Create a boolean attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -407,6 +424,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createBooleanColumn` instead. */ createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -448,6 +466,7 @@ export class Databases { payload, ); } + /** * Update a boolean attribute. Changing the `default` value will not update already existing documents. * @@ -459,6 +478,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateBooleanColumn` instead. */ updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -500,6 +520,7 @@ export class Databases { payload, ); } + /** * Create a date time attribute according to the ISO 8601 standard. * @@ -511,6 +532,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createDatetimeColumn` instead. */ createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -552,6 +574,7 @@ export class Databases { payload, ); } + /** * Update a date time attribute. Changing the `default` value will not update already existing documents. * @@ -563,6 +586,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateDatetimeColumn` instead. */ updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -604,9 +628,10 @@ export class Databases { payload, ); } + /** * Create an email attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -616,6 +641,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEmailColumn` instead. */ createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -657,9 +683,10 @@ export class Databases { payload, ); } + /** * Update an email attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -669,6 +696,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateEmailColumn` instead. */ updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -710,9 +738,10 @@ export class Databases { payload, ); } - /** - * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + /** + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * * * @param {string} databaseId * @param {string} collectionId @@ -723,6 +752,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEnumColumn` instead. */ createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -770,9 +800,10 @@ export class Databases { payload, ); } + /** * Update an enum attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -783,6 +814,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateEnumColumn` instead. */ updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -830,9 +862,10 @@ export class Databases { payload, ); } + /** * Create a float attribute. Optionally, minimum and maximum values can be provided. - + * * * @param {string} databaseId * @param {string} collectionId @@ -844,6 +877,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createFloatColumn` instead. */ createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -891,9 +925,10 @@ export class Databases { payload, ); } + /** * Update a float attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -905,6 +940,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateFloatColumn` instead. */ updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -952,9 +988,10 @@ export class Databases { payload, ); } + /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. - + * * * @param {string} databaseId * @param {string} collectionId @@ -966,6 +1003,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIntegerColumn` instead. */ createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1013,9 +1051,10 @@ export class Databases { payload, ); } + /** * Update an integer attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1027,6 +1066,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateIntegerColumn` instead. */ updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1074,9 +1114,10 @@ export class Databases { payload, ); } + /** * Create IP address attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1086,6 +1127,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIpColumn` instead. */ createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1127,9 +1169,10 @@ export class Databases { payload, ); } + /** * Update an ip attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1139,6 +1182,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateIpColumn` instead. */ updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1180,9 +1224,10 @@ export class Databases { payload, ); } + /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - + * * * @param {string} databaseId * @param {string} collectionId @@ -1194,6 +1239,7 @@ export class Databases { * @param {RelationMutate} onDelete * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRelationshipColumn` instead. */ createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { if (typeof databaseId === 'undefined') { @@ -1241,9 +1287,10 @@ export class Databases { payload, ); } + /** * Create a string attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1255,6 +1302,7 @@ export class Databases { * @param {boolean} encrypt * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createStringColumn` instead. */ createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1305,9 +1353,10 @@ export class Databases { payload, ); } + /** * Update a string attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1318,6 +1367,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateStringColumn` instead. */ updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1362,9 +1412,10 @@ export class Databases { payload, ); } + /** * Create a URL attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1374,6 +1425,7 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createUrlColumn` instead. */ createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1415,9 +1467,10 @@ export class Databases { payload, ); } + /** * Update an url attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1427,6 +1480,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateUrlColumn` instead. */ updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1468,6 +1522,7 @@ export class Databases { payload, ); } + /** * Get attribute by ID. * @@ -1476,6 +1531,7 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getColumn` instead. */ getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -1501,6 +1557,7 @@ export class Databases { payload, ); } + /** * Deletes an attribute. * @@ -1509,6 +1566,7 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteColumn` instead. */ deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -1535,9 +1593,10 @@ export class Databases { payload, ); } + /** * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - + * * * @param {string} databaseId * @param {string} collectionId @@ -1546,6 +1605,7 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRelationshipColumn` instead. */ updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1578,6 +1638,7 @@ export class Databases { payload, ); } + /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -1586,8 +1647,9 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { + listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1611,18 +1673,20 @@ export class Databases { payload, ); } + /** * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId * @param {string} documentId - * @param {Omit} data + * @param {Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit} data * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. */ - createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise { + createDocument(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1659,18 +1723,20 @@ export class Databases { payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId * @param {object[]} documents * @throws {AppwriteException} * @returns {Promise>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. */ - createDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { + createDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1698,32 +1764,28 @@ Create new Documents. Before using this route, you should create a new collectio payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * * * @param {string} databaseId * @param {string} collectionId - * @param {object[]} documents * @throws {AppwriteException} * @returns {Promise>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead. */ - upsertDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { + upsertDocuments(databaseId: string, collectionId: string): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } - if (typeof documents === 'undefined') { - throw new AppwriteException('Missing required parameter: "documents"'); - } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; - if (typeof documents !== 'undefined') { - payload['documents'] = documents; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1737,10 +1799,11 @@ Create or update Documents. Before using this route, you should create a new col payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. * * @param {string} databaseId * @param {string} collectionId @@ -1748,8 +1811,9 @@ Update all documents that match your queries, if no queries are submitted then a * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead. */ - updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise> { + updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1777,18 +1841,20 @@ Update all documents that match your queries, if no queries are submitted then a payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * * @param {string} databaseId * @param {string} collectionId * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead. */ - deleteDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { + deleteDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1813,6 +1879,7 @@ Bulk delete documents using queries, if no queries are passed then all documents payload, ); } + /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * @@ -1822,8 +1889,9 @@ Bulk delete documents using queries, if no queries are passed then all documents * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead. */ - getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise { + getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1850,20 +1918,20 @@ Bulk delete documents using queries, if no queries are passed then all documents payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId * @param {string} documentId - * @param {object} data - * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead. */ - upsertDocument(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise { + upsertDocument(databaseId: string, collectionId: string, documentId: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1873,17 +1941,8 @@ Create or update a Document. Before using this route, you should create a new co if (typeof documentId === 'undefined') { throw new AppwriteException('Missing required parameter: "documentId"'); } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1897,18 +1956,20 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * * @param {string} databaseId * @param {string} collectionId * @param {string} documentId - * @param {Partial>} data + * @param {Partial>} data * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead. */ - updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise { + updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1939,6 +2000,7 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Delete a document by its unique ID. * @@ -1947,6 +2009,7 @@ Create or update a Document. Before using this route, you should create a new co * @param {string} documentId * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRow` instead. */ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -1973,6 +2036,7 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Decrement a specific attribute of a document by a given value. * @@ -1984,8 +2048,9 @@ Create or update a Document. Before using this route, you should create a new co * @param {number} min * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead. */ - decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise { + decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -2019,6 +2084,7 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Increment a specific attribute of a document by a given value. * @@ -2030,8 +2096,9 @@ Create or update a Document. Before using this route, you should create a new co * @param {number} max * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead. */ - incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise { + incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -2065,6 +2132,7 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * List indexes in the collection. * @@ -2073,6 +2141,7 @@ Create or update a Document. Before using this route, you should create a new co * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listIndexes` instead. */ listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -2098,9 +2167,10 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. -Attributes can be `key`, `fulltext`, and `unique`. + * Attributes can be `key`, `fulltext`, and `unique`. * * @param {string} databaseId * @param {string} collectionId @@ -2111,6 +2181,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @param {number[]} lengths * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIndex` instead. */ createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[]): Promise { if (typeof databaseId === 'undefined') { @@ -2158,6 +2229,7 @@ Attributes can be `key`, `fulltext`, and `unique`. payload, ); } + /** * Get index by ID. * @@ -2166,6 +2238,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @param {string} key * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getIndex` instead. */ getIndex(databaseId: string, collectionId: string, key: string): Promise { if (typeof databaseId === 'undefined') { @@ -2191,6 +2264,7 @@ Attributes can be `key`, `fulltext`, and `unique`. payload, ); } + /** * Delete an index. * @@ -2199,6 +2273,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead. */ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { diff --git a/src/services/functions.ts b/src/services/functions.ts index 7ed681f..7b544ef 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -41,6 +41,7 @@ export class Functions { payload, ); } + /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * @@ -144,6 +145,7 @@ export class Functions { payload, ); } + /** * Get a list of all runtimes that are currently active on your instance. * @@ -165,6 +167,7 @@ export class Functions { payload, ); } + /** * List allowed function specifications for this instance. * @@ -186,6 +189,7 @@ export class Functions { payload, ); } + /** * Get a function by its unique ID. * @@ -211,6 +215,7 @@ export class Functions { payload, ); } + /** * Update function by its unique ID. * @@ -308,6 +313,7 @@ export class Functions { payload, ); } + /** * Delete a function by its unique ID. * @@ -334,6 +340,7 @@ export class Functions { payload, ); } + /** * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. * @@ -367,6 +374,7 @@ export class Functions { payload, ); } + /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * @@ -400,12 +408,13 @@ export class Functions { payload, ); } + /** * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - -This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - -Use the "command" param to set the entrypoint used to execute your code. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. * * @param {string} functionId * @param {File} code @@ -453,6 +462,7 @@ Use the "command" param to set the entrypoint used to execute your cod onProgress ); } + /** * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * @@ -490,10 +500,11 @@ Use the "command" param to set the entrypoint used to execute your cod payload, ); } + /** * Create a deployment based on a template. - -Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. * * @param {string} functionId * @param {string} repository @@ -550,10 +561,11 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/s payload, ); } + /** * Create a deployment when a function is connected to VCS. - -This endpoint lets you create deployment from a branch, commit, or a tag. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param {string} functionId * @param {VCSDeploymentType} type @@ -596,6 +608,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function deployment by its unique ID. * @@ -625,6 +638,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a code deployment by its unique ID. * @@ -655,6 +669,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -689,6 +704,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. 'arrayBuffer' ); } + /** * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * @@ -719,6 +735,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * @@ -748,6 +765,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * @@ -798,6 +816,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function execution log by its unique ID. * @@ -827,6 +846,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a function execution by its unique ID. * @@ -857,6 +877,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all variables of a specific function. * @@ -882,6 +903,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * @@ -926,6 +948,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a variable by its unique ID. * @@ -955,6 +978,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Update variable by its unique ID. * @@ -1000,6 +1024,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a variable by its unique ID. * diff --git a/src/services/graphql.ts b/src/services/graphql.ts index c018580..fd34fb7 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -38,6 +38,7 @@ export class Graphql { payload, ); } + /** * Execute a GraphQL mutation. * diff --git a/src/services/health.ts b/src/services/health.ts index d8d579c..c593277 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -30,6 +30,7 @@ export class Health { payload, ); } + /** * Check the Appwrite Antivirus server is up and connection is successful. * @@ -51,6 +52,7 @@ export class Health { payload, ); } + /** * Check the Appwrite in-memory cache servers are up and connection is successful. * @@ -72,6 +74,7 @@ export class Health { payload, ); } + /** * Get the SSL certificate for a domain * @@ -97,6 +100,7 @@ export class Health { payload, ); } + /** * Check the Appwrite database servers are up and connection is successful. * @@ -118,6 +122,7 @@ export class Health { payload, ); } + /** * Check the Appwrite pub-sub servers are up and connection is successful. * @@ -139,6 +144,7 @@ export class Health { payload, ); } + /** * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. * @@ -164,6 +170,7 @@ export class Health { payload, ); } + /** * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. * @@ -189,6 +196,7 @@ export class Health { payload, ); } + /** * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. * @@ -218,6 +226,7 @@ export class Health { payload, ); } + /** * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. * @@ -243,9 +252,10 @@ export class Health { payload, ); } + /** * Returns the amount of failed jobs in a given queue. - + * * * @param {Name} name * @param {number} threshold @@ -273,6 +283,7 @@ export class Health { payload, ); } + /** * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. * @@ -298,6 +309,7 @@ export class Health { payload, ); } + /** * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. * @@ -323,6 +335,7 @@ export class Health { payload, ); } + /** * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. * @@ -348,6 +361,7 @@ export class Health { payload, ); } + /** * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. * @@ -373,6 +387,7 @@ export class Health { payload, ); } + /** * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. * @@ -398,6 +413,7 @@ export class Health { payload, ); } + /** * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. * @@ -423,6 +439,7 @@ export class Health { payload, ); } + /** * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. * @@ -448,6 +465,7 @@ export class Health { payload, ); } + /** * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. * @@ -473,6 +491,7 @@ export class Health { payload, ); } + /** * Check the Appwrite storage device is up and connection is successful. * @@ -494,6 +513,7 @@ export class Health { payload, ); } + /** * Check the Appwrite local storage device is up and connection is successful. * @@ -515,6 +535,7 @@ export class Health { payload, ); } + /** * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. * diff --git a/src/services/locale.ts b/src/services/locale.ts index 57c74d8..48bba1f 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -10,8 +10,8 @@ export class Locale { /** * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. - -([IP Geolocation by DB-IP](https://db-ip.com)) + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @throws {AppwriteException} * @returns {Promise} @@ -31,6 +31,7 @@ export class Locale { payload, ); } + /** * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * @@ -52,6 +53,7 @@ export class Locale { payload, ); } + /** * List of all continents. You can use the locale header to get the data in a supported language. * @@ -73,6 +75,7 @@ export class Locale { payload, ); } + /** * List of all countries. You can use the locale header to get the data in a supported language. * @@ -94,6 +97,7 @@ export class Locale { payload, ); } + /** * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. * @@ -115,6 +119,7 @@ export class Locale { payload, ); } + /** * List of all countries phone codes. You can use the locale header to get the data in a supported language. * @@ -136,6 +141,7 @@ export class Locale { payload, ); } + /** * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. * @@ -157,6 +163,7 @@ export class Locale { payload, ); } + /** * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. * diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 3d7f6b5..07830ab 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -39,6 +39,7 @@ export class Messaging { payload, ); } + /** * Create a new email message. * @@ -118,9 +119,10 @@ export class Messaging { payload, ); } + /** * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -189,6 +191,7 @@ export class Messaging { payload, ); } + /** * Create a new push notification. * @@ -290,9 +293,10 @@ export class Messaging { payload, ); } + /** * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -389,6 +393,7 @@ export class Messaging { payload, ); } + /** * Create a new SMS message. * @@ -445,9 +450,10 @@ export class Messaging { payload, ); } + /** * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -496,9 +502,10 @@ export class Messaging { payload, ); } + /** * Get a message by its unique ID. - + * * * @param {string} messageId * @throws {AppwriteException} @@ -522,6 +529,7 @@ export class Messaging { payload, ); } + /** * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. * @@ -548,6 +556,7 @@ export class Messaging { payload, ); } + /** * Get the message activity logs listed by its unique ID. * @@ -577,6 +586,7 @@ export class Messaging { payload, ); } + /** * Get a list of the targets associated with a message. * @@ -606,6 +616,7 @@ export class Messaging { payload, ); } + /** * Get a list of all providers from the current Appwrite project. * @@ -635,6 +646,7 @@ export class Messaging { payload, ); } + /** * Create a new Apple Push Notification service provider. * @@ -695,6 +707,7 @@ export class Messaging { payload, ); } + /** * Update a Apple Push Notification service provider by its unique ID. * @@ -749,6 +762,7 @@ export class Messaging { payload, ); } + /** * Create a new Firebase Cloud Messaging provider. * @@ -793,6 +807,7 @@ export class Messaging { payload, ); } + /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -831,6 +846,7 @@ export class Messaging { payload, ); } + /** * Create a new Mailgun provider. * @@ -899,6 +915,7 @@ export class Messaging { payload, ); } + /** * Update a Mailgun provider by its unique ID. * @@ -961,6 +978,7 @@ export class Messaging { payload, ); } + /** * Create a new MSG91 provider. * @@ -1013,6 +1031,7 @@ export class Messaging { payload, ); } + /** * Update a MSG91 provider by its unique ID. * @@ -1059,6 +1078,7 @@ export class Messaging { payload, ); } + /** * Create a new Sendgrid provider. * @@ -1119,6 +1139,7 @@ export class Messaging { payload, ); } + /** * Update a Sendgrid provider by its unique ID. * @@ -1173,6 +1194,7 @@ export class Messaging { payload, ); } + /** * Create a new SMTP provider. * @@ -1260,6 +1282,7 @@ export class Messaging { payload, ); } + /** * Update a SMTP provider by its unique ID. * @@ -1338,6 +1361,7 @@ export class Messaging { payload, ); } + /** * Create a new Telesign provider. * @@ -1390,6 +1414,7 @@ export class Messaging { payload, ); } + /** * Update a Telesign provider by its unique ID. * @@ -1436,6 +1461,7 @@ export class Messaging { payload, ); } + /** * Create a new Textmagic provider. * @@ -1488,6 +1514,7 @@ export class Messaging { payload, ); } + /** * Update a Textmagic provider by its unique ID. * @@ -1534,6 +1561,7 @@ export class Messaging { payload, ); } + /** * Create a new Twilio provider. * @@ -1586,6 +1614,7 @@ export class Messaging { payload, ); } + /** * Update a Twilio provider by its unique ID. * @@ -1632,6 +1661,7 @@ export class Messaging { payload, ); } + /** * Create a new Vonage provider. * @@ -1684,6 +1714,7 @@ export class Messaging { payload, ); } + /** * Update a Vonage provider by its unique ID. * @@ -1730,9 +1761,10 @@ export class Messaging { payload, ); } + /** * Get a provider by its unique ID. - + * * * @param {string} providerId * @throws {AppwriteException} @@ -1756,6 +1788,7 @@ export class Messaging { payload, ); } + /** * Delete a provider by its unique ID. * @@ -1782,6 +1815,7 @@ export class Messaging { payload, ); } + /** * Get the provider activity logs listed by its unique ID. * @@ -1811,6 +1845,7 @@ export class Messaging { payload, ); } + /** * Get the subscriber activity logs listed by its unique ID. * @@ -1840,6 +1875,7 @@ export class Messaging { payload, ); } + /** * Get a list of all topics from the current Appwrite project. * @@ -1869,6 +1905,7 @@ export class Messaging { payload, ); } + /** * Create a new topic. * @@ -1909,9 +1946,10 @@ export class Messaging { payload, ); } + /** * Get a topic by its unique ID. - + * * * @param {string} topicId * @throws {AppwriteException} @@ -1935,9 +1973,10 @@ export class Messaging { payload, ); } + /** * Update a topic by its unique ID. - + * * * @param {string} topicId * @param {string} name @@ -1970,6 +2009,7 @@ export class Messaging { payload, ); } + /** * Delete a topic by its unique ID. * @@ -1996,6 +2036,7 @@ export class Messaging { payload, ); } + /** * Get the topic activity logs listed by its unique ID. * @@ -2025,6 +2066,7 @@ export class Messaging { payload, ); } + /** * Get a list of all subscribers from the current Appwrite project. * @@ -2058,6 +2100,7 @@ export class Messaging { payload, ); } + /** * Create a new subscriber. * @@ -2098,9 +2141,10 @@ export class Messaging { payload, ); } + /** * Get a subscriber by its unique ID. - + * * * @param {string} topicId * @param {string} subscriberId @@ -2128,6 +2172,7 @@ export class Messaging { payload, ); } + /** * Delete a subscriber by its unique ID. * diff --git a/src/services/sites.ts b/src/services/sites.ts index 3f85704..d52a5ea 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -42,6 +42,7 @@ export class Sites { payload, ); } + /** * Create a new site. * @@ -148,6 +149,7 @@ export class Sites { payload, ); } + /** * Get a list of all frameworks that are currently available on the server instance. * @@ -169,6 +171,7 @@ export class Sites { payload, ); } + /** * List allowed site specifications for this instance. * @@ -190,6 +193,7 @@ export class Sites { payload, ); } + /** * Get a site by its unique ID. * @@ -215,6 +219,7 @@ export class Sites { payload, ); } + /** * Update site by its unique ID. * @@ -315,6 +320,7 @@ export class Sites { payload, ); } + /** * Delete a site by its unique ID. * @@ -341,6 +347,7 @@ export class Sites { payload, ); } + /** * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. * @@ -374,6 +381,7 @@ export class Sites { payload, ); } + /** * Get a list of all the site's code deployments. You can use the query params to filter your results. * @@ -407,6 +415,7 @@ export class Sites { payload, ); } + /** * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. * @@ -460,6 +469,7 @@ export class Sites { onProgress ); } + /** * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * @@ -493,10 +503,11 @@ export class Sites { payload, ); } + /** * Create a deployment based on a template. - -Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. * * @param {string} siteId * @param {string} repository @@ -553,10 +564,11 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/s payload, ); } + /** * Create a deployment when a site is connected to VCS. - -This endpoint lets you create deployment from a branch, commit, or a tag. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param {string} siteId * @param {VCSDeploymentType} type @@ -599,6 +611,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site deployment by its unique ID. * @@ -628,6 +641,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a site deployment by its unique ID. * @@ -658,6 +672,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -692,6 +707,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. 'arrayBuffer' ); } + /** * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * @@ -722,6 +738,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all site logs. You can use the query params to filter your results. * @@ -751,6 +768,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site request log by its unique ID. * @@ -780,6 +798,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a site log by its unique ID. * @@ -810,6 +829,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all variables of a specific site. * @@ -835,6 +855,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. * @@ -879,6 +900,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a variable by its unique ID. * @@ -908,6 +930,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Update variable by its unique ID. * @@ -953,6 +976,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a variable by its unique ID. * diff --git a/src/services/storage.ts b/src/services/storage.ts index f20b523..3571d89 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -40,6 +40,7 @@ export class Storage { payload, ); } + /** * Create a new storage bucket. * @@ -108,6 +109,7 @@ export class Storage { payload, ); } + /** * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. * @@ -133,6 +135,7 @@ export class Storage { payload, ); } + /** * Update a storage bucket by its unique ID. * @@ -198,6 +201,7 @@ export class Storage { payload, ); } + /** * Delete a storage bucket by its unique ID. * @@ -224,6 +228,7 @@ export class Storage { payload, ); } + /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -257,15 +262,16 @@ export class Storage { payload, ); } + /** * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - -Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - -When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - -If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - + * + * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * * * @param {string} bucketId * @param {string} fileId @@ -309,6 +315,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk onProgress ); } + /** * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. * @@ -338,6 +345,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Update a file by its unique ID. Only users with write permissions have access to update this resource. * @@ -376,6 +384,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * @@ -406,6 +415,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -440,6 +450,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'arrayBuffer' ); } + /** * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. * @@ -518,6 +529,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'arrayBuffer' ); } + /** * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. * diff --git a/src/services/tables.ts b/src/services/tables.ts new file mode 100644 index 0000000..9c8905b --- /dev/null +++ b/src/services/tables.ts @@ -0,0 +1,2085 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; +import { RelationshipType } from '../enums/relationship-type'; +import { RelationMutate } from '../enums/relation-mutate'; +import { IndexType } from '../enums/index-type'; + +export class Tables { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} databaseId + * @param {string[]} queries + * @param {string} search + * @throws {AppwriteException} + * @returns {Promise} + */ + list(databaseId: string, queries?: string[], search?: string): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + const apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} name + * @param {string[]} permissions + * @param {boolean} rowSecurity + * @param {boolean} enabled + * @throws {AppwriteException} + * @returns {Promise} + */ + create(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof tableId !== 'undefined') { + payload['tableId'] = tableId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + 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, + ); + } + + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param {string} databaseId + * @param {string} tableId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(databaseId: string, tableId: string): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a table by its unique ID. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} name + * @param {string[]} permissions + * @param {boolean} rowSecurity + * @param {boolean} enabled + * @throws {AppwriteException} + * @returns {Promise} + */ + update(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} databaseId + * @param {string} tableId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(databaseId: string, tableId: string): Promise<{}> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List attributes in the collection. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + listColumns(databaseId: string, tableId: string, queries?: string[]): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a boolean column. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {boolean} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/boolean'.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; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 boolean column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {boolean} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/boolean/{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 date time column according to the ISO 8601 standard. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/datetime'.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; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 date time column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/datetime/{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 an email column. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/email'.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; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 an email column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/email/{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 an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {string[]} elements + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { + 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 elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 an enum column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {string[]} elements + * @param {boolean} required + * @param {string} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { + 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 elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + 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 float column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {number} min + * @param {number} max + * @param {number} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/float'.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 min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 float column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {number} xdefault + * @param {number} min + * @param {number} max + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + 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 an integer column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {number} min + * @param {number} max + * @param {number} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/integer'.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 min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 an integer column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {number} xdefault + * @param {number} min + * @param {number} max + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + 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 IP address column. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/ip'.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; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 an ip column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/ip/{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). + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} relatedTableId + * @param {RelationshipType} type + * @param {boolean} twoWay + * @param {string} key + * @param {string} twoWayKey + * @param {RelationMutate} onDelete + * @throws {AppwriteException} + * @returns {Promise} + */ + createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof relatedTableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedTableId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof relatedTableId !== 'undefined') { + payload['relatedTableId'] = relatedTableId; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof twoWay !== 'undefined') { + payload['twoWay'] = twoWay; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof twoWayKey !== 'undefined') { + payload['twoWayKey'] = twoWayKey; + } + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + 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, + ); + } + + /** + * Create a string column. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {number} size + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @param {boolean} encrypt + * @throws {AppwriteException} + * @returns {Promise} + */ + createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { + 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 size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + 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 string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {number} size + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string/{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 size !== 'undefined') { + payload['size'] = size; + } + 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 URL column. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + 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 = '/databases/{databaseId}/tables/{tableId}/columns/url'.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; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + 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 an url column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + 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"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/url/{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, + ); + } + + /** + * Get column by ID. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + getColumn(databaseId: string, tableId: string, key: string): Promise<{}> { + 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"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Deletes a column. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}> { + 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"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {RelationMutate} onDelete + * @param {string} newKey + * @throws {AppwriteException} + * @returns {Promise} + */ + updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { + 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"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + 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, + ); + } + + /** + * List indexes in the collection. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + listIndexes(databaseId: string, tableId: string, queries?: string[]): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @param {IndexType} type + * @param {string[]} columns + * @param {string[]} orders + * @param {number[]} lengths + * @throws {AppwriteException} + * @returns {Promise} + */ + createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[]): Promise { + 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 type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof columns === 'undefined') { + throw new AppwriteException('Missing required parameter: "columns"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof columns !== 'undefined') { + payload['columns'] = columns; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + payload['lengths'] = lengths; + } + 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, + ); + } + + /** + * Get index by ID. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise} + */ + getIndex(databaseId: string, tableId: string, key: string): Promise { + 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"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an index. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}> { + 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"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise>} + */ + listRows(databaseId: string, tableId: string, queries?: string[]): Promise> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @param {object} data + * @param {string[]} permissions + * @throws {AppwriteException} + * @returns {Promise} + */ + createRow(databaseId: string, tableId: string, rowId: string, data: object, permissions?: string[]): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rowId !== 'undefined') { + payload['rowId'] = rowId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + 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, + ); + } + + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param {string} databaseId + * @param {string} tableId + * @param {object[]} rows + * @throws {AppwriteException} + * @returns {Promise>} + */ + createRows(databaseId: string, tableId: string, rows: object[]): Promise> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rows === 'undefined') { + throw new AppwriteException('Missing required parameter: "rows"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } + 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, + ); + } + + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * + * @param {string} databaseId + * @param {string} tableId + * @throws {AppwriteException} + * @returns {Promise>} + */ + upsertRows(databaseId: string, tableId: string): Promise> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param {string} databaseId + * @param {string} tableId + * @param {object} data + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise>} + */ + updateRows(databaseId: string, tableId: string, data?: object, queries?: string[]): Promise> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + 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, + ); + } + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise>} + */ + deleteRows(databaseId: string, tableId: string, queries?: string[]): Promise> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @param {string[]} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + getRow(databaseId: string, tableId: string, rowId: string, queries?: string[]): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @throws {AppwriteException} + * @returns {Promise} + */ + upsertRow(databaseId: string, tableId: string, rowId: string): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @param {object} data + * @param {string[]} permissions + * @throws {AppwriteException} + * @returns {Promise} + */ + updateRow(databaseId: string, tableId: string, rowId: string, data?: object, permissions?: string[]): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + 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, + ); + } + + /** + * Delete a row by its unique ID. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteRow(databaseId: string, tableId: string, rowId: string): Promise<{}> { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @param {string} column + * @param {number} value + * @param {number} min + * @throws {AppwriteException} + * @returns {Promise} + */ + decrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof column === 'undefined') { + throw new AppwriteException('Missing required parameter: "column"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + 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, + ); + } + + /** + * Increment a specific column of a row by a given value. + * + * @param {string} databaseId + * @param {string} tableId + * @param {string} rowId + * @param {string} column + * @param {number} value + * @param {number} max + * @throws {AppwriteException} + * @returns {Promise} + */ + incrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof column === 'undefined') { + throw new AppwriteException('Missing required parameter: "column"'); + } + const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + 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, + ); + } +} diff --git a/src/services/teams.ts b/src/services/teams.ts index ae6fde3..fbb43d1 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -16,7 +16,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/teams'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -37,6 +37,7 @@ export class Teams { payload, ); } + /** * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. * @@ -46,7 +47,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - create(teamId: string, name: string, roles?: string[]): Promise> { + create(teamId: string, name: string, roles?: string[]): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -77,6 +78,7 @@ export class Teams { payload, ); } + /** * Get a team by its ID. All team members have read access for this resource. * @@ -84,7 +86,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - get(teamId: string): Promise> { + get(teamId: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -102,6 +104,7 @@ export class Teams { payload, ); } + /** * Update the team's name by its unique ID. * @@ -110,7 +113,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(teamId: string, name: string): Promise> { + updateName(teamId: string, name: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -135,6 +138,7 @@ export class Teams { payload, ); } + /** * Delete a team using its ID. Only team members with the owner role can delete the team. * @@ -161,6 +165,7 @@ export class Teams { payload, ); } + /** * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -194,15 +199,16 @@ export class Teams { payload, ); } + /** * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - -You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - -Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - -Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - + * + * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * * * @param {string} teamId * @param {string[]} roles @@ -254,6 +260,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -283,9 +290,10 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - + * * * @param {string} teamId * @param {string} membershipId @@ -321,6 +329,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. * @@ -351,11 +360,12 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - -If the request is successful, a session for the user is automatically created. - + * + * If the request is successful, a session for the user is automatically created. + * * * @param {string} teamId * @param {string} membershipId @@ -398,6 +408,7 @@ If the request is successful, a session for the user is automatically created. payload, ); } + /** * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). * @@ -405,7 +416,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(teamId: string): Promise { + getPrefs(teamId: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -423,6 +434,7 @@ If the request is successful, a session for the user is automatically created. payload, ); } + /** * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. * @@ -431,7 +443,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(teamId: string, prefs: object): Promise { + updatePrefs(teamId: string, prefs: object): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } diff --git a/src/services/tokens.ts b/src/services/tokens.ts index 61326ac..8cde8ac 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -41,6 +41,7 @@ export class Tokens { payload, ); } + /** * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. * @@ -75,6 +76,7 @@ export class Tokens { payload, ); } + /** * Get a token by its unique ID. * @@ -100,6 +102,7 @@ export class Tokens { payload, ); } + /** * Update a token by its unique ID. Use this endpoint to update a token's expiry date. * @@ -130,6 +133,7 @@ export class Tokens { payload, ); } + /** * Delete a token by its unique ID. * diff --git a/src/services/users.ts b/src/services/users.ts index 8a1392d..5c89b4b 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -19,7 +19,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/users'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -40,6 +40,7 @@ export class Users { payload, ); } + /** * Create a new user. * @@ -51,7 +52,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - create(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise> { + create(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -85,6 +86,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -95,7 +97,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createArgon2User(userId: string, email: string, password: string, name?: string): Promise> { + createArgon2User(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -132,6 +134,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -142,7 +145,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createBcryptUser(userId: string, email: string, password: string, name?: string): Promise> { + createBcryptUser(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -179,6 +182,7 @@ export class Users { payload, ); } + /** * Get identities for all users. * @@ -208,6 +212,7 @@ export class Users { payload, ); } + /** * Delete an identity by its unique ID. * @@ -234,6 +239,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -244,7 +250,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createMD5User(userId: string, email: string, password: string, name?: string): Promise> { + createMD5User(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -281,6 +287,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -291,7 +298,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createPHPassUser(userId: string, email: string, password: string, name?: string): Promise> { + createPHPassUser(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -328,6 +335,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -343,7 +351,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptUser(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise> { + createScryptUser(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -410,6 +418,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -423,7 +432,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptModifiedUser(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise> { + createScryptModifiedUser(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -478,6 +487,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -489,7 +499,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createSHAUser(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise> { + createSHAUser(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -529,6 +539,7 @@ export class Users { payload, ); } + /** * Get a user by its unique ID. * @@ -536,7 +547,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - get(userId: string): Promise> { + get(userId: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -554,6 +565,7 @@ export class Users { payload, ); } + /** * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. * @@ -580,6 +592,7 @@ export class Users { payload, ); } + /** * Update the user email by its unique ID. * @@ -588,7 +601,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(userId: string, email: string): Promise> { + updateEmail(userId: string, email: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -613,6 +626,7 @@ export class Users { payload, ); } + /** * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. * @@ -647,17 +661,18 @@ export class Users { payload, ); } + /** * Update the user labels by its unique ID. - -Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. * * @param {string} userId * @param {string[]} labels * @throws {AppwriteException} * @returns {Promise>} */ - updateLabels(userId: string, labels: string[]): Promise> { + updateLabels(userId: string, labels: string[]): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -682,6 +697,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user activity logs list by its unique ID. * @@ -711,6 +727,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user membership list by its unique ID. * @@ -744,6 +761,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Enable or disable MFA on a user account. * @@ -752,7 +770,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updateMfa(userId: string, mfa: boolean): Promise> { + updateMfa(userId: string, mfa: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -777,6 +795,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Delete an authenticator app. * @@ -807,6 +826,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * List the factors available on the account to be used as a MFA challange. * @@ -832,6 +852,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * @@ -857,6 +878,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * @@ -883,6 +905,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. * @@ -909,6 +932,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user name by its unique ID. * @@ -917,7 +941,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updateName(userId: string, name: string): Promise> { + updateName(userId: string, name: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -942,6 +966,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user password by its unique ID. * @@ -950,7 +975,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(userId: string, password: string): Promise> { + updatePassword(userId: string, password: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -975,6 +1000,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user phone by its unique ID. * @@ -983,7 +1009,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(userId: string, number: string): Promise> { + updatePhone(userId: string, number: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1008,6 +1034,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user preferences by its unique ID. * @@ -1015,7 +1042,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(userId: string): Promise { + getPrefs(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1033,6 +1060,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. * @@ -1041,7 +1069,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(userId: string, prefs: object): Promise { + updatePrefs(userId: string, prefs: object): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1066,6 +1094,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user sessions list by its unique ID. * @@ -1091,10 +1120,11 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Creates a session for a user. Returns an immediately usable session object. - -If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. * * @param {string} userId * @throws {AppwriteException} @@ -1119,6 +1149,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete all user's sessions by using the user's unique ID. * @@ -1145,6 +1176,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete a user sessions by its unique ID. * @@ -1175,6 +1207,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. * @@ -1183,7 +1216,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(userId: string, status: boolean): Promise> { + updateStatus(userId: string, status: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1208,6 +1241,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * List the messaging targets that are associated with a user. * @@ -1237,6 +1271,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Create a messaging target. * @@ -1292,6 +1327,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Get a user's push notification target by ID. * @@ -1321,6 +1357,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update a messaging target. * @@ -1363,6 +1400,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete a messaging target. * @@ -1393,9 +1431,10 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - + * * * @param {string} userId * @param {number} length @@ -1428,6 +1467,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user email verification status by its unique ID. * @@ -1436,7 +1476,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updateEmailVerification(userId: string, emailVerification: boolean): Promise> { + updateEmailVerification(userId: string, emailVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1461,6 +1501,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user phone verification status by its unique ID. * @@ -1469,7 +1510,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { + updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } From 593469b5af57c875d0e9eec8564a0e801d5de632 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Jul 2025 07:25:23 +0000 Subject: [PATCH 3/3] chore: regenerate --- README.md | 4 +- docs/examples/databases/create-document.md | 1 + docs/examples/databases/upsert-document.md | 9 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 17 - .../examples/tables/create-datetime-column.md | 17 - docs/examples/tables/create-email-column.md | 17 - docs/examples/tables/create-enum-column.md | 18 - docs/examples/tables/create-float-column.md | 19 - docs/examples/tables/create-index.md | 18 - docs/examples/tables/create-integer-column.md | 19 - docs/examples/tables/create-ip-column.md | 17 - .../tables/create-relationship-column.md | 19 - docs/examples/tables/create-row.md | 17 - docs/examples/tables/create-rows.md | 14 - docs/examples/tables/create-string-column.md | 19 - docs/examples/tables/create-url-column.md | 17 - docs/examples/tables/create.md | 17 - docs/examples/tables/decrement-row-column.md | 17 - docs/examples/tables/delete-column.md | 14 - docs/examples/tables/delete-index.md | 14 - docs/examples/tables/delete-row.md | 14 - docs/examples/tables/delete-rows.md | 14 - docs/examples/tables/delete.md | 13 - docs/examples/tables/get-column.md | 14 - docs/examples/tables/get-index.md | 14 - docs/examples/tables/get-row.md | 15 - docs/examples/tables/get.md | 13 - docs/examples/tables/increment-row-column.md | 17 - docs/examples/tables/list-columns.md | 14 - docs/examples/tables/list-indexes.md | 14 - docs/examples/tables/list-rows.md | 14 - docs/examples/tables/list.md | 14 - docs/examples/tables/update-boolean-column.md | 17 - .../examples/tables/update-datetime-column.md | 17 - docs/examples/tables/update-email-column.md | 17 - docs/examples/tables/update-enum-column.md | 18 - docs/examples/tables/update-float-column.md | 19 - docs/examples/tables/update-integer-column.md | 19 - docs/examples/tables/update-ip-column.md | 17 - .../tables/update-relationship-column.md | 16 - docs/examples/tables/update-row.md | 16 - docs/examples/tables/update-rows.md | 15 - docs/examples/tables/update-string-column.md | 18 - docs/examples/tables/update-url-column.md | 17 - docs/examples/tables/update.md | 17 - docs/examples/tables/upsert-row.md | 15 - docs/examples/tables/upsert-rows.md | 13 - package.json | 2 +- src/client.ts | 6 +- src/index.ts | 1 - src/models.ts | 769 +----- src/services/account.ts | 2 - src/services/databases.ts | 68 +- src/services/tables.ts | 2085 ----------------- 55 files changed, 82 insertions(+), 3581 deletions(-) delete mode 100644 docs/examples/tables/create-boolean-column.md delete mode 100644 docs/examples/tables/create-datetime-column.md delete mode 100644 docs/examples/tables/create-email-column.md delete mode 100644 docs/examples/tables/create-enum-column.md delete mode 100644 docs/examples/tables/create-float-column.md delete mode 100644 docs/examples/tables/create-index.md delete mode 100644 docs/examples/tables/create-integer-column.md delete mode 100644 docs/examples/tables/create-ip-column.md delete mode 100644 docs/examples/tables/create-relationship-column.md delete mode 100644 docs/examples/tables/create-row.md delete mode 100644 docs/examples/tables/create-rows.md delete mode 100644 docs/examples/tables/create-string-column.md delete mode 100644 docs/examples/tables/create-url-column.md delete mode 100644 docs/examples/tables/create.md delete mode 100644 docs/examples/tables/decrement-row-column.md delete mode 100644 docs/examples/tables/delete-column.md delete mode 100644 docs/examples/tables/delete-index.md delete mode 100644 docs/examples/tables/delete-row.md delete mode 100644 docs/examples/tables/delete-rows.md delete mode 100644 docs/examples/tables/delete.md delete mode 100644 docs/examples/tables/get-column.md delete mode 100644 docs/examples/tables/get-index.md delete mode 100644 docs/examples/tables/get-row.md delete mode 100644 docs/examples/tables/get.md delete mode 100644 docs/examples/tables/increment-row-column.md delete mode 100644 docs/examples/tables/list-columns.md delete mode 100644 docs/examples/tables/list-indexes.md delete mode 100644 docs/examples/tables/list-rows.md delete mode 100644 docs/examples/tables/list.md delete mode 100644 docs/examples/tables/update-boolean-column.md delete mode 100644 docs/examples/tables/update-datetime-column.md delete mode 100644 docs/examples/tables/update-email-column.md delete mode 100644 docs/examples/tables/update-enum-column.md delete mode 100644 docs/examples/tables/update-float-column.md delete mode 100644 docs/examples/tables/update-integer-column.md delete mode 100644 docs/examples/tables/update-ip-column.md delete mode 100644 docs/examples/tables/update-relationship-column.md delete mode 100644 docs/examples/tables/update-row.md delete mode 100644 docs/examples/tables/update-rows.md delete mode 100644 docs/examples/tables/update-string-column.md delete mode 100644 docs/examples/tables/update-url-column.md delete mode 100644 docs/examples/tables/update.md delete mode 100644 docs/examples/tables/upsert-row.md delete mode 100644 docs/examples/tables/upsert-rows.md delete mode 100644 src/services/tables.ts diff --git a/README.md b/README.md index 9f5e664..fe7f3dc 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Node.js SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 44cfc3c..6d784d0 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,6 +2,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setAdmin('') // .setSession('') // The user session to authenticate with .setKey('') // Your secret API key .setJWT(''); // Your secret JSON Web Token diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 7f2ffba..fcc62d6 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -2,14 +2,15 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setSession('') // The user session to authenticate with - .setKey('') // Your secret API key - .setJWT(''); // Your secret JSON Web Token + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new sdk.Databases(client); const result = await databases.upsertDocument( '', // databaseId '', // collectionId - '' // documentId + '', // documentId + {}, // data + ["read("any")"] // permissions (optional) ); diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 52f7b55..425b7ba 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -2,12 +2,13 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setAdmin('') // + .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.upsertDocuments( '', // databaseId - '' // collectionId + '', // collectionId + [] // documents ); diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md deleted file mode 100644 index 64893d7..0000000 --- a/docs/examples/tables/create-boolean-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createBooleanColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - false, // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md deleted file mode 100644 index 0d63244..0000000 --- a/docs/examples/tables/create-datetime-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createDatetimeColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - '', // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md deleted file mode 100644 index 2257fdd..0000000 --- a/docs/examples/tables/create-email-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createEmailColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - 'email@example.com', // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md deleted file mode 100644 index dbc75fe..0000000 --- a/docs/examples/tables/create-enum-column.md +++ /dev/null @@ -1,18 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createEnumColumn( - '', // databaseId - '', // tableId - '', // key - [], // elements - false, // required - '', // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md deleted file mode 100644 index 690b584..0000000 --- a/docs/examples/tables/create-float-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createFloatColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - null, // min (optional) - null, // max (optional) - null, // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-index.md b/docs/examples/tables/create-index.md deleted file mode 100644 index aef047b..0000000 --- a/docs/examples/tables/create-index.md +++ /dev/null @@ -1,18 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createIndex( - '', // databaseId - '', // tableId - '', // key - sdk.IndexType.Key, // type - [], // columns - [], // orders (optional) - [] // lengths (optional) -); diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md deleted file mode 100644 index 05e66b5..0000000 --- a/docs/examples/tables/create-integer-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createIntegerColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - null, // min (optional) - null, // max (optional) - null, // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md deleted file mode 100644 index 69b5c63..0000000 --- a/docs/examples/tables/create-ip-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createIpColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - '', // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md deleted file mode 100644 index b6e7fa5..0000000 --- a/docs/examples/tables/create-relationship-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createRelationshipColumn( - '', // databaseId - '', // tableId - '', // relatedTableId - sdk.RelationshipType.OneToOne, // type - false, // twoWay (optional) - '', // key (optional) - '', // twoWayKey (optional) - sdk.RelationMutate.Cascade // onDelete (optional) -); diff --git a/docs/examples/tables/create-row.md b/docs/examples/tables/create-row.md deleted file mode 100644 index 84da608..0000000 --- a/docs/examples/tables/create-row.md +++ /dev/null @@ -1,17 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setSession('') // The user session to authenticate with - .setKey('') // Your secret API key - .setJWT(''); // Your secret JSON Web Token - -const tables = new sdk.Tables(client); - -const result = await tables.createRow( - '', // databaseId - '', // tableId - '', // rowId - {}, // data - ["read("any")"] // permissions (optional) -); diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md deleted file mode 100644 index 6a6918b..0000000 --- a/docs/examples/tables/create-rows.md +++ /dev/null @@ -1,14 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setAdmin('') // - .setKey(''); // Your secret API key - -const tables = new sdk.Tables(client); - -const result = await tables.createRows( - '', // databaseId - '', // tableId - [] // rows -); diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md deleted file mode 100644 index 8e14cb4..0000000 --- a/docs/examples/tables/create-string-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createStringColumn( - '', // databaseId - '', // tableId - '', // key - 1, // size - false, // required - '', // default (optional) - false, // array (optional) - false // encrypt (optional) -); diff --git a/docs/examples/tables/create-url-column.md b/docs/examples/tables/create-url-column.md deleted file mode 100644 index 73cdfa3..0000000 --- a/docs/examples/tables/create-url-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.createUrlColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - 'https://example.com', // default (optional) - false // array (optional) -); diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md deleted file mode 100644 index 54d6bc6..0000000 --- a/docs/examples/tables/create.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.create( - '', // databaseId - '', // tableId - '', // name - ["read("any")"], // permissions (optional) - false, // rowSecurity (optional) - false // enabled (optional) -); diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md deleted file mode 100644 index 2e7df6a..0000000 --- a/docs/examples/tables/decrement-row-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.decrementRowColumn( - '', // databaseId - '', // tableId - '', // rowId - '', // column - null, // value (optional) - null // min (optional) -); diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md deleted file mode 100644 index a892c61..0000000 --- a/docs/examples/tables/delete-column.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.deleteColumn( - '', // databaseId - '', // tableId - '' // key -); diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md deleted file mode 100644 index f6bc791..0000000 --- a/docs/examples/tables/delete-index.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.deleteIndex( - '', // databaseId - '', // tableId - '' // key -); diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md deleted file mode 100644 index 5bc60cd..0000000 --- a/docs/examples/tables/delete-row.md +++ /dev/null @@ -1,14 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const tables = new sdk.Tables(client); - -const result = await tables.deleteRow( - '', // databaseId - '', // tableId - '' // rowId -); diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md deleted file mode 100644 index 11b16b7..0000000 --- a/docs/examples/tables/delete-rows.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.deleteRows( - '', // databaseId - '', // tableId - [] // queries (optional) -); diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md deleted file mode 100644 index fed3eee..0000000 --- a/docs/examples/tables/delete.md +++ /dev/null @@ -1,13 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.delete( - '', // databaseId - '' // tableId -); diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md deleted file mode 100644 index daa20e1..0000000 --- a/docs/examples/tables/get-column.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.getColumn( - '', // databaseId - '', // tableId - '' // key -); diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md deleted file mode 100644 index 56ba871..0000000 --- a/docs/examples/tables/get-index.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.getIndex( - '', // databaseId - '', // tableId - '' // key -); diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md deleted file mode 100644 index df952d9..0000000 --- a/docs/examples/tables/get-row.md +++ /dev/null @@ -1,15 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const tables = new sdk.Tables(client); - -const result = await tables.getRow( - '', // databaseId - '', // tableId - '', // rowId - [] // queries (optional) -); diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md deleted file mode 100644 index b078574..0000000 --- a/docs/examples/tables/get.md +++ /dev/null @@ -1,13 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.get( - '', // databaseId - '' // tableId -); diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md deleted file mode 100644 index bb5856c..0000000 --- a/docs/examples/tables/increment-row-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.incrementRowColumn( - '', // databaseId - '', // tableId - '', // rowId - '', // column - null, // value (optional) - null // max (optional) -); diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md deleted file mode 100644 index f9af43b..0000000 --- a/docs/examples/tables/list-columns.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.listColumns( - '', // databaseId - '', // tableId - [] // queries (optional) -); diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md deleted file mode 100644 index 7eaf4b8..0000000 --- a/docs/examples/tables/list-indexes.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.listIndexes( - '', // databaseId - '', // tableId - [] // queries (optional) -); diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md deleted file mode 100644 index aa5b341..0000000 --- a/docs/examples/tables/list-rows.md +++ /dev/null @@ -1,14 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const tables = new sdk.Tables(client); - -const result = await tables.listRows( - '', // databaseId - '', // tableId - [] // queries (optional) -); diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md deleted file mode 100644 index 872a98d..0000000 --- a/docs/examples/tables/list.md +++ /dev/null @@ -1,14 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.list( - '', // databaseId - [], // queries (optional) - '' // search (optional) -); diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md deleted file mode 100644 index 84ff5d2..0000000 --- a/docs/examples/tables/update-boolean-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateBooleanColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - false, // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md deleted file mode 100644 index c02559a..0000000 --- a/docs/examples/tables/update-datetime-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateDatetimeColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - '', // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md deleted file mode 100644 index 9560b60..0000000 --- a/docs/examples/tables/update-email-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateEmailColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - 'email@example.com', // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md deleted file mode 100644 index 861fce6..0000000 --- a/docs/examples/tables/update-enum-column.md +++ /dev/null @@ -1,18 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateEnumColumn( - '', // databaseId - '', // tableId - '', // key - [], // elements - false, // required - '', // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md deleted file mode 100644 index 01845ca..0000000 --- a/docs/examples/tables/update-float-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateFloatColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - null, // default - null, // min (optional) - null, // max (optional) - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md deleted file mode 100644 index 0b74322..0000000 --- a/docs/examples/tables/update-integer-column.md +++ /dev/null @@ -1,19 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateIntegerColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - null, // default - null, // min (optional) - null, // max (optional) - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md deleted file mode 100644 index 6ba5ecc..0000000 --- a/docs/examples/tables/update-ip-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateIpColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - '', // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md deleted file mode 100644 index 3409b8c..0000000 --- a/docs/examples/tables/update-relationship-column.md +++ /dev/null @@ -1,16 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateRelationshipColumn( - '', // databaseId - '', // tableId - '', // key - sdk.RelationMutate.Cascade, // onDelete (optional) - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md deleted file mode 100644 index ff8e98e..0000000 --- a/docs/examples/tables/update-row.md +++ /dev/null @@ -1,16 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const tables = new sdk.Tables(client); - -const result = await tables.updateRow( - '', // databaseId - '', // tableId - '', // rowId - {}, // data (optional) - ["read("any")"] // permissions (optional) -); diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md deleted file mode 100644 index 72cef07..0000000 --- a/docs/examples/tables/update-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateRows( - '', // databaseId - '', // tableId - {}, // data (optional) - [] // queries (optional) -); diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md deleted file mode 100644 index f9445a5..0000000 --- a/docs/examples/tables/update-string-column.md +++ /dev/null @@ -1,18 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateStringColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - '', // default - 1, // size (optional) - '' // newKey (optional) -); diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md deleted file mode 100644 index c6ffdf3..0000000 --- a/docs/examples/tables/update-url-column.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.updateUrlColumn( - '', // databaseId - '', // tableId - '', // key - false, // required - 'https://example.com', // default - '' // newKey (optional) -); diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md deleted file mode 100644 index 4fd981f..0000000 --- a/docs/examples/tables/update.md +++ /dev/null @@ -1,17 +0,0 @@ -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 tables = new sdk.Tables(client); - -const result = await tables.update( - '', // databaseId - '', // tableId - '', // name - ["read("any")"], // permissions (optional) - false, // rowSecurity (optional) - false // enabled (optional) -); diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md deleted file mode 100644 index 2b08d56..0000000 --- a/docs/examples/tables/upsert-row.md +++ /dev/null @@ -1,15 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setSession('') // The user session to authenticate with - .setKey('') // Your secret API key - .setJWT(''); // Your secret JSON Web Token - -const tables = new sdk.Tables(client); - -const result = await tables.upsertRow( - '', // databaseId - '', // tableId - '' // rowId -); diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md deleted file mode 100644 index 75d681d..0000000 --- a/docs/examples/tables/upsert-rows.md +++ /dev/null @@ -1,13 +0,0 @@ -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setAdmin('') // - .setKey(''); // Your secret API key - -const tables = new sdk.Tables(client); - -const result = await tables.upsertRows( - '', // databaseId - '' // tableId -); diff --git a/package.json b/package.json index 85f39d0..ca074ab 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": "17.1.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index c27ae81..19025c7 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/17.1.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,9 +82,9 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '18.0.0', + 'x-sdk-version': '17.1.0', 'user-agent' : getUserAgent(), - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format': '1.7.0', }; /** diff --git a/src/index.ts b/src/index.ts index 1887d3b..849d8b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,6 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Avatars } from './services/avatars'; export { Databases } from './services/databases'; -export { Tables } from './services/tables'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Health } from './services/health'; diff --git a/src/models.ts b/src/models.ts index 3716035..be2a8e2 100644 --- a/src/models.ts +++ b/src/models.ts @@ -5,26 +5,12 @@ export namespace Models { declare const __default: unique symbol; - /** - * Rows List - */ - export type RowList = { - /** - * Total number of rows rows that matched your query. - */ - total: number; - /** - * List of rows. - */ - rows: Row[]; - } - /** * Documents List */ export type DocumentList = { /** - * Total number of documents rows that matched your query. + * Total number of documents documents that matched your query. */ total: number; /** @@ -33,26 +19,12 @@ export namespace Models { documents: Document[]; } - /** - * Tables List - */ - export type TableList = { - /** - * Total number of tables rows that matched your query. - */ - total: number; - /** - * List of tables. - */ - tables: Table[]; - } - /** * Collections List */ export type CollectionList = { /** - * Total number of collections rows that matched your query. + * Total number of collections documents that matched your query. */ total: number; /** @@ -66,7 +38,7 @@ export namespace Models { */ export type DatabaseList = { /** - * Total number of databases rows that matched your query. + * Total number of databases documents that matched your query. */ total: number; /** @@ -80,7 +52,7 @@ export namespace Models { */ export type IndexList = { /** - * Total number of indexes rows that matched your query. + * Total number of indexes documents that matched your query. */ total: number; /** @@ -89,26 +61,12 @@ export namespace Models { indexes: Index[]; } - /** - * Column Indexes List - */ - export type ColumnIndexList = { - /** - * Total number of indexes rows that matched your query. - */ - total: number; - /** - * List of indexes. - */ - indexes: ColumnIndex[]; - } - /** * Users List */ export type UserList = { /** - * Total number of users rows that matched your query. + * Total number of users documents that matched your query. */ total: number; /** @@ -122,7 +80,7 @@ export namespace Models { */ export type SessionList = { /** - * Total number of sessions rows that matched your query. + * Total number of sessions documents that matched your query. */ total: number; /** @@ -136,7 +94,7 @@ export namespace Models { */ export type IdentityList = { /** - * Total number of identities rows that matched your query. + * Total number of identities documents that matched your query. */ total: number; /** @@ -150,7 +108,7 @@ export namespace Models { */ export type LogList = { /** - * Total number of logs rows that matched your query. + * Total number of logs documents that matched your query. */ total: number; /** @@ -164,7 +122,7 @@ export namespace Models { */ export type FileList = { /** - * Total number of files rows that matched your query. + * Total number of files documents that matched your query. */ total: number; /** @@ -178,7 +136,7 @@ export namespace Models { */ export type BucketList = { /** - * Total number of buckets rows that matched your query. + * Total number of buckets documents that matched your query. */ total: number; /** @@ -192,7 +150,7 @@ export namespace Models { */ export type ResourceTokenList = { /** - * Total number of tokens rows that matched your query. + * Total number of tokens documents that matched your query. */ total: number; /** @@ -206,7 +164,7 @@ export namespace Models { */ export type TeamList = { /** - * Total number of teams rows that matched your query. + * Total number of teams documents that matched your query. */ total: number; /** @@ -220,7 +178,7 @@ export namespace Models { */ export type MembershipList = { /** - * Total number of memberships rows that matched your query. + * Total number of memberships documents that matched your query. */ total: number; /** @@ -234,7 +192,7 @@ export namespace Models { */ export type SiteList = { /** - * Total number of sites rows that matched your query. + * Total number of sites documents that matched your query. */ total: number; /** @@ -248,7 +206,7 @@ export namespace Models { */ export type FunctionList = { /** - * Total number of functions rows that matched your query. + * Total number of functions documents that matched your query. */ total: number; /** @@ -262,7 +220,7 @@ export namespace Models { */ export type FrameworkList = { /** - * Total number of frameworks rows that matched your query. + * Total number of frameworks documents that matched your query. */ total: number; /** @@ -276,7 +234,7 @@ export namespace Models { */ export type RuntimeList = { /** - * Total number of runtimes rows that matched your query. + * Total number of runtimes documents that matched your query. */ total: number; /** @@ -290,7 +248,7 @@ export namespace Models { */ export type DeploymentList = { /** - * Total number of deployments rows that matched your query. + * Total number of deployments documents that matched your query. */ total: number; /** @@ -304,7 +262,7 @@ export namespace Models { */ export type ExecutionList = { /** - * Total number of executions rows that matched your query. + * Total number of executions documents that matched your query. */ total: number; /** @@ -318,7 +276,7 @@ export namespace Models { */ export type CountryList = { /** - * Total number of countries rows that matched your query. + * Total number of countries documents that matched your query. */ total: number; /** @@ -332,7 +290,7 @@ export namespace Models { */ export type ContinentList = { /** - * Total number of continents rows that matched your query. + * Total number of continents documents that matched your query. */ total: number; /** @@ -346,7 +304,7 @@ export namespace Models { */ export type LanguageList = { /** - * Total number of languages rows that matched your query. + * Total number of languages documents that matched your query. */ total: number; /** @@ -360,7 +318,7 @@ export namespace Models { */ export type CurrencyList = { /** - * Total number of currencies rows that matched your query. + * Total number of currencies documents that matched your query. */ total: number; /** @@ -374,7 +332,7 @@ export namespace Models { */ export type PhoneList = { /** - * Total number of phones rows that matched your query. + * Total number of phones documents that matched your query. */ total: number; /** @@ -388,7 +346,7 @@ export namespace Models { */ export type VariableList = { /** - * Total number of variables rows that matched your query. + * Total number of variables documents that matched your query. */ total: number; /** @@ -402,7 +360,7 @@ export namespace Models { */ export type LocaleCodeList = { /** - * Total number of localeCodes rows that matched your query. + * Total number of localeCodes documents that matched your query. */ total: number; /** @@ -416,7 +374,7 @@ export namespace Models { */ export type ProviderList = { /** - * Total number of providers rows that matched your query. + * Total number of providers documents that matched your query. */ total: number; /** @@ -430,7 +388,7 @@ export namespace Models { */ export type MessageList = { /** - * Total number of messages rows that matched your query. + * Total number of messages documents that matched your query. */ total: number; /** @@ -444,7 +402,7 @@ export namespace Models { */ export type TopicList = { /** - * Total number of topics rows that matched your query. + * Total number of topics documents that matched your query. */ total: number; /** @@ -458,7 +416,7 @@ export namespace Models { */ export type SubscriberList = { /** - * Total number of subscribers rows that matched your query. + * Total number of subscribers documents that matched your query. */ total: number; /** @@ -472,7 +430,7 @@ export namespace Models { */ export type TargetList = { /** - * Total number of targets rows that matched your query. + * Total number of targets documents that matched your query. */ total: number; /** @@ -486,7 +444,7 @@ export namespace Models { */ export type SpecificationList = { /** - * Total number of specifications rows that matched your query. + * Total number of specifications documents that matched your query. */ total: number; /** @@ -1070,682 +1028,47 @@ export namespace Models { } /** - * Table - */ - export type Table = { - /** - * Table ID. - */ - $id: string; - /** - * Table creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Table update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Database ID. - */ - databaseId: string; - /** - * Table name. - */ - name: string; - /** - * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - enabled: boolean; - /** - * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - rowSecurity: boolean; - /** - * Table columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; - /** - * Table indexes. - */ - indexes: ColumnIndex[]; - } - - /** - * Columns List - */ - export type ColumnList = { - /** - * Total number of columns in the given table. - */ - total: number; - /** - * List of columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString)[]; - } - - /** - * ColumnString - */ - export type ColumnString = { - /** - * 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; - /** - * Column size. - */ - size: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnInteger - */ - export type ColumnInteger = { - /** - * 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; - /** - * Minimum value to enforce for new documents. - */ - min?: number; - /** - * Maximum value to enforce for new documents. - */ - max?: number; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: number; - } - - /** - * ColumnFloat - */ - export type ColumnFloat = { - /** - * 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; - /** - * Minimum value to enforce for new documents. - */ - min?: number; - /** - * Maximum value to enforce for new documents. - */ - max?: number; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: number; - } - - /** - * ColumnBoolean + * Index */ - export type ColumnBoolean = { + export type Index = { /** - * Column Key. + * Index Key. */ key: string; /** - * Column type. + * Index type. */ type: string; /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Index 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 message. Displays error generated on failure of creating or deleting an index. */ 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 attribute when not provided. Cannot be set when attribute is required. - */ - default?: boolean; - } - - /** - * ColumnEmail - */ - export type ColumnEmail = { - /** - * 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. + * Index attributes. */ - error: string; + attributes: string[]; /** - * Is column required? + * Index attributes length. */ - required: boolean; + lengths: number[]; /** - * Is column an array? + * Index orders. */ - array?: boolean; + orders?: string[]; /** - * Column creation date in ISO 8601 format. + * Index creation date in ISO 8601 format. */ $createdAt: string; /** - * Column update date in ISO 8601 format. + * Index update date in ISO 8601 format. */ $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; } - /** - * ColumnEnum - */ - export type ColumnEnum = { - /** - * 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; - /** - * Array of elements in enumerated type. - */ - elements: string[]; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * ColumnIP - */ - export type ColumnIp = { - /** - * 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; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * ColumnURL - */ - export type ColumnUrl = { - /** - * 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; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnDatetime - */ - export type ColumnDatetime = { - /** - * 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; - /** - * ISO 8601 format. - */ - format: string; - /** - * Default value for attribute when not provided. Only null is optional - */ - default?: string; - } - - /** - * ColumnRelationship - */ - export type ColumnRelationship = { - /** - * 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; - /** - * The ID of the related table. - */ - relatedTable: string; - /** - * The type of the relationship. - */ - relationType: string; - /** - * Is the relationship two-way? - */ - twoWay: boolean; - /** - * The key of the two-way relationship. - */ - twoWayKey: string; - /** - * How deleting the parent document will propagate to child documents. - */ - onDelete: string; - /** - * Whether this is the parent or child side of the relationship - */ - side: string; - } - - /** - * Index - */ - export type Index = { - /** - * Index Key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: string; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index attributes. - */ - attributes: string[]; - /** - * Index attributes length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - } - - /** - * Index - */ - export type ColumnIndex = { - /** - * Index Key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: string; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index columns. - */ - columns: string[]; - /** - * Index columns length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - } - - /** - * Row - */ - export type Row = { - /** - * Row ID. - */ - $id: string; - /** - * Row automatically incrementing ID. - */ - $sequence: number; - /** - * Table ID. - */ - $tableId: string; - /** - * Database ID. - */ - $databaseId: string; - /** - * Row creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Row update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - } - - export type DefaultRow = Row & { - [key: string]: any; - [__default]: true; - }; - - export type DataWithoutRowKeys = { - [K in string]: any; - } & { - [K in keyof Row]?: never; - }; - /** * Document */ diff --git a/src/services/account.ts b/src/services/account.ts index 26e440c..4bb5f6a 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -847,7 +847,6 @@ export class Account { * @param {string} secret * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated. */ updateMagicURLSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { @@ -885,7 +884,6 @@ export class Account { * @param {string} secret * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated. */ updatePhoneSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { diff --git a/src/services/databases.ts b/src/services/databases.ts index c51e3d7..628239a 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -182,7 +182,6 @@ export class Databases { * @param {string} search * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.list` instead. */ listCollections(databaseId: string, queries?: string[], search?: string): Promise { if (typeof databaseId === 'undefined') { @@ -220,7 +219,6 @@ export class Databases { * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.create` instead. */ createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -270,7 +268,6 @@ export class Databases { * @param {string} collectionId * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.get` instead. */ getCollection(databaseId: string, collectionId: string): Promise { if (typeof databaseId === 'undefined') { @@ -305,7 +302,6 @@ export class Databases { * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.update` instead. */ updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -352,7 +348,6 @@ export class Databases { * @param {string} collectionId * @throws {AppwriteException} * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.delete` instead. */ deleteCollection(databaseId: string, collectionId: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -385,7 +380,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listColumns` instead. */ listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -424,7 +418,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createBooleanColumn` instead. */ createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -478,7 +471,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateBooleanColumn` instead. */ updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -532,7 +524,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createDatetimeColumn` instead. */ createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -586,7 +577,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateDatetimeColumn` instead. */ updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -641,7 +631,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEmailColumn` instead. */ createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -696,7 +685,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateEmailColumn` instead. */ updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -740,7 +728,7 @@ export class Databases { } /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. * * * @param {string} databaseId @@ -752,7 +740,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createEnumColumn` instead. */ createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -814,7 +801,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateEnumColumn` instead. */ updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -877,7 +863,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createFloatColumn` instead. */ createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -940,7 +925,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateFloatColumn` instead. */ updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1003,7 +987,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIntegerColumn` instead. */ createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1066,7 +1049,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateIntegerColumn` instead. */ updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1127,7 +1109,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIpColumn` instead. */ createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1182,7 +1163,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateIpColumn` instead. */ updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1239,7 +1219,6 @@ export class Databases { * @param {RelationMutate} onDelete * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRelationshipColumn` instead. */ createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { if (typeof databaseId === 'undefined') { @@ -1302,7 +1281,6 @@ export class Databases { * @param {boolean} encrypt * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createStringColumn` instead. */ createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1367,7 +1345,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateStringColumn` instead. */ updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1425,7 +1402,6 @@ export class Databases { * @param {boolean} array * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createUrlColumn` instead. */ createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { @@ -1480,7 +1456,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateUrlColumn` instead. */ updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1531,7 +1506,6 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getColumn` instead. */ getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -1566,7 +1540,6 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteColumn` instead. */ deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -1605,7 +1578,6 @@ export class Databases { * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRelationshipColumn` instead. */ updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { if (typeof databaseId === 'undefined') { @@ -1647,7 +1619,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead. */ listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { @@ -1684,7 +1655,6 @@ export class Databases { * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. */ createDocument(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -1734,7 +1704,6 @@ export class Databases { * @param {object[]} documents * @throws {AppwriteException} * @returns {Promise>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead. */ createDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { if (typeof databaseId === 'undefined') { @@ -1773,19 +1742,25 @@ export class Databases { * * @param {string} databaseId * @param {string} collectionId + * @param {object[]} documents * @throws {AppwriteException} * @returns {Promise>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead. */ - upsertDocuments(databaseId: string, collectionId: string): Promise> { + upsertDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } + if (typeof documents === 'undefined') { + throw new AppwriteException('Missing required parameter: "documents"'); + } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; + if (typeof documents !== 'undefined') { + payload['documents'] = documents; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1811,7 +1786,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead. */ updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { @@ -1852,7 +1826,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead. */ deleteDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { @@ -1889,7 +1862,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead. */ getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -1927,11 +1899,12 @@ export class Databases { * @param {string} databaseId * @param {string} collectionId * @param {string} documentId + * @param {object} data + * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead. */ - upsertDocument(databaseId: string, collectionId: string, documentId: string): Promise { + upsertDocument(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1941,8 +1914,17 @@ export class Databases { if (typeof documentId === 'undefined') { throw new AppwriteException('Missing required parameter: "documentId"'); } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1967,7 +1949,6 @@ export class Databases { * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead. */ updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -2009,7 +1990,6 @@ export class Databases { * @param {string} documentId * @throws {AppwriteException} * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteRow` instead. */ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> { if (typeof databaseId === 'undefined') { @@ -2048,7 +2028,6 @@ export class Databases { * @param {number} min * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead. */ decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise { if (typeof databaseId === 'undefined') { @@ -2096,7 +2075,6 @@ export class Databases { * @param {number} max * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead. */ incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise { if (typeof databaseId === 'undefined') { @@ -2141,7 +2119,6 @@ export class Databases { * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.listIndexes` instead. */ listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { @@ -2181,7 +2158,6 @@ export class Databases { * @param {number[]} lengths * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.createIndex` instead. */ createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[]): Promise { if (typeof databaseId === 'undefined') { @@ -2238,7 +2214,6 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.getIndex` instead. */ getIndex(databaseId: string, collectionId: string, key: string): Promise { if (typeof databaseId === 'undefined') { @@ -2273,7 +2248,6 @@ export class Databases { * @param {string} key * @throws {AppwriteException} * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead. */ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { diff --git a/src/services/tables.ts b/src/services/tables.ts deleted file mode 100644 index 9c8905b..0000000 --- a/src/services/tables.ts +++ /dev/null @@ -1,2085 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; -import { RelationshipType } from '../enums/relationship-type'; -import { RelationMutate } from '../enums/relation-mutate'; -import { IndexType } from '../enums/index-type'; - -export class Tables { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} databaseId - * @param {string[]} queries - * @param {string} search - * @throws {AppwriteException} - * @returns {Promise} - */ - list(databaseId: string, queries?: string[], search?: string): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - const apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} name - * @param {string[]} permissions - * @param {boolean} rowSecurity - * @param {boolean} enabled - * @throws {AppwriteException} - * @returns {Promise} - */ - create(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - const apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof tableId !== 'undefined') { - payload['tableId'] = tableId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - 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, - ); - } - - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param {string} databaseId - * @param {string} tableId - * @throws {AppwriteException} - * @returns {Promise} - */ - get(databaseId: string, tableId: string): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a table by its unique ID. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} name - * @param {string[]} permissions - * @param {boolean} rowSecurity - * @param {boolean} enabled - * @throws {AppwriteException} - * @returns {Promise} - */ - update(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} databaseId - * @param {string} tableId - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(databaseId: string, tableId: string): Promise<{}> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List attributes in the collection. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise} - */ - listColumns(databaseId: string, tableId: string, queries?: string[]): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a boolean column. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {boolean} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/boolean'.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; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 boolean column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {boolean} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/boolean/{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 date time column according to the ISO 8601 standard. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/datetime'.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; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 date time column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/datetime/{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 an email column. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/email'.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; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 an email column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/email/{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 an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {string[]} elements - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { - 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 elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 an enum column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {string[]} elements - * @param {boolean} required - * @param {string} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { - 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 elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - 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 float column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {number} min - * @param {number} max - * @param {number} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/float'.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 min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 float column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {number} xdefault - * @param {number} min - * @param {number} max - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - 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 an integer column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {number} min - * @param {number} max - * @param {number} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/integer'.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 min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 an integer column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {number} xdefault - * @param {number} min - * @param {number} max - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - 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 IP address column. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/ip'.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; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 an ip column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/ip/{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). - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} relatedTableId - * @param {RelationshipType} type - * @param {boolean} twoWay - * @param {string} key - * @param {string} twoWayKey - * @param {RelationMutate} onDelete - * @throws {AppwriteException} - * @returns {Promise} - */ - createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof relatedTableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedTableId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof relatedTableId !== 'undefined') { - payload['relatedTableId'] = relatedTableId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; - } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - 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, - ); - } - - /** - * Create a string column. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {number} size - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @param {boolean} encrypt - * @throws {AppwriteException} - * @returns {Promise} - */ - createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { - 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 size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - 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 string column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {number} size - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string/{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 size !== 'undefined') { - payload['size'] = size; - } - 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 URL column. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { - 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 = '/databases/{databaseId}/tables/{tableId}/columns/url'.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; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - 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 an url column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { - 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"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/url/{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, - ); - } - - /** - * Get column by ID. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - getColumn(databaseId: string, tableId: string, key: string): Promise<{}> { - 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"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Deletes a column. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}> { - 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"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {RelationMutate} onDelete - * @param {string} newKey - * @throws {AppwriteException} - * @returns {Promise} - */ - updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { - 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"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - 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, - ); - } - - /** - * List indexes in the collection. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise} - */ - listIndexes(databaseId: string, tableId: string, queries?: string[]): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @param {IndexType} type - * @param {string[]} columns - * @param {string[]} orders - * @param {number[]} lengths - * @throws {AppwriteException} - * @returns {Promise} - */ - createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[]): Promise { - 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 type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof columns === 'undefined') { - throw new AppwriteException('Missing required parameter: "columns"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof columns !== 'undefined') { - payload['columns'] = columns; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; - } - 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, - ); - } - - /** - * Get index by ID. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise} - */ - getIndex(databaseId: string, tableId: string, key: string): Promise { - 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"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an index. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}> { - 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"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise>} - */ - listRows(databaseId: string, tableId: string, queries?: string[]): Promise> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @param {object} data - * @param {string[]} permissions - * @throws {AppwriteException} - * @returns {Promise} - */ - createRow(databaseId: string, tableId: string, rowId: string, data: object, permissions?: string[]): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof rowId !== 'undefined') { - payload['rowId'] = rowId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - 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, - ); - } - - /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param {string} databaseId - * @param {string} tableId - * @param {object[]} rows - * @throws {AppwriteException} - * @returns {Promise>} - */ - createRows(databaseId: string, tableId: string, rows: object[]): Promise> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rows === 'undefined') { - throw new AppwriteException('Missing required parameter: "rows"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - 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, - ); - } - - /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * - * @param {string} databaseId - * @param {string} tableId - * @throws {AppwriteException} - * @returns {Promise>} - */ - upsertRows(databaseId: string, tableId: string): Promise> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - * - * @param {string} databaseId - * @param {string} tableId - * @param {object} data - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise>} - */ - updateRows(databaseId: string, tableId: string, data?: object, queries?: string[]): Promise> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - 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, - ); - } - - /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise>} - */ - deleteRows(databaseId: string, tableId: string, queries?: string[]): Promise> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @param {string[]} queries - * @throws {AppwriteException} - * @returns {Promise} - */ - getRow(databaseId: string, tableId: string, rowId: string, queries?: string[]): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @throws {AppwriteException} - * @returns {Promise} - */ - upsertRow(databaseId: string, tableId: string, rowId: string): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @param {object} data - * @param {string[]} permissions - * @throws {AppwriteException} - * @returns {Promise} - */ - updateRow(databaseId: string, tableId: string, rowId: string, data?: object, permissions?: string[]): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - 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, - ); - } - - /** - * Delete a row by its unique ID. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteRow(databaseId: string, tableId: string, rowId: string): Promise<{}> { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @param {string} column - * @param {number} value - * @param {number} min - * @throws {AppwriteException} - * @returns {Promise} - */ - decrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof column === 'undefined') { - throw new AppwriteException('Missing required parameter: "column"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - 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, - ); - } - - /** - * Increment a specific column of a row by a given value. - * - * @param {string} databaseId - * @param {string} tableId - * @param {string} rowId - * @param {string} column - * @param {number} value - * @param {number} max - * @throws {AppwriteException} - * @returns {Promise} - */ - incrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number): Promise { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof column === 'undefined') { - throw new AppwriteException('Missing required parameter: "column"'); - } - const apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - 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, - ); - } -}