From d7167a23f82b4eba29df400a1d414431041de2e0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Feb 2026 12:05:40 +0000 Subject: [PATCH 1/3] Add array-based enum parameters --- .github/workflows/publish.yml | 17 +- CHANGELOG.md | 6 +- LICENSE | 2 +- README.md | 4 +- docs/examples/account/create-jwt.md | 4 +- docs/examples/avatars/get-screenshot.md | 8 +- docs/examples/databases/create-index.md | 2 +- docs/examples/databases/update-collection.md | 2 +- docs/examples/databases/update-document.md | 8 +- docs/examples/databases/update-documents.md | 8 +- docs/examples/databases/update.md | 2 +- docs/examples/databases/upsert-document.md | 8 +- docs/examples/functions/create.md | 2 +- docs/examples/functions/update.md | 2 +- docs/examples/health/get-queue-audits.md | 12 + docs/examples/tablesdb/create-index.md | 2 +- docs/examples/tablesdb/update-row.md | 8 +- docs/examples/tablesdb/update-rows.md | 8 +- docs/examples/tablesdb/update-table.md | 2 +- docs/examples/tablesdb/update.md | 2 +- docs/examples/tablesdb/upsert-row.md | 8 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/update-membership.md | 2 +- package.json | 6 +- src/client.ts | 41 +++- src/enums/browser-permission.ts | 22 ++ src/enums/deployment-status.ts | 1 + src/enums/name.ts | 1 + src/enums/o-auth-provider.ts | 1 - src/enums/order-by.ts | 4 + src/enums/output.ts | 9 - src/enums/roles.ts | 5 + src/enums/scopes.ts | 57 +++++ src/index.ts | 7 +- src/models.ts | 38 ++- src/query.ts | 67 +++++- src/services/account.ts | 106 ++++++--- src/services/avatars.ts | 41 ++-- src/services/databases.ts | 236 +++++++++---------- src/services/functions.ts | 83 +++---- src/services/graphql.ts | 4 +- src/services/health.ts | 91 +++++-- src/services/messaging.ts | 112 ++++----- src/services/sites.ts | 48 ++-- src/services/storage.ts | 52 ++-- src/services/tables-db.ts | 225 +++++++++--------- src/services/teams.ts | 59 ++--- src/services/tokens.ts | 10 +- src/services/users.ts | 96 ++++---- 49 files changed, 927 insertions(+), 616 deletions(-) create mode 100644 docs/examples/health/get-queue-audits.md create mode 100644 src/enums/browser-permission.ts create mode 100644 src/enums/order-by.ts delete mode 100644 src/enums/output.ts create mode 100644 src/enums/roles.ts create mode 100644 src/enums/scopes.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9e8e716..41c7a69 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,10 @@ on: types: [published] workflow_dispatch: +permissions: + id-token: write + contents: read + jobs: publish: runs-on: ubuntu-latest @@ -12,14 +16,15 @@ jobs: steps: - uses: actions/checkout@v4 - # Setup Node.js environment - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version: '22' registry-url: 'https://registry.npmjs.org' - # Determine release tag based on the tag name + - name: Update npm to latest version for OIDC support + run: npm install -g npm@latest + - name: Determine release tag id: release_tag run: | @@ -29,14 +34,10 @@ jobs: echo "tag=latest" >> "$GITHUB_OUTPUT" fi - # Install dependencies (if any) and build your project (if necessary) - name: Install dependencies and build run: | npm install npm run build - # Publish to NPM with the appropriate tag - name: Publish - run: npm publish --tag ${{ steps.release_tag.outputs.tag }} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }} + run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }} diff --git a/CHANGELOG.md b/CHANGELOG.md index da425ad..864ca38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 22.0.0 + +* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). + ## 21.1.0 * Added ability to create columns and indexes synchronously while creating a table @@ -96,4 +100,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`. diff --git a/LICENSE b/LICENSE index c1602fc..6f8702b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 9cb41a6..4be156d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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.8.1-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) @@ -11,7 +11,7 @@ > 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) -Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 76d52e1..f5ddd7b 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -7,4 +7,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); -const result = await account.createJWT(); +const result = await account.createJWT({ + duration: 0 // optional +}); diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index dc63102..58522c7 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -16,19 +16,19 @@ const result = await avatars.getScreenshot({ viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: sdk.Theme.Light, // optional + theme: sdk.Theme.Dark, // optional userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional - timezone: sdk.Timezone.AfricaAbidjan, // optional + timezone: sdk.Timezone.AmericaNewYork, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: ["geolocation","notifications"], // optional + permissions: [sdk.BrowserPermission.Geolocation, sdk.BrowserPermission.Notifications], // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: sdk.Output.Jpg // optional + output: sdk.ImageFormat.Jpeg // optional }); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index ce5214a..97cae64 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -13,6 +13,6 @@ const result = await databases.createIndex({ key: '', type: sdk.IndexType.Key, attributes: [], - orders: [], // optional + orders: [sdk.OrderBy.Asc], // optional lengths: [] // optional }); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 4cdc3a2..a1cb513 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -10,7 +10,7 @@ const databases = new sdk.Databases(client); const result = await databases.updateCollection({ databaseId: '', collectionId: '', - name: '', + name: '', // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index d33d78d..7e1a8c5 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -11,7 +11,13 @@ const result = await databases.updateDocument({ databaseId: '', collectionId: '', documentId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index dc79e43..038ed1a 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -10,7 +10,13 @@ const databases = new sdk.Databases(client); const result = await databases.updateDocuments({ databaseId: '', collectionId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional queries: [], // optional transactionId: '' // optional }); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 9a0dbd2..5325acf 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -9,6 +9,6 @@ const databases = new sdk.Databases(client); const result = await databases.update({ databaseId: '', - name: '', + name: '', // optional enabled: false // optional }); diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 8fe4b35..55156bd 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -11,7 +11,13 @@ const result = await databases.upsertDocument({ databaseId: '', collectionId: '', documentId: '', - data: {}, + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 37ac89d..42fa14b 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -19,7 +19,7 @@ const result = await functions.create({ logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [sdk.Scopes.SessionsWrite], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 60653b5..e1004de 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -19,7 +19,7 @@ const result = await functions.update({ logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [sdk.Scopes.SessionsWrite], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 0000000..5b337f1 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,12 @@ +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 health = new sdk.Health(client); + +const result = await health.getQueueAudits({ + threshold: null // optional +}); diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index ec84b06..ca45922 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -13,6 +13,6 @@ const result = await tablesDB.createIndex({ key: '', type: sdk.IndexType.Key, columns: [], - orders: [], // optional + orders: [sdk.OrderBy.Asc], // optional lengths: [] // optional }); diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index d5d2ee3..8c003bf 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -11,7 +11,13 @@ const result = await tablesDB.updateRow({ databaseId: '', tableId: '', rowId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index d66fc28..b41f0c2 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -10,7 +10,13 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateRows({ databaseId: '', tableId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional queries: [], // optional transactionId: '' // optional }); diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 97483da..7a650b8 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -10,7 +10,7 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateTable({ databaseId: '', tableId: '', - name: '', + name: '', // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional rowSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 85f98ee..bc7f53e 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -9,6 +9,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.update({ databaseId: '', - name: '', + name: '', // optional enabled: false // optional }); diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index f48b0da..2905b31 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -11,7 +11,13 @@ const result = await tablesDB.upsertRow({ databaseId: '', tableId: '', rowId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 28cb901..f820002 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -9,7 +9,7 @@ const teams = new sdk.Teams(client); const result = await teams.createMembership({ teamId: '', - roles: [], + roles: [sdk.Roles.Admin], email: 'email@example.com', // optional userId: '', // optional phone: '+12065550100', // optional diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index f09e8e9..64f15ae 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -10,5 +10,5 @@ const teams = new sdk.Teams(client); const result = await teams.updateMembership({ teamId: '', membershipId: '', - roles: [] + roles: [sdk.Roles.Admin] }); diff --git a/package.json b/package.json index 560a05f..d30899d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "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": "21.1.0", + "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", + "version": "22.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", @@ -41,6 +41,7 @@ "url": "https://github.com/appwrite/sdk-for-node" }, "devDependencies": { + "@types/json-bigint": "1.0.4", "@types/node": "20.11.25", "tsup": "7.2.0", "esbuild-plugin-file-path-extensions": "^2.0.0", @@ -48,6 +49,7 @@ "typescript": "5.4.2" }, "dependencies": { + "json-bigint": "1.0.0", "node-fetch-native-with-agent": "1.7.2" } } diff --git a/src/client.ts b/src/client.ts index 564b24a..9e66d01 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,6 +1,33 @@ import { fetch, FormData, File } from 'node-fetch-native-with-agent'; import { createAgent } from 'node-fetch-native-with-agent/agent'; import { Models } from './models'; +import JSONbigModule from 'json-bigint'; +import BigNumber from 'bignumber.js'; +const JSONbigParser = JSONbigModule({ storeAsString: false }); +const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true }); + +const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER); +const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER); + +function reviver(_key: string, value: any): any { + if (BigNumber.isBigNumber(value)) { + if (value.isInteger()) { + const str = value.toFixed(); + const bi = BigInt(str); + if (bi >= MIN_SAFE && bi <= MAX_SAFE) { + return Number(str); + } + return bi; + } + return value.toNumber(); + } + return value; +} + +const JSONbig = { + parse: (text: string) => JSONbigParser.parse(text, reviver), + stringify: JSONbigSerializer.stringify +}; type Payload = { [key: string]: any; @@ -33,7 +60,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/21.1.0'; + let ua = 'AppwriteNodeJSSDK/22.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +109,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '21.1.0', + 'x-sdk-version': '22.0.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; @@ -97,6 +124,10 @@ class Client { * @returns {this} */ setEndpoint(endpoint: string): this { + if (!endpoint || typeof endpoint !== 'string') { + throw new AppwriteException('Endpoint must be a valid string'); + } + if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { throw new AppwriteException('Invalid endpoint URL: ' + endpoint); } @@ -238,7 +269,7 @@ class Client { } else { switch (headers['content-type']) { case 'application/json': - options.body = JSON.stringify(params); + options.body = JSONbig.stringify(params); break; case 'multipart/form-data': @@ -345,7 +376,7 @@ class Client { } if (response.headers.get('content-type')?.includes('application/json')) { - data = await response.json(); + data = JSONbig.parse(await response.text()); } else if (responseType === 'arrayBuffer') { data = await response.arrayBuffer(); } else { @@ -357,7 +388,7 @@ class Client { if (400 <= response.status) { let responseText = ''; if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') { - responseText = JSON.stringify(data); + responseText = JSONbig.stringify(data); } else { responseText = data?.message; } diff --git a/src/enums/browser-permission.ts b/src/enums/browser-permission.ts new file mode 100644 index 0000000..6e2c4cd --- /dev/null +++ b/src/enums/browser-permission.ts @@ -0,0 +1,22 @@ +export enum BrowserPermission { + Geolocation = 'geolocation', + Camera = 'camera', + Microphone = 'microphone', + Notifications = 'notifications', + Midi = 'midi', + Push = 'push', + Clipboardread = 'clipboard-read', + Clipboardwrite = 'clipboard-write', + Paymenthandler = 'payment-handler', + Usb = 'usb', + Bluetooth = 'bluetooth', + Accelerometer = 'accelerometer', + Gyroscope = 'gyroscope', + Magnetometer = 'magnetometer', + Ambientlightsensor = 'ambient-light-sensor', + Backgroundsync = 'background-sync', + Persistentstorage = 'persistent-storage', + Screenwakelock = 'screen-wake-lock', + Webshare = 'web-share', + Xrspatialtracking = 'xr-spatial-tracking', +} \ No newline at end of file diff --git a/src/enums/deployment-status.ts b/src/enums/deployment-status.ts index 34aa1fd..7e8f4a1 100644 --- a/src/enums/deployment-status.ts +++ b/src/enums/deployment-status.ts @@ -3,5 +3,6 @@ export enum DeploymentStatus { Processing = 'processing', Building = 'building', Ready = 'ready', + Canceled = 'canceled', Failed = 'failed', } \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts index 76e8469..8cd297b 100644 --- a/src/enums/name.ts +++ b/src/enums/name.ts @@ -9,6 +9,7 @@ export enum Name { V1webhooks = 'v1-webhooks', V1certificates = 'v1-certificates', V1builds = 'v1-builds', + V1screenshots = 'v1-screenshots', V1messaging = 'v1-messaging', V1migrations = 'v1-migrations', } \ No newline at end of file diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index 7a3fcb3..3382e3b 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -38,5 +38,4 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', - Mock = 'mock', } \ No newline at end of file diff --git a/src/enums/order-by.ts b/src/enums/order-by.ts new file mode 100644 index 0000000..62dffb9 --- /dev/null +++ b/src/enums/order-by.ts @@ -0,0 +1,4 @@ +export enum OrderBy { + Asc = 'asc', + Desc = 'desc', +} \ No newline at end of file diff --git a/src/enums/output.ts b/src/enums/output.ts deleted file mode 100644 index c339a51..0000000 --- a/src/enums/output.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum Output { - Jpg = 'jpg', - Jpeg = 'jpeg', - Png = 'png', - Webp = 'webp', - Heic = 'heic', - Avif = 'avif', - Gif = 'gif', -} \ No newline at end of file diff --git a/src/enums/roles.ts b/src/enums/roles.ts new file mode 100644 index 0000000..f548f93 --- /dev/null +++ b/src/enums/roles.ts @@ -0,0 +1,5 @@ +export enum Roles { + Admin = 'admin', + Developer = 'developer', + Owner = 'owner', +} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts new file mode 100644 index 0000000..70ef50f --- /dev/null +++ b/src/enums/scopes.ts @@ -0,0 +1,57 @@ +export enum Scopes { + SessionsWrite = 'sessions.write', + UsersRead = 'users.read', + UsersWrite = 'users.write', + TeamsRead = 'teams.read', + TeamsWrite = 'teams.write', + DatabasesRead = 'databases.read', + DatabasesWrite = 'databases.write', + CollectionsRead = 'collections.read', + CollectionsWrite = 'collections.write', + TablesRead = 'tables.read', + TablesWrite = 'tables.write', + AttributesRead = 'attributes.read', + AttributesWrite = 'attributes.write', + ColumnsRead = 'columns.read', + ColumnsWrite = 'columns.write', + IndexesRead = 'indexes.read', + IndexesWrite = 'indexes.write', + DocumentsRead = 'documents.read', + DocumentsWrite = 'documents.write', + RowsRead = 'rows.read', + RowsWrite = 'rows.write', + FilesRead = 'files.read', + FilesWrite = 'files.write', + BucketsRead = 'buckets.read', + BucketsWrite = 'buckets.write', + FunctionsRead = 'functions.read', + FunctionsWrite = 'functions.write', + SitesRead = 'sites.read', + SitesWrite = 'sites.write', + LogRead = 'log.read', + LogWrite = 'log.write', + ExecutionRead = 'execution.read', + ExecutionWrite = 'execution.write', + LocaleRead = 'locale.read', + AvatarsRead = 'avatars.read', + HealthRead = 'health.read', + ProvidersRead = 'providers.read', + ProvidersWrite = 'providers.write', + MessagesRead = 'messages.read', + MessagesWrite = 'messages.write', + TopicsRead = 'topics.read', + TopicsWrite = 'topics.write', + SubscribersRead = 'subscribers.read', + SubscribersWrite = 'subscribers.write', + TargetsRead = 'targets.read', + TargetsWrite = 'targets.write', + RulesRead = 'rules.read', + RulesWrite = 'rules.write', + MigrationsRead = 'migrations.read', + MigrationsWrite = 'migrations.write', + VcsRead = 'vcs.read', + VcsWrite = 'vcs.write', + AssistantRead = 'assistant.read', + TokensRead = 'tokens.read', + TokensWrite = 'tokens.write', +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 7dbc903..781f13a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,11 +27,14 @@ export { CreditCard } from './enums/credit-card'; export { Flag } from './enums/flag'; export { Theme } from './enums/theme'; export { Timezone } from './enums/timezone'; -export { Output } from './enums/output'; +export { BrowserPermission } from './enums/browser-permission'; +export { ImageFormat } from './enums/image-format'; export { RelationshipType } from './enums/relationship-type'; export { RelationMutate } from './enums/relation-mutate'; export { IndexType } from './enums/index-type'; +export { OrderBy } from './enums/order-by'; export { Runtime } from './enums/runtime'; +export { Scopes } from './enums/scopes'; export { TemplateReferenceType } from './enums/template-reference-type'; export { VCSReferenceType } from './enums/vcs-reference-type'; export { DeploymentDownloadType } from './enums/deployment-download-type'; @@ -44,7 +47,7 @@ export { BuildRuntime } from './enums/build-runtime'; export { Adapter } from './enums/adapter'; export { Compression } from './enums/compression'; export { ImageGravity } from './enums/image-gravity'; -export { ImageFormat } from './enums/image-format'; +export { Roles } from './enums/roles'; export { PasswordHash } from './enums/password-hash'; export { MessagingProviderType } from './enums/messaging-provider-type'; export { DatabaseType } from './enums/database-type'; diff --git a/src/models.ts b/src/models.ts index 7c27b05..0d1b832 100644 --- a/src/models.ts +++ b/src/models.ts @@ -408,6 +408,20 @@ export namespace Models { variables: Variable[]; } + /** + * Status List + */ + export type HealthStatusList = { + /** + * Total number of statuses that matched your query. + */ + total: number; + /** + * List of statuses. + */ + statuses: HealthStatus[]; + } + /** * Locale codes list */ @@ -699,11 +713,11 @@ export namespace Models { /** * Minimum value to enforce for new documents. */ - min?: number; + min?: number | bigint; /** * Maximum value to enforce for new documents. */ - max?: number; + max?: number | bigint; /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ @@ -1373,11 +1387,11 @@ export namespace Models { /** * Minimum value to enforce for new documents. */ - min?: number; + min?: number | bigint; /** * Maximum value to enforce for new documents. */ - max?: number; + max?: number | bigint; /** * Default value for column when not provided. Cannot be set when column is required. */ @@ -2665,6 +2679,14 @@ export namespace Models { * Total number of chunks uploaded */ chunksUploaded: number; + /** + * Whether file contents are encrypted at rest. + */ + encryption: boolean; + /** + * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + */ + compression: string; } /** @@ -2708,7 +2730,7 @@ export namespace Models { */ allowedFileExtensions: string[]; /** - * Compression algorithm choosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). */ compression: string; /** @@ -2723,6 +2745,10 @@ export namespace Models { * Image transformations are enabled. */ transformations: boolean; + /** + * Total size of this bucket in bytes. + */ + totalSize: number; } /** @@ -3238,7 +3264,7 @@ export namespace Models { */ screenshotDark: string; /** - * The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". + * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". */ status: DeploymentStatus; /** diff --git a/src/query.ts b/src/query.ts index 4ebd532..66ddc87 100644 --- a/src/query.ts +++ b/src/query.ts @@ -1,5 +1,8 @@ -type QueryTypesSingle = string | number | boolean; -export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[]; +import JSONbigModule from 'json-bigint'; +const JSONbig = JSONbigModule({ useNativeBigInt: true }); + +type QueryTypesSingle = string | number | bigint | boolean; +export type QueryTypesList = string[] | number[] | bigint[] | boolean[] | Query[] | any[]; export type QueryTypes = QueryTypesSingle | QueryTypesList; type AttributesTypes = string | string[]; @@ -41,7 +44,7 @@ export class Query { * @returns {string} */ toString(): string { - return JSON.stringify({ + return JSONbig.stringify({ method: this.method, attribute: this.attribute, values: this.values, @@ -68,6 +71,16 @@ export class Query { static notEqual = (attribute: string, value: QueryTypes): string => new Query("notEqual", attribute, value).toString(); + /** + * Filter resources where attribute matches a regular expression pattern. + * + * @param {string} attribute The attribute to filter on. + * @param {string} pattern The regular expression pattern to match. + * @returns {string} + */ + static regex = (attribute: string, pattern: string): string => + new Query("regex", attribute, pattern).toString(); + /** * Filter resources where attribute is less than value. * @@ -126,15 +139,33 @@ export class Query { static isNotNull = (attribute: string): string => new Query("isNotNull", attribute).toString(); + /** + * Filter resources where the specified attributes exist. + * + * @param {string[]} attributes The list of attributes that must exist. + * @returns {string} + */ + static exists = (attributes: string[]): string => + new Query("exists", undefined, attributes).toString(); + + /** + * Filter resources where the specified attributes do not exist. + * + * @param {string[]} attributes The list of attributes that must not exist. + * @returns {string} + */ + static notExists = (attributes: string[]): string => + new Query("notExists", undefined, attributes).toString(); + /** * Filter resources where attribute is between start and end (inclusive). * * @param {string} attribute - * @param {string | number} start - * @param {string | number} end + * @param {string | number | bigint} start + * @param {string | number | bigint} end * @returns {string} */ - static between = (attribute: string, start: string | number, end: string | number): string => + static between = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => new Query("between", attribute, [start, end] as QueryTypesList).toString(); /** @@ -274,11 +305,11 @@ export class Query { * Filter resources where attribute is not between start and end (exclusive). * * @param {string} attribute - * @param {string | number} start - * @param {string | number} end + * @param {string | number | bigint} start + * @param {string | number | bigint} end * @returns {string} */ - static notBetween = (attribute: string, start: string | number, end: string | number): string => + static notBetween = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => new Query("notBetween", attribute, [start, end] as QueryTypesList).toString(); /** @@ -364,7 +395,7 @@ export class Query { * @returns {string} */ static or = (queries: string[]) => - new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString(); + new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString(); /** * Combine multiple queries using logical AND operator. @@ -373,7 +404,21 @@ export class Query { * @returns {string} */ static and = (queries: string[]) => - new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString(); + new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString(); + + /** + * Filter array elements where at least one element matches all the specified queries. + * + * @param {string} attribute The attribute containing the array to filter on. + * @param {string[]} queries The list of query strings to match against array elements. + * @returns {string} + */ + static elemMatch = (attribute: string, queries: string[]): string => + new Query( + "elemMatch", + attribute, + queries.map((query) => JSONbig.parse(query)) + ).toString(); /** * Filter resources where attribute is at a specific distance from the given coordinates. diff --git a/src/services/account.ts b/src/services/account.ts index 26bd2bc..2f16469 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -45,7 +45,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { userId: string, email: string, password: string, name?: string }): Promise>; + create(params: { userId: string, email: string, password: string, name?: string }): Promise>; /** * 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). * @@ -128,7 +128,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(params: { email: string, password: string }): Promise>; + updateEmail(params: { email: string, password: string }): Promise>; /** * 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. @@ -196,7 +196,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[], total?: boolean }): Promise; + listIdentities(params?: { queries?: string[], total?: boolean }): Promise; /** * Get the list of identities for the currently logged in user. * @@ -254,7 +254,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteIdentity(params: { identityId: string }): Promise<{}>; + deleteIdentity(params: { identityId: string }): Promise<{}>; /** * Delete an identity by its unique ID. * @@ -302,13 +302,41 @@ export class Account { /** * 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. * + * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. * @throws {AppwriteException} * @returns {Promise} */ - createJWT(): Promise { + createJWT(params?: { duration?: number }): Promise; + /** + * 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. + * + * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createJWT(duration?: number): Promise; + createJWT( + paramsOrFirst?: { duration?: number } | number + ): Promise { + let params: { duration?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { duration?: number }; + } else { + params = { + duration: paramsOrFirst as number + }; + } + + const duration = params.duration; + const apiPath = '/account/jwts'; const payload: Payload = {}; + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -331,7 +359,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params?: { queries?: string[], total?: boolean }): Promise; + listLogs(params?: { queries?: string[], total?: boolean }): Promise; /** * 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. * @@ -389,7 +417,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(params: { mfa: boolean }): Promise>; + updateMFA(params: { mfa: boolean }): Promise>; /** * Enable or disable MFA on an account. * @@ -445,7 +473,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead. */ - createMfaAuthenticator(params: { type: AuthenticatorType }): Promise; + createMfaAuthenticator(params: { type: AuthenticatorType }): Promise; /** * 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. * @@ -497,7 +525,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMFAAuthenticator(params: { type: AuthenticatorType }): Promise; + createMFAAuthenticator(params: { type: AuthenticatorType }): Promise; /** * 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. * @@ -551,7 +579,7 @@ export class Account { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead. */ - updateMfaAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; + updateMfaAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -614,7 +642,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFAAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; + updateMFAAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -677,7 +705,7 @@ export class Account { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead. */ - deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; + deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; /** * Delete an authenticator for a user by ID. * @@ -729,7 +757,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; + deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; /** * Delete an authenticator for a user by ID. * @@ -782,7 +810,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead. */ - createMfaChallenge(params: { factor: AuthenticationFactor }): Promise; + createMfaChallenge(params: { factor: AuthenticationFactor }): Promise; /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -837,7 +865,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMFAChallenge(params: { factor: AuthenticationFactor }): Promise; + createMFAChallenge(params: { factor: AuthenticationFactor }): Promise; /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -894,7 +922,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead. */ - updateMfaChallenge(params: { challengeId: string, otp: string }): Promise; + updateMfaChallenge(params: { challengeId: string, otp: string }): Promise; /** * 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. * @@ -960,7 +988,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateMFAChallenge(params: { challengeId: string, otp: string }): Promise; + updateMFAChallenge(params: { challengeId: string, otp: string }): Promise; /** * 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. * @@ -1217,7 +1245,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { name: string }): Promise>; + updateName(params: { name: string }): Promise>; /** * Update currently logged in user account name. * @@ -1273,7 +1301,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(params: { password: string, oldPassword?: string }): Promise>; + updatePassword(params: { password: string, oldPassword?: string }): Promise>; /** * 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. * @@ -1336,7 +1364,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(params: { phone: string, password: string }): Promise>; + updatePhone(params: { phone: string, password: string }): Promise>; /** * 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. * @@ -1424,7 +1452,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePrefs(params: { prefs: Partial }): Promise>; + updatePrefs(params: { prefs: Partial }): Promise>; /** * 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. * @@ -1480,7 +1508,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createRecovery(params: { email: string, url: string }): Promise; + createRecovery(params: { email: string, url: string }): Promise; /** * 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. * @@ -1549,7 +1577,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateRecovery(params: { userId: string, secret: string, password: string }): Promise; + updateRecovery(params: { userId: string, secret: string, password: string }): Promise; /** * 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. * @@ -1699,7 +1727,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createEmailPasswordSession(params: { email: string, password: string }): Promise; + createEmailPasswordSession(params: { email: string, password: string }): Promise; /** * 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. * @@ -1768,7 +1796,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ - updateMagicURLSession(params: { userId: string, secret: string }): Promise; + updateMagicURLSession(params: { userId: string, secret: string }): Promise; /** * 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. * @@ -1835,7 +1863,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ - updatePhoneSession(params: { userId: string, secret: string }): Promise; + updatePhoneSession(params: { userId: string, secret: string }): Promise; /** * 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. * @@ -1901,7 +1929,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createSession(params: { userId: string, secret: string }): Promise; + createSession(params: { userId: string, secret: string }): Promise; /** * 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. * @@ -1966,7 +1994,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - getSession(params: { sessionId: string }): Promise; + getSession(params: { sessionId: string }): Promise; /** * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. * @@ -2017,7 +2045,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateSession(params: { sessionId: string }): Promise; + updateSession(params: { sessionId: string }): Promise; /** * 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. * @@ -2069,7 +2097,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSession(params: { sessionId: string }): Promise<{}>; + deleteSession(params: { sessionId: string }): Promise<{}>; /** * 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. * @@ -2150,7 +2178,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise; + createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise; /** * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. 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. * @@ -2230,7 +2258,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise; + createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise; /** * 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. * @@ -2317,7 +2345,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): Promise; + createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): Promise; /** * 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. * @@ -2394,7 +2422,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createPhoneToken(params: { userId: string, phone: string }): Promise; + createPhoneToken(params: { userId: string, phone: string }): Promise; /** * 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. * @@ -2464,7 +2492,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createEmailVerification(params: { url: string }): Promise; + createEmailVerification(params: { url: string }): Promise; /** * 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. * @@ -2526,7 +2554,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead. */ - createVerification(params: { url: string }): Promise; + createVerification(params: { url: string }): Promise; /** * 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. * @@ -2585,7 +2613,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailVerification(params: { userId: string, secret: string }): Promise; + updateEmailVerification(params: { userId: string, secret: string }): Promise; /** * 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. * @@ -2652,7 +2680,7 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. */ - updateVerification(params: { userId: string, secret: string }): Promise; + updateVerification(params: { userId: string, secret: string }): Promise; /** * 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. * @@ -2742,7 +2770,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updatePhoneVerification(params: { userId: string, secret: string }): Promise; + updatePhoneVerification(params: { userId: string, secret: string }): Promise; /** * 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 68e83d1..0700aaa 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -6,7 +6,8 @@ import { CreditCard } from '../enums/credit-card'; import { Flag } from '../enums/flag'; import { Theme } from '../enums/theme'; import { Timezone } from '../enums/timezone'; -import { Output } from '../enums/output'; +import { BrowserPermission } from '../enums/browser-permission'; +import { ImageFormat } from '../enums/image-format'; export class Avatars { client: Client; @@ -27,7 +28,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise; + getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise; /** * 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. * @@ -106,7 +107,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise; + getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise; /** * 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. * @@ -182,7 +183,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getFavicon(params: { url: string }): Promise; + getFavicon(params: { url: string }): Promise; /** * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. * @@ -245,7 +246,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise; + getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise; /** * 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. * @@ -325,7 +326,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getImage(params: { url: string, width?: number, height?: number }): Promise; + getImage(params: { url: string, width?: number, height?: number }): Promise; /** * 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. * @@ -405,7 +406,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise; + getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise; /** * 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. * @@ -485,7 +486,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise; + getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise; /** * 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. * @@ -574,16 +575,16 @@ export class Avatars { * @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. * @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. * @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - * @param {string[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + * @param {BrowserPermission[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. * @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. * @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). * @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). * @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {Output} params.output - Output format type (jpeg, jpg, png, gif and webp). + * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp). * @throws {AppwriteException} * @returns {Promise} */ - getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output }): Promise; + getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise; /** * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. * @@ -605,25 +606,25 @@ export class Avatars { * @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. * @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. * @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - * @param {string[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + * @param {BrowserPermission[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. * @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. * @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). * @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). * @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {Output} output - Output format type (jpeg, jpg, png, gif and webp). + * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp). * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output): Promise; + getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise; getScreenshot( - paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output } | string, - ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (string[])?, (number)?, (number)?, (number)?, (number)?, (Output)?] + paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, + ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] ): Promise { - let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output }; + let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output }; + params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; } else { params = { url: paramsOrFirst as string, @@ -640,12 +641,12 @@ export class Avatars { longitude: rest[10] as number, accuracy: rest[11] as number, touch: rest[12] as boolean, - permissions: rest[13] as string[], + permissions: rest[13] as BrowserPermission[], sleep: rest[14] as number, width: rest[15] as number, height: rest[16] as number, quality: rest[17] as number, - output: rest[18] as Output + output: rest[18] as ImageFormat }; } diff --git a/src/services/databases.ts b/src/services/databases.ts index ad69b3e..86fdbd7 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -4,6 +4,7 @@ import type { Models } from '../models'; import { RelationshipType } from '../enums/relationship-type'; import { RelationMutate } from '../enums/relation-mutate'; import { IndexType } from '../enums/index-type'; +import { OrderBy } from '../enums/order-by'; export class Databases { client: Client; @@ -22,7 +23,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -90,7 +91,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; /** * Create a new Database. * @@ -162,7 +163,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - listTransactions(params?: { queries?: string[] }): Promise; + listTransactions(params?: { queries?: string[] }): Promise; /** * List transactions across all databases. * @@ -213,7 +214,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - createTransaction(params?: { ttl?: number }): Promise; + createTransaction(params?: { ttl?: number }): Promise; /** * Create a new transaction. * @@ -265,7 +266,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - getTransaction(params: { transactionId: string }): Promise; + getTransaction(params: { transactionId: string }): Promise; /** * Get a transaction by its unique ID. * @@ -318,7 +319,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; + updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; /** * Update a transaction, to either commit or roll back its operations. * @@ -383,7 +384,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTransaction(params: { transactionId: string }): Promise<{}>; + deleteTransaction(params: { transactionId: string }): Promise<{}>; /** * Delete a transaction by its unique ID. * @@ -436,7 +437,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise; + createOperations(params: { transactionId: string, operations?: object[] }): Promise; /** * Create multiple operations in a single transaction. * @@ -496,7 +497,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. */ - get(params: { databaseId: string }): Promise; + get(params: { databaseId: string }): Promise; /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -550,7 +551,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. */ - update(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise; /** * Update a database by its unique ID. * @@ -561,15 +562,15 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name: string, enabled?: boolean): Promise; + update(databaseId: string, name?: string, enabled?: boolean): Promise; update( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean }; + let params: { databaseId: string, name?: string, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -585,9 +586,6 @@ export class Databases { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); const payload: Payload = {}; @@ -619,7 +617,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. */ - delete(params: { databaseId: string }): Promise<{}>; + delete(params: { databaseId: string }): Promise<{}>; /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -675,7 +673,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. */ - listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -753,7 +751,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. */ - createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise; + createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise; /** * 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. * @@ -856,7 +854,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. */ - getCollection(params: { databaseId: string, collectionId: string }): Promise; + getCollection(params: { databaseId: string, collectionId: string }): Promise; /** * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * @@ -920,7 +918,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. */ - updateCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }): Promise; + updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }): Promise; /** * Update a collection by its unique ID. * @@ -934,15 +932,15 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise; + updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise; updateCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean } | string, + paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; + let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -967,9 +965,6 @@ export class Databases { if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; @@ -1008,7 +1003,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. */ - deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; + deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; /** * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * @@ -1071,7 +1066,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. */ - listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; + listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; /** * List attributes in the collection. * @@ -1148,7 +1143,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. */ - createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise; + createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise; /** * Create a boolean attribute. * @@ -1244,7 +1239,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. */ - updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise; + updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise; /** * Update a boolean attribute. Changing the `default` value will not update already existing documents. * @@ -1339,7 +1334,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. */ - createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create a date time attribute according to the ISO 8601 standard. * @@ -1434,7 +1429,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. */ - updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update a date time attribute. Changing the `default` value will not update already existing documents. * @@ -1530,7 +1525,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. */ - createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create an email attribute. * @@ -1627,7 +1622,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. */ - updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an email attribute. Changing the `default` value will not update already existing documents. * @@ -1725,7 +1720,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. */ - createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise; + createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. * @@ -1832,7 +1827,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. */ - updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an enum attribute. Changing the `default` value will not update already existing documents. * @@ -1940,7 +1935,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. */ - createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; + createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; /** * Create a float attribute. Optionally, minimum and maximum values can be provided. * @@ -2051,7 +2046,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. */ - updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; + updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; /** * Update a float attribute. Changing the `default` value will not update already existing documents. * @@ -2154,15 +2149,15 @@ export class Databases { * @param {string} params.collectionId - Collection ID. * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {number} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. */ - createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; + createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise; /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. * @@ -2171,32 +2166,32 @@ export class Databases { * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {number} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise; + createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise; createIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, array: rest[6] as boolean }; } @@ -2265,15 +2260,15 @@ export class Databases { * @param {string} params.collectionId - Collection ID. * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {number} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. */ - updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; + updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise; /** * Update an integer attribute. Changing the `default` value will not update already existing documents. * @@ -2282,32 +2277,32 @@ export class Databases { * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {number} xdefault - Default value. Cannot be set when attribute is required. - * @param {number} min - Minimum value - * @param {number} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise; + updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise; updateIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, newKey: rest[6] as string }; } @@ -2382,7 +2377,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. */ - createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create IP address attribute. * @@ -2479,7 +2474,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. */ - updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an ip attribute. Changing the `default` value will not update already existing documents. * @@ -2574,7 +2569,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. */ - createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric line attribute. * @@ -2663,7 +2658,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. */ - updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a line attribute. Changing the `default` value will not update already existing documents. * @@ -2754,7 +2749,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. */ - createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric point attribute. * @@ -2843,7 +2838,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. */ - updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a point attribute. Changing the `default` value will not update already existing documents. * @@ -2934,7 +2929,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. */ - createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric polygon attribute. * @@ -3023,7 +3018,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. */ - updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a polygon attribute. Changing the `default` value will not update already existing documents. * @@ -3118,7 +3113,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. */ - createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -3229,7 +3224,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. */ - createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a string attribute. * @@ -3342,7 +3337,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. */ - updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; /** * Update a string attribute. Changing the `default` value will not update already existing documents. * @@ -3445,7 +3440,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. */ - createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create a URL attribute. * @@ -3542,7 +3537,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. */ - updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an url attribute. Changing the `default` value will not update already existing documents. * @@ -3632,10 +3627,10 @@ export class Databases { * @param {string} params.collectionId - Collection ID. * @param {string} params.key - Attribute Key. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. */ - getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise; /** * Get attribute by ID. * @@ -3643,14 +3638,14 @@ export class Databases { * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>; + getAttribute(databaseId: string, collectionId: string, key: string): Promise; getAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, ...rest: [(string)?, (string)?] - ): Promise<{}> { + ): Promise { let params: { databaseId: string, collectionId: string, key: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -3702,7 +3697,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. */ - deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; /** * Deletes an attribute. * @@ -3773,7 +3768,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; /** * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -3856,7 +3851,7 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -3938,7 +3933,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. */ - createDocument(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; + createDocument(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; /** * 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. * @@ -4031,7 +4026,7 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. */ - createDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; + createDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; /** * 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. * @@ -4110,7 +4105,7 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. */ - upsertDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; + upsertDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; /** * 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. * @@ -4190,7 +4185,7 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. */ - updateDocuments(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; + updateDocuments(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; /** * 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. * @@ -4271,7 +4266,7 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. */ - deleteDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise>; + deleteDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise>; /** * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * @@ -4347,7 +4342,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. */ - getDocument(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise; + getDocument(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise; /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * @@ -4429,7 +4424,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. */ - upsertDocument(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + upsertDocument(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; /** * 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. * @@ -4443,15 +4438,15 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertDocument(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; + upsertDocument(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; upsertDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>)?, (string[])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -4479,9 +4474,6 @@ 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 = {}; @@ -4521,7 +4513,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. */ - updateDocument(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + updateDocument(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -4608,7 +4600,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. */ - deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>; + deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>; /** * Delete a document by its unique ID. * @@ -4686,7 +4678,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. */ - decrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }): Promise; + decrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }): Promise; /** * Decrement a specific attribute of a document by a given value. * @@ -4782,7 +4774,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. */ - incrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }): Promise; + incrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }): Promise; /** * Increment a specific attribute of a document by a given value. * @@ -4875,7 +4867,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. */ - listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; + listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; /** * List indexes in the collection. * @@ -4947,13 +4939,13 @@ export class Databases { * @param {string} params.key - Index Key. * @param {IndexType} params.type - Index type. * @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {string[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. * @param {number[]} params.lengths - Length of index. Maximum of 100 * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. */ - createIndex(params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[] }): Promise; + createIndex(params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise; /** * 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`. @@ -4963,21 +4955,21 @@ export class Databases { * @param {string} key - Index Key. * @param {IndexType} type - Index type. * @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {string[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. * @param {number[]} lengths - Length of index. Maximum of 100 * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[]): Promise; + createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise; createIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, (number[])?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (OrderBy[])?, (number[])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[] }; + let params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; } else { params = { databaseId: paramsOrFirst as string, @@ -4985,7 +4977,7 @@ export class Databases { key: rest[1] as string, type: rest[2] as IndexType, attributes: rest[3] as string[], - orders: rest[4] as string[], + orders: rest[4] as OrderBy[], lengths: rest[5] as number[] }; } @@ -5055,7 +5047,7 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. */ - getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise; + getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise; /** * Get an index by its unique ID. * @@ -5122,7 +5114,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. */ - deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; /** * Delete an index. * diff --git a/src/services/functions.ts b/src/services/functions.ts index aa14dcd..1daf8ba 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -2,6 +2,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { Runtime } from '../enums/runtime'; +import { Scopes } from '../enums/scopes'; import { TemplateReferenceType } from '../enums/template-reference-type'; import { VCSReferenceType } from '../enums/vcs-reference-type'; import { DeploymentDownloadType } from '../enums/deployment-download-type'; @@ -23,7 +24,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the project's functions. You can use the query params to filter your results. * @@ -94,7 +95,7 @@ export class Functions { * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} params.commands - Build Commands. - * @param {string[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. * @param {string} params.providerBranch - Production branch for the repo linked to the function. @@ -104,7 +105,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; + create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; /** * 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. * @@ -119,7 +120,7 @@ export class Functions { * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} commands - Build Commands. - * @param {string[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. * @param {string} providerBranch - Production branch for the repo linked to the function. @@ -130,15 +131,15 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise; + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise; create( - paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (string[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?] ): Promise { - let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; + let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; } else { params = { functionId: paramsOrFirst as string, @@ -152,7 +153,7 @@ export class Functions { logging: rest[7] as boolean, entrypoint: rest[8] as string, commands: rest[9] as string, - scopes: rest[10] as string[], + scopes: rest[10] as Scopes[], installationId: rest[11] as string, providerRepositoryId: rest[12] as string, providerBranch: rest[13] as string, @@ -314,7 +315,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - get(params: { functionId: string }): Promise; + get(params: { functionId: string }): Promise; /** * Get a function by its unique ID. * @@ -372,7 +373,7 @@ export class Functions { * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} params.commands - Build Commands. - * @param {string[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function * @param {string} params.providerBranch - Production branch for the repo linked to the function @@ -382,7 +383,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; + update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; /** * Update function by its unique ID. * @@ -397,7 +398,7 @@ export class Functions { * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} commands - Build Commands. - * @param {string[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. * @param {string} providerRepositoryId - Repository ID of the repo linked to the function * @param {string} providerBranch - Production branch for the repo linked to the function @@ -408,15 +409,15 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise; + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise; update( - paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (string[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?] + paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?] ): Promise { - let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; + let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }; } else { params = { functionId: paramsOrFirst as string, @@ -430,7 +431,7 @@ export class Functions { logging: rest[7] as boolean, entrypoint: rest[8] as string, commands: rest[9] as string, - scopes: rest[10] as string[], + scopes: rest[10] as Scopes[], installationId: rest[11] as string, providerRepositoryId: rest[12] as string, providerBranch: rest[13] as string, @@ -540,7 +541,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { functionId: string }): Promise<{}>; + delete(params: { functionId: string }): Promise<{}>; /** * Delete a function by its unique ID. * @@ -593,7 +594,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise; + updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise; /** * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. * @@ -658,7 +659,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * @@ -736,7 +737,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string , onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise; /** * 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. * @@ -755,7 +756,7 @@ export class Functions { */ createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, + paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] ): Promise { let params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string }; @@ -829,7 +830,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise; + createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise; /** * 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. * @@ -905,7 +906,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; + createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; /** * Create a deployment based on a template. * @@ -1016,7 +1017,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; + createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; /** * Create a deployment when a function is connected to VCS. * @@ -1096,7 +1097,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getDeployment(params: { functionId: string, deploymentId: string }): Promise; + getDeployment(params: { functionId: string, deploymentId: string }): Promise; /** * Get a function deployment by its unique ID. * @@ -1155,7 +1156,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; + deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; /** * Delete a code deployment by its unique ID. * @@ -1216,7 +1217,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; + getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; /** * 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. * @@ -1282,7 +1283,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise; + updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise; /** * 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. * @@ -1343,7 +1344,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise; + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * @@ -1413,7 +1414,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise; + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise; /** * 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. * @@ -1503,7 +1504,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getExecution(params: { functionId: string, executionId: string }): Promise; + getExecution(params: { functionId: string, executionId: string }): Promise; /** * Get a function execution log by its unique ID. * @@ -1562,7 +1563,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; + deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; /** * Delete a function execution by its unique ID. * @@ -1621,7 +1622,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { functionId: string }): Promise; + listVariables(params: { functionId: string }): Promise; /** * Get a list of all variables of a specific function. * @@ -1675,7 +1676,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createVariable(params: { functionId: string, key: string, value: string, secret?: boolean }): Promise; + createVariable(params: { functionId: string, key: string, value: string, secret?: boolean }): Promise; /** * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * @@ -1753,7 +1754,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getVariable(params: { functionId: string, variableId: string }): Promise; + getVariable(params: { functionId: string, variableId: string }): Promise; /** * Get a variable by its unique ID. * @@ -1815,7 +1816,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - updateVariable(params: { functionId: string, variableId: string, key: string, value?: string, secret?: boolean }): Promise; + updateVariable(params: { functionId: string, variableId: string, key: string, value?: string, secret?: boolean }): Promise; /** * Update variable by its unique ID. * @@ -1896,7 +1897,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; + deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; /** * Delete a variable by its unique ID. * diff --git a/src/services/graphql.ts b/src/services/graphql.ts index b94dde8..e9986a7 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -16,7 +16,7 @@ export class Graphql { * @throws {AppwriteException} * @returns {Promise<{}>} */ - query(params: { query: object }): Promise<{}>; + query(params: { query: object }): Promise<{}>; /** * Execute a GraphQL mutation. * @@ -72,7 +72,7 @@ export class Graphql { * @throws {AppwriteException} * @returns {Promise<{}>} */ - mutation(params: { query: object }): Promise<{}>; + mutation(params: { query: object }): Promise<{}>; /** * Execute a GraphQL mutation. * diff --git a/src/services/health.ts b/src/services/health.ts index 8049935..67dce2f 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -60,9 +60,9 @@ export class Health { * Check the Appwrite in-memory cache servers are up and connection is successful. * * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getCache(): Promise { + getCache(): Promise { const apiPath = '/health/cache'; const payload: Payload = {}; @@ -86,7 +86,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getCertificate(params?: { domain?: string }): Promise; + getCertificate(params?: { domain?: string }): Promise; /** * Get the SSL certificate for a domain * @@ -134,9 +134,9 @@ export class Health { * Check the Appwrite database servers are up and connection is successful. * * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getDB(): Promise { + getDB(): Promise { const apiPath = '/health/db'; const payload: Payload = {}; @@ -157,9 +157,9 @@ export class Health { * Check the Appwrite pub-sub servers are up and connection is successful. * * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getPubSub(): Promise { + getPubSub(): Promise { const apiPath = '/health/pubsub'; const payload: Payload = {}; @@ -176,6 +176,57 @@ export class Health { ); } + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueueAudits(params?: { threshold?: number }): Promise; + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueAudits(threshold?: number): Promise; + getQueueAudits( + paramsOrFirst?: { threshold?: number } | number + ): Promise { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/audits'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. * @@ -183,7 +234,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueBuilds(params?: { threshold?: number }): Promise; + getQueueBuilds(params?: { threshold?: number }): Promise; /** * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. * @@ -234,7 +285,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueCertificates(params?: { threshold?: number }): Promise; + getQueueCertificates(params?: { threshold?: number }): Promise; /** * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. * @@ -286,7 +337,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueDatabases(params?: { name?: string, threshold?: number }): Promise; + getQueueDatabases(params?: { name?: string, threshold?: number }): Promise; /** * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. * @@ -344,7 +395,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueDeletes(params?: { threshold?: number }): Promise; + getQueueDeletes(params?: { threshold?: number }): Promise; /** * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. * @@ -397,7 +448,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getFailedJobs(params: { name: Name, threshold?: number }): Promise; + getFailedJobs(params: { name: Name, threshold?: number }): Promise; /** * Returns the amount of failed jobs in a given queue. * @@ -456,7 +507,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueFunctions(params?: { threshold?: number }): Promise; + getQueueFunctions(params?: { threshold?: number }): Promise; /** * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. * @@ -507,7 +558,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueLogs(params?: { threshold?: number }): Promise; + getQueueLogs(params?: { threshold?: number }): Promise; /** * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. * @@ -558,7 +609,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueMails(params?: { threshold?: number }): Promise; + getQueueMails(params?: { threshold?: number }): Promise; /** * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. * @@ -609,7 +660,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueMessaging(params?: { threshold?: number }): Promise; + getQueueMessaging(params?: { threshold?: number }): Promise; /** * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. * @@ -660,7 +711,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueMigrations(params?: { threshold?: number }): Promise; + getQueueMigrations(params?: { threshold?: number }): Promise; /** * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. * @@ -711,7 +762,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueStatsResources(params?: { threshold?: number }): Promise; + getQueueStatsResources(params?: { threshold?: number }): Promise; /** * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. * @@ -762,7 +813,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueUsage(params?: { threshold?: number }): Promise; + getQueueUsage(params?: { threshold?: number }): Promise; /** * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. * @@ -813,7 +864,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - getQueueWebhooks(params?: { threshold?: number }): Promise; + getQueueWebhooks(params?: { threshold?: number }): Promise; /** * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. * diff --git a/src/services/messaging.ts b/src/services/messaging.ts index c2cd63c..f3f94f0 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -20,7 +20,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all messages from the current Appwrite project. * @@ -95,7 +95,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise; + createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise; /** * Create a new email message. * @@ -235,7 +235,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise; + updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise; /** * 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. * @@ -373,7 +373,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise; + createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise; /** * Create a new push notification. * @@ -556,7 +556,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise; + updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise; /** * 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. * @@ -725,7 +725,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. */ - createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise; + createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise; /** * Create a new SMS message. * @@ -826,7 +826,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise; + createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise; /** * Create a new SMS message. * @@ -929,7 +929,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. */ - updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise; + updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise; /** * 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. * @@ -1026,7 +1026,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise; + updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise; /** * 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. * @@ -1117,7 +1117,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - getMessage(params: { messageId: string }): Promise; + getMessage(params: { messageId: string }): Promise; /** * Get a message by its unique ID. * @@ -1169,7 +1169,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { messageId: string }): Promise<{}>; + delete(params: { messageId: string }): Promise<{}>; /** * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. * @@ -1223,7 +1223,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise; + listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise; /** * Get the message activity logs listed by its unique ID. * @@ -1289,7 +1289,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise; + listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of the targets associated with a message. * @@ -1355,7 +1355,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all providers from the current Appwrite project. * @@ -1427,7 +1427,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. */ - createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise; + createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise; /** * Create a new Apple Push Notification service provider. * @@ -1535,7 +1535,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise; + createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise; /** * Create a new Apple Push Notification service provider. * @@ -1644,7 +1644,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. */ - updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise; + updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1746,7 +1746,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise; + updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1845,7 +1845,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. */ - createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise; + createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise; /** * Create a new Firebase Cloud Messaging provider. * @@ -1925,7 +1925,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise; + createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise; /** * Create a new Firebase Cloud Messaging provider. * @@ -2006,7 +2006,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. */ - updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise; + updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -2080,7 +2080,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise; + updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -2160,7 +2160,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Create a new Mailgun provider. * @@ -2282,7 +2282,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; /** * Update a Mailgun provider by its unique ID. * @@ -2394,7 +2394,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise; + createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise; /** * Create a new MSG91 provider. * @@ -2488,7 +2488,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise; + updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise; /** * Update a MSG91 provider by its unique ID. * @@ -2578,7 +2578,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Create a new Resend provider. * @@ -2686,7 +2686,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; /** * Update a Resend provider by its unique ID. * @@ -2788,7 +2788,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Create a new Sendgrid provider. * @@ -2896,7 +2896,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; /** * Update a Sendgrid provider by its unique ID. * @@ -3005,7 +3005,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. */ - createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Create a new SMTP provider. * @@ -3158,7 +3158,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Create a new SMTP provider. * @@ -3312,7 +3312,7 @@ export class Messaging { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. */ - updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Update a SMTP provider by its unique ID. * @@ -3456,7 +3456,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; /** * Update a SMTP provider by its unique ID. * @@ -3592,7 +3592,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise; + createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise; /** * Create a new Telesign provider. * @@ -3686,7 +3686,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise; + updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise; /** * Update a Telesign provider by its unique ID. * @@ -3774,7 +3774,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise; + createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise; /** * Create a new Textmagic provider. * @@ -3868,7 +3868,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise; + updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise; /** * Update a Textmagic provider by its unique ID. * @@ -3956,7 +3956,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise; + createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise; /** * Create a new Twilio provider. * @@ -4050,7 +4050,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise; + updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise; /** * Update a Twilio provider by its unique ID. * @@ -4138,7 +4138,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise; + createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise; /** * Create a new Vonage provider. * @@ -4232,7 +4232,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise; + updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise; /** * Update a Vonage provider by its unique ID. * @@ -4316,7 +4316,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - getProvider(params: { providerId: string }): Promise; + getProvider(params: { providerId: string }): Promise; /** * Get a provider by its unique ID. * @@ -4368,7 +4368,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteProvider(params: { providerId: string }): Promise<{}>; + deleteProvider(params: { providerId: string }): Promise<{}>; /** * Delete a provider by its unique ID. * @@ -4422,7 +4422,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise; + listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise; /** * Get the provider activity logs listed by its unique ID. * @@ -4488,7 +4488,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise; + listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise; /** * Get the subscriber activity logs listed by its unique ID. * @@ -4554,7 +4554,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all topics from the current Appwrite project. * @@ -4620,7 +4620,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise; + createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise; /** * Create a new topic. * @@ -4692,7 +4692,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - getTopic(params: { topicId: string }): Promise; + getTopic(params: { topicId: string }): Promise; /** * Get a topic by its unique ID. * @@ -4747,7 +4747,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise; + updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise; /** * Update a topic by its unique ID. * @@ -4813,7 +4813,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTopic(params: { topicId: string }): Promise<{}>; + deleteTopic(params: { topicId: string }): Promise<{}>; /** * Delete a topic by its unique ID. * @@ -4867,7 +4867,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise; + listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise; /** * Get the topic activity logs listed by its unique ID. * @@ -4934,7 +4934,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all subscribers from the current Appwrite project. * @@ -5006,7 +5006,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise; + createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise; /** * Create a new subscriber. * @@ -5079,7 +5079,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - getSubscriber(params: { topicId: string, subscriberId: string }): Promise; + getSubscriber(params: { topicId: string, subscriberId: string }): Promise; /** * Get a subscriber by its unique ID. * @@ -5139,7 +5139,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>; + deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>; /** * Delete a subscriber by its unique ID. * diff --git a/src/services/sites.ts b/src/services/sites.ts index 3afc7e3..365e809 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -24,7 +24,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the project's sites. You can use the query params to filter your results. * @@ -105,7 +105,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; + create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; /** * Create a new site. * @@ -318,7 +318,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - get(params: { siteId: string }): Promise; + get(params: { siteId: string }): Promise; /** * Get a site by its unique ID. * @@ -386,7 +386,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; + update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string }): Promise; /** * Update site by its unique ID. * @@ -547,7 +547,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { siteId: string }): Promise<{}>; + delete(params: { siteId: string }): Promise<{}>; /** * Delete a site by its unique ID. * @@ -600,7 +600,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise; + updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise; /** * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. * @@ -665,7 +665,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the site's code deployments. You can use the query params to filter your results. * @@ -740,7 +740,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string , onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void }): Promise; /** * 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 site's deployment to use your new deployment ID. * @@ -756,7 +756,7 @@ export class Sites { */ createDeployment(siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void } | string, + paramsOrFirst: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void } | string, ...rest: [(File)?, (boolean)?, (string)?, (string)?, (string)?,((progress: UploadProgress) => void)?] ): Promise { let params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; @@ -834,7 +834,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise; + createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise; /** * 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. * @@ -904,7 +904,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; + createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; /** * Create a deployment based on a template. * @@ -1015,7 +1015,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; + createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; /** * Create a deployment when a site is connected to VCS. * @@ -1095,7 +1095,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getDeployment(params: { siteId: string, deploymentId: string }): Promise; + getDeployment(params: { siteId: string, deploymentId: string }): Promise; /** * Get a site deployment by its unique ID. * @@ -1154,7 +1154,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; + deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; /** * Delete a site deployment by its unique ID. * @@ -1215,7 +1215,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; + getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; /** * 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. * @@ -1281,7 +1281,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise; + updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise; /** * 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. * @@ -1342,7 +1342,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise; + listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all site logs. You can use the query params to filter your results. * @@ -1407,7 +1407,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getLog(params: { siteId: string, logId: string }): Promise; + getLog(params: { siteId: string, logId: string }): Promise; /** * Get a site request log by its unique ID. * @@ -1466,7 +1466,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteLog(params: { siteId: string, logId: string }): Promise<{}>; + deleteLog(params: { siteId: string, logId: string }): Promise<{}>; /** * Delete a site log by its unique ID. * @@ -1525,7 +1525,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { siteId: string }): Promise; + listVariables(params: { siteId: string }): Promise; /** * Get a list of all variables of a specific site. * @@ -1579,7 +1579,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createVariable(params: { siteId: string, key: string, value: string, secret?: boolean }): Promise; + createVariable(params: { siteId: string, key: string, value: string, secret?: boolean }): Promise; /** * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. * @@ -1657,7 +1657,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getVariable(params: { siteId: string, variableId: string }): Promise; + getVariable(params: { siteId: string, variableId: string }): Promise; /** * Get a variable by its unique ID. * @@ -1719,7 +1719,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - updateVariable(params: { siteId: string, variableId: string, key: string, value?: string, secret?: boolean }): Promise; + updateVariable(params: { siteId: string, variableId: string, key: string, value?: string, secret?: boolean }): Promise; /** * Update variable by its unique ID. * @@ -1800,7 +1800,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; + deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; /** * Delete a variable by its unique ID. * diff --git a/src/services/storage.ts b/src/services/storage.ts index 3a115aa..ec5046e 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -21,7 +21,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the storage buckets. You can use the query params to filter your results. * @@ -88,14 +88,14 @@ export class Storage { * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param {boolean} params.transformations - Are image transformations enabled? * @throws {AppwriteException} * @returns {Promise} */ - createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise; + createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise; /** * Create a new storage bucket. * @@ -106,7 +106,7 @@ export class Storage { * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param {boolean} transformations - Are image transformations enabled? @@ -214,7 +214,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getBucket(params: { bucketId: string }): Promise; + getBucket(params: { bucketId: string }): Promise; /** * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. * @@ -268,14 +268,14 @@ export class Storage { * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param {boolean} params.transformations - Are image transformations enabled? * @throws {AppwriteException} * @returns {Promise} */ - updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise; + updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise; /** * Update a storage bucket by its unique ID. * @@ -286,7 +286,7 @@ export class Storage { * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param {boolean} transformations - Are image transformations enabled? @@ -391,7 +391,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteBucket(params: { bucketId: string }): Promise<{}>; + deleteBucket(params: { bucketId: string }): Promise<{}>; /** * Delete a storage bucket by its unique ID. * @@ -446,7 +446,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -526,7 +526,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - createFile(params: { bucketId: string, fileId: string, file: File, permissions?: string[] , onProgress?: (progress: UploadProgress) => void }): Promise; + createFile(params: { bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void }): Promise; /** * 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. * @@ -547,7 +547,7 @@ export class Storage { */ createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise; createFile( - paramsOrFirst: { bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, + paramsOrFirst: { bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, ...rest: [(string)?, (File)?, (string[])?,((progress: UploadProgress) => void)?] ): Promise { let params: { bucketId: string, fileId: string, file: File, permissions?: string[] }; @@ -615,7 +615,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFile(params: { bucketId: string, fileId: string }): Promise; + getFile(params: { bucketId: string, fileId: string }): Promise; /** * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. * @@ -669,21 +669,21 @@ export class Storage { /** * Update a file by its unique ID. Only users with write permissions have access to update this resource. * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File unique ID. - * @param {string} params.name - Name of the file - * @param {string[]} params.permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.bucketId - Bucket unique ID. + * @param {string} params.fileId - File ID. + * @param {string} params.name - File name. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @throws {AppwriteException} * @returns {Promise} */ - updateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise; + updateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise; /** * Update a file by its unique ID. Only users with write permissions have access to update this resource. * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File unique ID. - * @param {string} name - Name of the file - * @param {string[]} permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} bucketId - Bucket unique ID. + * @param {string} fileId - File ID. + * @param {string} name - File name. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -748,7 +748,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteFile(params: { bucketId: string, fileId: string }): Promise<{}>; + deleteFile(params: { bucketId: string, fileId: string }): Promise<{}>; /** * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * @@ -809,7 +809,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise; + getFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise; /** * 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. * @@ -887,7 +887,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }): Promise; + getFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }): Promise; /** * 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. * @@ -1020,7 +1020,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFileView(params: { bucketId: string, fileId: string, token?: string }): Promise; + getFileView(params: { bucketId: string, fileId: string, token?: string }): Promise; /** * 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-db.ts b/src/services/tables-db.ts index 846718c..f64286d 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -4,6 +4,7 @@ import type { Models } from '../models'; import { RelationshipType } from '../enums/relationship-type'; import { RelationMutate } from '../enums/relation-mutate'; import { IndexType } from '../enums/index-type'; +import { OrderBy } from '../enums/order-by'; export class TablesDB { client: Client; @@ -21,7 +22,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -88,7 +89,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; /** * Create a new Database. * @@ -160,7 +161,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listTransactions(params?: { queries?: string[] }): Promise; + listTransactions(params?: { queries?: string[] }): Promise; /** * List transactions across all databases. * @@ -211,7 +212,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createTransaction(params?: { ttl?: number }): Promise; + createTransaction(params?: { ttl?: number }): Promise; /** * Create a new transaction. * @@ -263,7 +264,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getTransaction(params: { transactionId: string }): Promise; + getTransaction(params: { transactionId: string }): Promise; /** * Get a transaction by its unique ID. * @@ -316,7 +317,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; + updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; /** * Update a transaction, to either commit or roll back its operations. * @@ -381,7 +382,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTransaction(params: { transactionId: string }): Promise<{}>; + deleteTransaction(params: { transactionId: string }): Promise<{}>; /** * Delete a transaction by its unique ID. * @@ -434,7 +435,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise; + createOperations(params: { transactionId: string, operations?: object[] }): Promise; /** * Create multiple operations in a single transaction. * @@ -493,7 +494,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - get(params: { databaseId: string }): Promise; + get(params: { databaseId: string }): Promise; /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -546,7 +547,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise; /** * Update a database by its unique ID. * @@ -557,15 +558,15 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name: string, enabled?: boolean): Promise; + update(databaseId: string, name?: string, enabled?: boolean): Promise; update( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean }; + let params: { databaseId: string, name?: string, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -581,9 +582,6 @@ export class TablesDB { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); const payload: Payload = {}; @@ -614,7 +612,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { databaseId: string }): Promise<{}>; + delete(params: { databaseId: string }): Promise<{}>; /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -669,7 +667,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -746,7 +744,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise; + createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise; /** * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -848,7 +846,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getTable(params: { databaseId: string, tableId: string }): Promise; + getTable(params: { databaseId: string, tableId: string }): Promise; /** * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. * @@ -911,7 +909,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }): Promise; + updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }): Promise; /** * Update a table by its unique ID. * @@ -925,15 +923,15 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTable(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise; + updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise; updateTable( - paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean } | string, + paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; + let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -958,9 +956,6 @@ export class TablesDB { if (typeof tableId === 'undefined') { throw new AppwriteException('Missing required parameter: "tableId"'); } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); const payload: Payload = {}; @@ -998,7 +993,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; + deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; /** * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. * @@ -1060,7 +1055,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; + listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; /** * List columns in the table. * @@ -1136,7 +1131,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise; + createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise; /** * Create a boolean column. * @@ -1231,7 +1226,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise; + updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise; /** * Update a boolean column. Changing the `default` value will not update already existing rows. * @@ -1325,7 +1320,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create a date time column according to the ISO 8601 standard. * @@ -1419,7 +1414,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update a date time column. Changing the `default` value will not update already existing rows. * @@ -1514,7 +1509,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create an email column. * @@ -1610,7 +1605,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an email column. Changing the `default` value will not update already existing rows. * @@ -1706,7 +1701,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise; + createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. * @@ -1811,7 +1806,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an enum column. Changing the `default` value will not update already existing rows. * @@ -1918,7 +1913,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; + createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; /** * Create a float column. Optionally, minimum and maximum values can be provided. * @@ -2028,7 +2023,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; + updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; /** * Update a float column. Changing the `default` value will not update already existing rows. * @@ -2131,14 +2126,14 @@ export class TablesDB { * @param {string} params.tableId - Table ID. * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {number} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? * @throws {AppwriteException} * @returns {Promise} */ - createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; + createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise; /** * Create an integer column. Optionally, minimum and maximum values can be provided. * @@ -2147,32 +2142,32 @@ export class TablesDB { * @param {string} tableId - Table ID. * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {number} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. * @param {boolean} array - Is column an array? * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise; + createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise; createIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, array: rest[6] as boolean }; } @@ -2241,14 +2236,14 @@ export class TablesDB { * @param {string} params.tableId - Table ID. * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {number} params.xdefault - Default value. Cannot be set when column is required. - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} */ - updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; + updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise; /** * Update an integer column. Changing the `default` value will not update already existing rows. * @@ -2257,32 +2252,32 @@ export class TablesDB { * @param {string} tableId - Table ID. * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {number} xdefault - Default value. Cannot be set when column is required. - * @param {number} min - Minimum value - * @param {number} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value * @param {string} newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise; + updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise; updateIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, newKey: rest[6] as string }; } @@ -2356,7 +2351,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create IP address column. * @@ -2452,7 +2447,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an ip column. Changing the `default` value will not update already existing rows. * @@ -2546,7 +2541,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric line column. * @@ -2634,7 +2629,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a line column. Changing the `default` value will not update already existing rows. * @@ -2724,7 +2719,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric point column. * @@ -2812,7 +2807,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a point column. Changing the `default` value will not update already existing rows. * @@ -2902,7 +2897,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; /** * Create a geometric polygon column. * @@ -2990,7 +2985,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; /** * Update a polygon column. Changing the `default` value will not update already existing rows. * @@ -3084,7 +3079,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; /** * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * @@ -3194,7 +3189,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a string column. * @@ -3306,7 +3301,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; /** * Update a string column. Changing the `default` value will not update already existing rows. * @@ -3408,7 +3403,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** * Create a URL column. * @@ -3504,7 +3499,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** * Update an url column. Changing the `default` value will not update already existing rows. * @@ -3594,9 +3589,9 @@ export class TablesDB { * @param {string} params.tableId - Table ID. * @param {string} params.key - Column Key. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise} */ - getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + getColumn(params: { databaseId: string, tableId: string, key: string }): Promise; /** * Get column by ID. * @@ -3604,14 +3599,14 @@ export class TablesDB { * @param {string} tableId - Table ID. * @param {string} key - Column Key. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getColumn(databaseId: string, tableId: string, key: string): Promise<{}>; + getColumn(databaseId: string, tableId: string, key: string): Promise; getColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, ...rest: [(string)?, (string)?] - ): Promise<{}> { + ): Promise { let params: { databaseId: string, tableId: string, key: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -3662,7 +3657,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; /** * Deletes a column. * @@ -3732,7 +3727,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; /** * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * @@ -3813,7 +3808,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; + listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; /** * List indexes on the table. * @@ -3885,12 +3880,12 @@ export class TablesDB { * @param {string} params.key - Index Key. * @param {IndexType} params.type - Index type. * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {string[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. * @param {number[]} params.lengths - Length of index. Maximum of 100 * @throws {AppwriteException} * @returns {Promise} */ - createIndex(params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[] }): Promise; + createIndex(params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise; /** * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. * Type can be `key`, `fulltext`, or `unique`. @@ -3900,21 +3895,21 @@ export class TablesDB { * @param {string} key - Index Key. * @param {IndexType} type - Index type. * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {string[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. * @param {number[]} lengths - Length of index. Maximum of 100 * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[]): Promise; + createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise; createIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, (number[])?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (OrderBy[])?, (number[])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[] }; + let params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; } else { params = { databaseId: paramsOrFirst as string, @@ -3922,7 +3917,7 @@ export class TablesDB { key: rest[1] as string, type: rest[2] as IndexType, columns: rest[3] as string[], - orders: rest[4] as string[], + orders: rest[4] as OrderBy[], lengths: rest[5] as number[] }; } @@ -3991,7 +3986,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getIndex(params: { databaseId: string, tableId: string, key: string }): Promise; + getIndex(params: { databaseId: string, tableId: string, key: string }): Promise; /** * Get index by ID. * @@ -4057,7 +4052,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; /** * Delete an index. * @@ -4126,7 +4121,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -4207,7 +4202,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createRow(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; + createRow(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; /** * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -4299,7 +4294,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - createRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; + createRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; /** * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -4377,7 +4372,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - upsertRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; + upsertRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; /** * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -4456,7 +4451,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - updateRows(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; + updateRows(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; /** * 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. * @@ -4536,7 +4531,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - deleteRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise>; + deleteRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise>; /** * Bulk delete rows using queries, if no queries are passed then all rows are deleted. * @@ -4611,7 +4606,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getRow(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise; + getRow(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise; /** * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. * @@ -4692,7 +4687,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - upsertRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + upsertRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; /** * 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/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -4780,7 +4775,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + updateRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; /** * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -4866,7 +4861,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>; + deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>; /** * Delete a row by its unique ID. * @@ -4943,7 +4938,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - decrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise; + decrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise; /** * Decrement a specific column of a row by a given value. * @@ -5038,7 +5033,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - incrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise; + incrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise; /** * Increment a specific column of a row by a given value. * diff --git a/src/services/teams.ts b/src/services/teams.ts index fe82b2f..69c0cf5 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,6 +1,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { Roles } from '../enums/roles'; export class Teams { client: Client; @@ -18,7 +19,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; /** * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. * @@ -84,7 +85,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { teamId: string, name: string, roles?: string[] }): Promise>; + create(params: { teamId: string, name: string, roles?: string[] }): Promise>; /** * 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. * @@ -155,7 +156,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - get(params: { teamId: string }): Promise>; + get(params: { teamId: string }): Promise>; /** * Get a team by its ID. All team members have read access for this resource. * @@ -207,7 +208,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { teamId: string, name: string }): Promise>; + updateName(params: { teamId: string, name: string }): Promise>; /** * Update the team's name by its unique ID. * @@ -269,7 +270,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { teamId: string }): Promise<{}>; + delete(params: { teamId: string }): Promise<{}>; /** * Delete a team using its ID. Only team members with the owner role can delete the team. * @@ -324,7 +325,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * 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. * @@ -398,7 +399,7 @@ export class Teams { * * * @param {string} params.teamId - Team ID. - * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {Roles[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. * @param {string} params.email - Email of the new team member. * @param {string} params.userId - ID of the user to be added to a team. * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -407,7 +408,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise; + createMembership(params: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise; /** * 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. * @@ -419,7 +420,7 @@ export class Teams { * * * @param {string} teamId - Team ID. - * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {Roles[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. * @param {string} email - Email of the new team member. * @param {string} userId - ID of the user to be added to a team. * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -429,19 +430,19 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise; + createMembership(teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise; createMembership( - paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string, - ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?] + paramsOrFirst: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string, + ...rest: [(Roles[])?, (string)?, (string)?, (string)?, (string)?, (string)?] ): Promise { - let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + let params: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + params = (paramsOrFirst || {}) as { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; } else { params = { teamId: paramsOrFirst as string, - roles: rest[0] as string[], + roles: rest[0] as Roles[], email: rest[1] as string, userId: rest[2] as string, phone: rest[3] as string, @@ -507,7 +508,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - getMembership(params: { teamId: string, membershipId: string }): Promise; + getMembership(params: { teamId: string, membershipId: string }): Promise; /** * 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. * @@ -564,36 +565,36 @@ export class Teams { * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. - * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {Roles[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. * @throws {AppwriteException} * @returns {Promise} */ - updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise; + updateMembership(params: { teamId: string, membershipId: string, roles: Roles[] }): Promise; /** * 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 - Team ID. * @param {string} membershipId - Membership ID. - * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {Roles[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembership(teamId: string, membershipId: string, roles: string[]): Promise; + updateMembership(teamId: string, membershipId: string, roles: Roles[]): Promise; updateMembership( - paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { teamId: string, membershipId: string, roles: Roles[] } | string, + ...rest: [(string)?, (Roles[])?] ): Promise { - let params: { teamId: string, membershipId: string, roles: string[] }; + let params: { teamId: string, membershipId: string, roles: Roles[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] }; + params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: Roles[] }; } else { params = { teamId: paramsOrFirst as string, membershipId: rest[0] as string, - roles: rest[1] as string[] + roles: rest[1] as Roles[] }; } @@ -638,7 +639,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>; + deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>; /** * 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. * @@ -703,7 +704,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise; + updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise; /** * 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. * @@ -783,7 +784,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(params: { teamId: string }): Promise; + getPrefs(params: { teamId: string }): Promise; /** * 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). * @@ -835,7 +836,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(params: { teamId: string, prefs: object }): Promise; + updatePrefs(params: { teamId: string, prefs: object }): Promise; /** * 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. * diff --git a/src/services/tokens.ts b/src/services/tokens.ts index 89fd73d..e092894 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -19,7 +19,7 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise; + list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise; /** * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. * @@ -91,7 +91,7 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise; + createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise; /** * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. * @@ -156,7 +156,7 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - get(params: { tokenId: string }): Promise; + get(params: { tokenId: string }): Promise; /** * Get a token by its unique ID. * @@ -208,7 +208,7 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { tokenId: string, expire?: string }): Promise; + update(params: { tokenId: string, expire?: string }): Promise; /** * Update a token by its unique ID. Use this endpoint to update a token's expiry date. * @@ -267,7 +267,7 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { tokenId: string }): Promise<{}>; + delete(params: { tokenId: string }): Promise<{}>; /** * Delete a token by its unique ID. * diff --git a/src/services/users.ts b/src/services/users.ts index 29cb089..a837dcb 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -21,7 +21,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; /** * Get a list of all the project's users. You can use the query params to filter your results. * @@ -89,7 +89,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise>; + create(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise>; /** * Create a new user. * @@ -172,7 +172,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createArgon2User(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createArgon2User(params: { userId: string, email: string, password: string, name?: string }): Promise>; /** * 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. * @@ -255,7 +255,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createBcryptUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createBcryptUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; /** * 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. * @@ -337,7 +337,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get identities for all users. * @@ -401,7 +401,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteIdentity(params: { identityId: string }): Promise<{}>; + deleteIdentity(params: { identityId: string }): Promise<{}>; /** * Delete an identity by its unique ID. * @@ -456,7 +456,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createMD5User(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createMD5User(params: { userId: string, email: string, password: string, name?: string }): Promise>; /** * 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. * @@ -539,7 +539,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createPHPassUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createPHPassUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; /** * 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. * @@ -627,7 +627,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise>; + createScryptUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise>; /** * 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. * @@ -758,7 +758,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptModifiedUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise>; + createScryptModifiedUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise>; /** * 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. * @@ -869,7 +869,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createSHAUser(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise>; + createSHAUser(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise>; /** * 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. * @@ -955,7 +955,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - get(params: { userId: string }): Promise>; + get(params: { userId: string }): Promise>; /** * Get a user by its unique ID. * @@ -1006,7 +1006,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { userId: string }): Promise<{}>; + delete(params: { userId: string }): Promise<{}>; /** * 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. * @@ -1059,7 +1059,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(params: { userId: string, email: string }): Promise>; + updateEmail(params: { userId: string, email: string }): Promise>; /** * Update the user email by its unique ID. * @@ -1123,7 +1123,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise; + createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise; /** * 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. * @@ -1191,7 +1191,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateLabels(params: { userId: string, labels: string[] }): Promise>; + updateLabels(params: { userId: string, labels: string[] }): Promise>; /** * Update the user labels by its unique ID. * @@ -1257,7 +1257,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise; + listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise; /** * Get the user activity logs list by its unique ID. * @@ -1324,7 +1324,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get the user membership list by its unique ID. * @@ -1396,7 +1396,7 @@ export class Users { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. */ - updateMfa(params: { userId: string, mfa: boolean }): Promise>; + updateMfa(params: { userId: string, mfa: boolean }): Promise>; /** * Enable or disable MFA on a user account. * @@ -1459,7 +1459,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(params: { userId: string, mfa: boolean }): Promise>; + updateMFA(params: { userId: string, mfa: boolean }): Promise>; /** * Enable or disable MFA on a user account. * @@ -1523,7 +1523,7 @@ export class Users { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. */ - deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; /** * Delete an authenticator app. * @@ -1583,7 +1583,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; /** * Delete an authenticator app. * @@ -1643,7 +1643,7 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead. */ - listMfaFactors(params: { userId: string }): Promise; + listMfaFactors(params: { userId: string }): Promise; /** * List the factors available on the account to be used as a MFA challange. * @@ -1694,7 +1694,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listMFAFactors(params: { userId: string }): Promise; + listMFAFactors(params: { userId: string }): Promise; /** * List the factors available on the account to be used as a MFA challange. * @@ -1746,7 +1746,7 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. */ - getMfaRecoveryCodes(params: { userId: string }): Promise; + getMfaRecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -1797,7 +1797,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getMFARecoveryCodes(params: { userId: string }): Promise; + getMFARecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -1849,7 +1849,7 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. */ - updateMfaRecoveryCodes(params: { userId: string }): Promise; + updateMfaRecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -1901,7 +1901,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updateMFARecoveryCodes(params: { userId: string }): Promise; + updateMFARecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -1954,7 +1954,7 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. */ - createMfaRecoveryCodes(params: { userId: string }): Promise; + createMfaRecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -2006,7 +2006,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createMFARecoveryCodes(params: { userId: string }): Promise; + createMFARecoveryCodes(params: { userId: string }): Promise; /** * 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. * @@ -2059,7 +2059,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { userId: string, name: string }): Promise>; + updateName(params: { userId: string, name: string }): Promise>; /** * Update the user name by its unique ID. * @@ -2122,7 +2122,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(params: { userId: string, password: string }): Promise>; + updatePassword(params: { userId: string, password: string }): Promise>; /** * Update the user password by its unique ID. * @@ -2185,7 +2185,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(params: { userId: string, number: string }): Promise>; + updatePhone(params: { userId: string, number: string }): Promise>; /** * Update the user phone by its unique ID. * @@ -2247,7 +2247,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(params: { userId: string }): Promise; + getPrefs(params: { userId: string }): Promise; /** * Get the user preferences by its unique ID. * @@ -2299,7 +2299,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(params: { userId: string, prefs: object }): Promise; + updatePrefs(params: { userId: string, prefs: object }): Promise; /** * 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. * @@ -2362,7 +2362,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listSessions(params: { userId: string, total?: boolean }): Promise; + listSessions(params: { userId: string, total?: boolean }): Promise; /** * Get the user sessions list by its unique ID. * @@ -2422,7 +2422,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createSession(params: { userId: string }): Promise; + createSession(params: { userId: string }): Promise; /** * Creates a session for a user. Returns an immediately usable session object. * @@ -2476,7 +2476,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSessions(params: { userId: string }): Promise<{}>; + deleteSessions(params: { userId: string }): Promise<{}>; /** * Delete all user's sessions by using the user's unique ID. * @@ -2529,7 +2529,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; + deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; /** * Delete a user sessions by its unique ID. * @@ -2589,7 +2589,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(params: { userId: string, status: boolean }): Promise>; + updateStatus(params: { userId: string, status: boolean }): Promise>; /** * 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. * @@ -2653,7 +2653,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise; + listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise; /** * List the messaging targets that are associated with a user. * @@ -2722,7 +2722,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise; + createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise; /** * Create a messaging target. * @@ -2815,7 +2815,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getTarget(params: { userId: string, targetId: string }): Promise; + getTarget(params: { userId: string, targetId: string }): Promise; /** * Get a user's push notification target by ID. * @@ -2877,7 +2877,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise; + updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise; /** * Update a messaging target. * @@ -2955,7 +2955,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; + deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; /** * Delete a messaging target. * @@ -3017,7 +3017,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createToken(params: { userId: string, length?: number, expire?: number }): Promise; + createToken(params: { userId: string, length?: number, expire?: number }): Promise; /** * 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. * @@ -3084,7 +3084,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmailVerification(params: { userId: string, emailVerification: boolean }): Promise>; + updateEmailVerification(params: { userId: string, emailVerification: boolean }): Promise>; /** * Update the user email verification status by its unique ID. * @@ -3147,7 +3147,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhoneVerification(params: { userId: string, phoneVerification: boolean }): Promise>; + updatePhoneVerification(params: { userId: string, phoneVerification: boolean }): Promise>; /** * Update the user phone verification status by its unique ID. * From 54af7c62aad979451a042c590b7a3d4d66b3192f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Feb 2026 12:30:15 +0000 Subject: [PATCH 2/3] update changelog etc --- CHANGELOG.md | 2 + .../databases/create-longtext-attribute.md | 17 + .../databases/create-mediumtext-attribute.md | 17 + .../databases/create-text-attribute.md | 17 + .../databases/create-varchar-attribute.md | 18 + .../databases/update-longtext-attribute.md | 17 + .../databases/update-mediumtext-attribute.md | 17 + .../databases/update-text-attribute.md | 17 + .../databases/update-varchar-attribute.md | 18 + .../tablesdb/create-longtext-column.md | 17 + .../tablesdb/create-mediumtext-column.md | 17 + docs/examples/tablesdb/create-text-column.md | 17 + .../tablesdb/create-varchar-column.md | 18 + .../tablesdb/update-longtext-column.md | 17 + .../tablesdb/update-mediumtext-column.md | 17 + docs/examples/tablesdb/update-text-column.md | 17 + .../tablesdb/update-varchar-column.md | 18 + src/models.ts | 344 +++++ src/services/databases.ts | 1249 ++++++++++++++--- src/services/tables-db.ts | 1237 +++++++++++++--- 20 files changed, 2651 insertions(+), 457 deletions(-) create mode 100644 docs/examples/databases/create-longtext-attribute.md create mode 100644 docs/examples/databases/create-mediumtext-attribute.md create mode 100644 docs/examples/databases/create-text-attribute.md create mode 100644 docs/examples/databases/create-varchar-attribute.md create mode 100644 docs/examples/databases/update-longtext-attribute.md create mode 100644 docs/examples/databases/update-mediumtext-attribute.md create mode 100644 docs/examples/databases/update-text-attribute.md create mode 100644 docs/examples/databases/update-varchar-attribute.md create mode 100644 docs/examples/tablesdb/create-longtext-column.md create mode 100644 docs/examples/tablesdb/create-mediumtext-column.md create mode 100644 docs/examples/tablesdb/create-text-column.md create mode 100644 docs/examples/tablesdb/create-varchar-column.md create mode 100644 docs/examples/tablesdb/update-longtext-column.md create mode 100644 docs/examples/tablesdb/update-mediumtext-column.md create mode 100644 docs/examples/tablesdb/update-text-column.md create mode 100644 docs/examples/tablesdb/update-varchar-column.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 864ca38..2f4c61f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## 22.0.0 * Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). +* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. +* Add `getQueueAudits` support to `Health` service. ## 21.1.0 diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 0000000..f3b8874 --- /dev/null +++ b/docs/examples/databases/create-longtext-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.createLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 0000000..5fbda08 --- /dev/null +++ b/docs/examples/databases/create-mediumtext-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.createMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 0000000..4a2af55 --- /dev/null +++ b/docs/examples/databases/create-text-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.createTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 0000000..3c443ae --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.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 databases = new sdk.Databases(client); + +const result = await databases.createVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 0000000..efb82f4 --- /dev/null +++ b/docs/examples/databases/update-longtext-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.updateLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 0000000..aea41d0 --- /dev/null +++ b/docs/examples/databases/update-mediumtext-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.updateMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 0000000..9d1453e --- /dev/null +++ b/docs/examples/databases/update-text-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.updateTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 0000000..d28a306 --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.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 databases = new sdk.Databases(client); + +const result = await databases.updateVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +}); diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 0000000..fd16d70 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createLongtextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 0000000..109db51 --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createMediumtextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 0000000..a1d0ca8 --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createTextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 0000000..34ccacd --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-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 tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createVarcharColumn({ + databaseId: '', + tableId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +}); diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 0000000..9888bba --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateLongtextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 0000000..84befdd --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateMediumtextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 0000000..0324b9c --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateTextColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +}); diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 0000000..7dd2a1a --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-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 tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateVarcharColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +}); diff --git a/src/models.ts b/src/models.ts index 0d1b832..f534a0d 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1238,6 +1238,178 @@ export namespace Models { default?: any[]; } + /** + * AttributeVarchar + */ + export type AttributeVarchar = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Attribute size. + */ + size: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeText + */ + export type AttributeText = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeMediumtext + */ + export type AttributeMediumtext = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeLongtext + */ + export type AttributeLongtext = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + /** * Table */ @@ -1912,6 +2084,178 @@ export namespace Models { default?: any[]; } + /** + * ColumnVarchar + */ + export type ColumnVarchar = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * 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; + } + + /** + * ColumnText + */ + export type ColumnText = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnMediumtext + */ + export type ColumnMediumtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnLongtext + */ + export type ColumnLongtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + /** * Index */ diff --git a/src/services/databases.ts b/src/services/databases.ts index 86fdbd7..d739a19 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2738,46 +2738,50 @@ export class Databases { } /** - * Create a geometric point attribute. + * Create a longtext attribute. + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + * @returns {Promise} */ - createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a geometric point attribute. + * Create a longtext attribute. + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; - createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[] + xdefault: rest[3] as string, + array: rest[4] as boolean }; } @@ -2786,6 +2790,7 @@ export class Databases { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const array = params.array; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2800,7 +2805,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2811,6 +2816,9 @@ export class Databases { 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 } = { @@ -2826,48 +2834,49 @@ export class Databases { } /** - * Update a point attribute. Changing the `default` value will not update already existing documents. + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + * @returns {Promise} */ - updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a point attribute. Changing the `default` value will not update already existing documents. + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; - updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + updateLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[], + xdefault: rest[3] as string, newKey: rest[4] as string }; } @@ -2891,8 +2900,11 @@ export class Databases { 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}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2918,46 +2930,50 @@ export class Databases { } /** - * Create a geometric polygon attribute. + * Create a mediumtext attribute. + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + * @returns {Promise} */ - createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a geometric polygon attribute. + * Create a mediumtext attribute. + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; - createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[] + xdefault: rest[3] as string, + array: rest[4] as boolean }; } @@ -2966,6 +2982,7 @@ export class Databases { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const array = params.array; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2980,7 +2997,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2991,6 +3008,9 @@ export class Databases { 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 } = { @@ -3006,48 +3026,49 @@ export class Databases { } /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + * @returns {Promise} */ - updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; - updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + updateMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[], + xdefault: rest[3] as string, newKey: rest[4] as string }; } @@ -3071,17 +3092,805 @@ export class Databases { 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}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric point attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + */ + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + /** + * Create a geometric point attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + */ + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; + updatePointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + */ + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + /** + * Create a geometric polygon attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + */ + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; + updatePolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.relatedCollectionId - Related Collection ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Attribute Key. + * @param {string} params.twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. + */ + createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} relatedCollectionId - Related Collection ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Attribute Key. + * @param {string} twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise; + createRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise { + let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + relatedCollectionId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const relatedCollectionId = params.relatedCollectionId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof relatedCollectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof relatedCollectionId !== 'undefined') { + payload['relatedCollectionId'] = relatedCollectionId; + } + 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 attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for text attributes, in number of characters. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. + */ + createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + /** + * Create a string attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for text attributes, in number of characters. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; + createStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + 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 attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the string attribute. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. + */ + updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + /** + * Update a string attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the string attribute. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; + updateStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof 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 text attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise} + */ + createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + /** + * Create a text attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } if (typeof required !== 'undefined') { payload['required'] = required; } if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + if (typeof array !== 'undefined') { + payload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -3090,7 +3899,7 @@ export class Databases { } return this.client.call( - 'patch', + 'post', uri, apiHeaders, payload, @@ -3098,68 +3907,59 @@ export class Databases { } /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * Update a text attribute. Changing the `default` value will not update already existing documents. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.relatedCollectionId - Related Collection ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. - * @param {string} params.twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. + * @returns {Promise} */ - createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * Update a text attribute. Changing the `default` value will not update already existing documents. * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} relatedCollectionId - Related Collection ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. - * @param {string} twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise; - createRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise { - let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + updateTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, - relatedCollectionId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string }; } const databaseId = params.databaseId; const collectionId = params.collectionId; - const relatedCollectionId = params.relatedCollectionId; - const type = params.type; - const twoWay = params.twoWay; const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3167,32 +3967,26 @@ export class Databases { if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } - if (typeof relatedCollectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); + 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}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); const payload: Payload = {}; - if (typeof relatedCollectionId !== 'undefined') { - payload['relatedCollectionId'] = relatedCollectionId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; + if (typeof required !== 'undefined') { + payload['required'] = required; } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -3201,7 +3995,7 @@ export class Databases { } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload, @@ -3209,68 +4003,60 @@ export class Databases { } /** - * Create a string attribute. + * Create a URL attribute. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.collectionId - Collection ID. * @param {string} params.key - Attribute Key. - * @param {number} params.size - Attribute size for text attributes, in number of characters. * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. */ - createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a string attribute. + * Create a URL attribute. * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. - * @param {number} size - Attribute size for text attributes, in number of characters. * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; - createStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean }; } const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; - const size = params.size; const required = params.required; const xdefault = params.xdefault; const array = params.array; - const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3281,21 +4067,15 @@ export class Databases { 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}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; } - if (typeof size !== 'undefined') { - payload['size'] = size; - } if (typeof required !== 'undefined') { payload['required'] = required; } @@ -3305,9 +4085,6 @@ export class Databases { 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 } = { @@ -3323,45 +4100,43 @@ export class Databases { } /** - * Update a string attribute. Changing the `default` value will not update already existing documents. + * Update an url attribute. Changing the `default` value will not update already existing documents. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.collectionId - Collection ID. * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} params.size - Maximum size of the string attribute. * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. */ - updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a string attribute. Changing the `default` value will not update already existing documents. + * Update an url attribute. Changing the `default` value will not update already existing documents. * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} size - Maximum size of the string attribute. * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; - updateStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -3369,8 +4144,7 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[4] as string }; } @@ -3379,7 +4153,6 @@ export class Databases { const key = params.key; const required = params.required; const xdefault = params.xdefault; - const size = params.size; const newKey = params.newKey; if (typeof databaseId === 'undefined') { @@ -3398,7 +4171,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "xdefault"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3406,9 +4179,6 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } - if (typeof size !== 'undefined') { - payload['size'] = size; - } if (typeof newKey !== 'undefined') { payload['newKey'] = newKey; } @@ -3427,57 +4197,60 @@ export class Databases { } /** - * Create a URL attribute. + * Create a varchar attribute. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. + * @returns {Promise} */ - createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a URL attribute. + * Create a varchar attribute. * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; - createUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean }; } const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; + const size = params.size; const required = params.required; const xdefault = params.xdefault; const array = params.array; @@ -3491,15 +4264,21 @@ export class Databases { 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}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; } + if (typeof size !== 'undefined') { + payload['size'] = size; + } if (typeof required !== 'undefined') { payload['required'] = required; } @@ -3524,43 +4303,44 @@ export class Databases { } /** - * Update an url attribute. Changing the `default` value will not update already existing documents. + * Update a varchar attribute. Changing the `default` value will not update already existing documents. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the varchar attribute. * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. + * @returns {Promise} */ - updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; /** - * Update an url attribute. Changing the `default` value will not update already existing documents. + * Update a varchar attribute. Changing the `default` value will not update already existing documents. * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the varchar attribute. * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; - updateUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + updateVarcharAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; + updateVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -3568,7 +4348,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] as string + size: rest[4] as number, + newKey: rest[5] as string }; } @@ -3577,6 +4358,7 @@ export class Databases { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const size = params.size; const newKey = params.newKey; if (typeof databaseId === 'undefined') { @@ -3595,7 +4377,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "xdefault"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3603,6 +4385,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof size !== 'undefined') { + payload['size'] = size; + } if (typeof newKey !== 'undefined') { payload['newKey'] = newKey; } diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index f64286d..d40301b 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2709,45 +2709,50 @@ export class TablesDB { } /** - * Create a geometric point column. + * Create a longtext column. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a geometric point column. + * Create a longtext column. + * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; - createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[] + xdefault: rest[3] as string, + array: rest[4] as boolean }; } @@ -2756,6 +2761,7 @@ export class TablesDB { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const array = params.array; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2770,7 +2776,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2781,6 +2787,9 @@ export class TablesDB { 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 } = { @@ -2796,47 +2805,49 @@ export class TablesDB { } /** - * Update a point column. Changing the `default` value will not update already existing rows. + * Update a longtext column. Changing the `default` value will not update already existing rows. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a point column. Changing the `default` value will not update already existing rows. + * Update a longtext column. Changing the `default` value will not update already existing rows. + * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {string} newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; - updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + updateLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[], + xdefault: rest[3] as string, newKey: rest[4] as string }; } @@ -2860,8 +2871,11 @@ export class TablesDB { if (typeof required === 'undefined') { throw new AppwriteException('Missing required parameter: "required"'); } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2887,45 +2901,50 @@ export class TablesDB { } /** - * Create a geometric polygon column. + * Create a mediumtext column. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a geometric polygon column. + * Create a mediumtext column. + * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; - createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[] + xdefault: rest[3] as string, + array: rest[4] as boolean }; } @@ -2934,6 +2953,7 @@ export class TablesDB { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const array = params.array; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2948,7 +2968,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2959,6 +2979,9 @@ export class TablesDB { 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 } = { @@ -2974,48 +2997,830 @@ export class TablesDB { } /** - * Update a polygon column. Changing the `default` value will not update already existing rows. + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a polygon column. Changing the `default` value will not update already existing rows. + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {string} newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; - updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + updateMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric point column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + */ + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + /** + * Create a geometric point column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; + updatePointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + */ + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + /** + * Create a geometric polygon column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise; + updatePolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.relatedTableId - Related Table ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Column Key. + * @param {string} params.twoWayKey - Two Way Column Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise} + */ + createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} relatedTableId - Related Table ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Column Key. + * @param {string} twoWayKey - Two Way Column Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise; + createRelationshipColumn( + paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise { + let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + relatedTableId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const relatedTableId = params.relatedTableId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + 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 = '/tablesdb/{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} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for text columns, in number of characters. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. + */ + createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + /** + * Create a string column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {number} size - Column size for text columns, in number of characters. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; + createStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + 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 = '/tablesdb/{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} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the string column. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. + */ + updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + /** + * Update a string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the string column. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; + updateStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{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 text column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise} + */ + createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + /** + * Create a text column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string + xdefault: rest[3] as string, + array: rest[4] as boolean }; } @@ -3024,7 +3829,7 @@ export class TablesDB { const key = params.key; const required = params.required; const xdefault = params.xdefault; - const newKey = params.newKey; + const array = params.array; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3039,16 +3844,19 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.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 newKey !== 'undefined') { - payload['newKey'] = newKey; + if (typeof array !== 'undefined') { + payload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -3057,7 +3865,7 @@ export class TablesDB { } return this.client.call( - 'patch', + 'post', uri, apiHeaders, payload, @@ -3065,67 +3873,59 @@ export class TablesDB { } /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * Update a text column. Changing the `default` value will not update already existing rows. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.relatedTableId - Related Table ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. - * @param {string} params.twoWayKey - Two Way Column Key. - * @param {RelationMutate} params.onDelete - Constraints option + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * Update a text column. Changing the `default` value will not update already existing rows. * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} relatedTableId - Related Table ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. - * @param {string} twoWayKey - Two Way Column Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise; - createRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise { - let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + updateTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, - relatedTableId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string }; } const databaseId = params.databaseId; const tableId = params.tableId; - const relatedTableId = params.relatedTableId; - const type = params.type; - const twoWay = params.twoWay; const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3133,32 +3933,26 @@ export class TablesDB { if (typeof tableId === 'undefined') { throw new AppwriteException('Missing required parameter: "tableId"'); } - if (typeof relatedTableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedTableId"'); + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); 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 required !== 'undefined') { + payload['required'] = required; } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -3167,7 +3961,7 @@ export class TablesDB { } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload, @@ -3175,67 +3969,59 @@ export class TablesDB { } /** - * Create a string column. + * Create a URL column. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. * @param {string} params.key - Column Key. - * @param {number} params.size - Column size for text columns, in number of characters. * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a string column. + * Create a URL column. * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. * @param {string} key - Column Key. - * @param {number} size - Column size for text columns, in number of characters. * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; - createStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean }; } const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; - const size = params.size; const required = params.required; const xdefault = params.xdefault; const array = params.array; - const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3246,21 +4032,15 @@ export class TablesDB { 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 = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.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; } @@ -3270,9 +4050,6 @@ export class TablesDB { 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 } = { @@ -3288,44 +4065,42 @@ export class TablesDB { } /** - * Update a string column. Changing the `default` value will not update already existing rows. + * Update an url column. Changing the `default` value will not update already existing rows. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.tableId - Table ID. * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} params.size - Maximum size of the string column. * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** - * Update a string column. Changing the `default` value will not update already existing rows. + * Update an url column. Changing the `default` value will not update already existing rows. * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} tableId - Table ID. * @param {string} key - Column Key. * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} size - Maximum size of the string column. * @param {string} newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; - updateStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; + updateUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -3333,8 +4108,7 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[4] as string }; } @@ -3343,7 +4117,6 @@ export class TablesDB { const key = params.key; const required = params.required; const xdefault = params.xdefault; - const size = params.size; const newKey = params.newKey; if (typeof databaseId === 'undefined') { @@ -3362,7 +4135,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "xdefault"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const apiPath = '/tablesdb/{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; @@ -3370,9 +4143,6 @@ export class TablesDB { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } - if (typeof size !== 'undefined') { - payload['size'] = size; - } if (typeof newKey !== 'undefined') { payload['newKey'] = newKey; } @@ -3391,56 +4161,60 @@ export class TablesDB { } /** - * Create a URL column. + * Create a varchar column. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for varchar columns, in number of characters. Maximum size is 16381. * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; /** - * Create a URL column. + * Create a varchar column. * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. + * @param {number} size - Column size for varchar columns, in number of characters. Maximum size is 16381. * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; - createUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean }; } const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; + const size = params.size; const required = params.required; const xdefault = params.xdefault; const array = params.array; @@ -3454,15 +4228,21 @@ export class TablesDB { 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 = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.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; } @@ -3487,42 +4267,44 @@ export class TablesDB { } /** - * Update an url column. Changing the `default` value will not update already existing rows. + * Update a varchar column. Changing the `default` value will not update already existing rows. * * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.key - Column Key. * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the varchar column. * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; /** - * Update an url column. Changing the `default` value will not update already existing rows. + * Update a varchar column. Changing the `default` value will not update already existing rows. * * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} key - Column Key. * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the varchar column. * @param {string} newKey - New Column Key. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise; - updateUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + updateVarcharColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise; + updateVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -3530,7 +4312,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] as string + size: rest[4] as number, + newKey: rest[5] as string }; } @@ -3539,6 +4322,7 @@ export class TablesDB { const key = params.key; const required = params.required; const xdefault = params.xdefault; + const size = params.size; const newKey = params.newKey; if (typeof databaseId === 'undefined') { @@ -3557,7 +4341,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "xdefault"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3565,6 +4349,9 @@ export class TablesDB { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof size !== 'undefined') { + payload['size'] = size; + } if (typeof newKey !== 'undefined') { payload['newKey'] = newKey; } From 45362b04354c9abcac6578e68f1f6d8b9ad6bf56 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Feb 2026 12:35:19 +0000 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4c61f..a6755c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). * Breaking change: `Output` enum has been removed; use `ImageFormat` instead. * Add `getQueueAudits` support to `Health` service. +* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. ## 21.1.0 @@ -102,4 +103,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`. +> 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