diff --git a/CHANGELOG.md b/CHANGELOG.md index f0bbbef3..34a77d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # Change Log -## 22.1.0 +## 22.0.2 + +* Fix `bignumber.js` bundler conflict by removing direct dependency in favor of transitive dependency from `json-bigint` + +## 22.0.1 * Fix doc examples with proper formatting -* Add support for the new `Backups` service ## 22.0.0 @@ -108,4 +111,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 diff --git a/README.md b/README.md index 764e488d..4be156d7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md deleted file mode 100644 index 1a11d459..00000000 --- a/docs/examples/backups/create-archive.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.createArchive({ - services: [sdk.BackupServices.Databases], - resourceId: '' // optional -}); -``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md deleted file mode 100644 index 71670929..00000000 --- a/docs/examples/backups/create-policy.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.createPolicy({ - policyId: '', - services: [sdk.BackupServices.Databases], - retention: 1, - schedule: '', - name: '', // optional - resourceId: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md deleted file mode 100644 index f41a2344..00000000 --- a/docs/examples/backups/create-restoration.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.createRestoration({ - archiveId: '', - services: [sdk.BackupServices.Databases], - newResourceId: '', // optional - newResourceName: '' // optional -}); -``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md deleted file mode 100644 index f0c5615d..00000000 --- a/docs/examples/backups/delete-archive.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.deleteArchive({ - archiveId: '' -}); -``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md deleted file mode 100644 index 493e89ef..00000000 --- a/docs/examples/backups/delete-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.deletePolicy({ - policyId: '' -}); -``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md deleted file mode 100644 index ade4e222..00000000 --- a/docs/examples/backups/get-archive.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.getArchive({ - archiveId: '' -}); -``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md deleted file mode 100644 index 391c0196..00000000 --- a/docs/examples/backups/get-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.getPolicy({ - policyId: '' -}); -``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md deleted file mode 100644 index 46d18f3a..00000000 --- a/docs/examples/backups/get-restoration.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.getRestoration({ - restorationId: '' -}); -``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md deleted file mode 100644 index d6f51c56..00000000 --- a/docs/examples/backups/list-archives.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.listArchives({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md deleted file mode 100644 index 7f87b1d6..00000000 --- a/docs/examples/backups/list-policies.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.listPolicies({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md deleted file mode 100644 index 4475a17d..00000000 --- a/docs/examples/backups/list-restorations.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.listRestorations({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md deleted file mode 100644 index 5912b39f..00000000 --- a/docs/examples/backups/update-policy.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -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 backups = new sdk.Backups(client); - -const result = await backups.updatePolicy({ - policyId: '', - name: '', // optional - retention: 1, // optional - schedule: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index 9d358055..cc83d250 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createLongtextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 2ea9b87b..6bab1b49 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createMediumtextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index 5d49ed31..3d56639a 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createTextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index dd5511d8..75ae5c34 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -15,6 +15,7 @@ const result = await databases.createVarcharAttribute({ size: 1, required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index 5b2fd2e2..00000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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.getQueueBillingProjectAggregation({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index 61b45003..00000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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.getQueueBillingTeamAggregation({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md deleted file mode 100644 index c37bcd66..00000000 --- a/docs/examples/health/get-queue-priority-builds.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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.getQueuePriorityBuilds({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md deleted file mode 100644 index e02b3022..00000000 --- a/docs/examples/health/get-queue-region-manager.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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.getQueueRegionManager({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md deleted file mode 100644 index 9b166cac..00000000 --- a/docs/examples/health/get-queue-threats.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -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.getQueueThreats({ - threshold: null // optional -}); -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 68e4d7b8..0e43b442 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createLongtextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index ac8108d3..42557dbe 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createMediumtextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index e7cfa7bc..8f9960ac 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createTextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index debd75d8..4f1b5de4 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -15,6 +15,7 @@ const result = await tablesDB.createVarcharColumn({ size: 1, required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/package.json b/package.json index 8c5c8807..d6aacd92 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "22.1.0", + "version": "22.0.2", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 8413e7ef..e6f2e823 100644 --- a/src/client.ts +++ b/src/client.ts @@ -60,7 +60,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/22.1.0'; + let ua = 'AppwriteNodeJSSDK/22.0.2'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -109,7 +109,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '22.1.0', + 'x-sdk-version': '22.0.2', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts deleted file mode 100644 index f0f829ab..00000000 --- a/src/enums/backup-services.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum BackupServices { - Databases = 'databases', - Functions = 'functions', - Storage = 'storage', -} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index d9394ae9..f112bfdb 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -21,6 +21,9 @@ export enum BuildRuntime { Python312 = 'python-3.12', Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 3b6f9f3b..3ac9de0d 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -21,6 +21,9 @@ export enum Runtime { Python312 = 'python-3.12', Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 4ac98a12..70ef50fc 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -54,12 +54,4 @@ export enum Scopes { AssistantRead = 'assistant.read', TokensRead = 'tokens.read', TokensWrite = 'tokens.write', - PoliciesWrite = 'policies.write', - PoliciesRead = 'policies.read', - ArchivesRead = 'archives.read', - ArchivesWrite = 'archives.write', - RestorationsRead = 'restorations.read', - RestorationsWrite = 'restorations.write', - DomainsRead = 'domains.read', - DomainsWrite = 'domains.write', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c356102b..90112c81 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,6 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Avatars } from './services/avatars'; -export { Backups } from './services/backups'; export { Databases } from './services/databases'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; @@ -30,7 +29,6 @@ export { Theme } from './enums/theme'; export { Timezone } from './enums/timezone'; export { BrowserPermission } from './enums/browser-permission'; export { ImageFormat } from './enums/image-format'; -export { BackupServices } from './enums/backup-services'; export { RelationshipType } from './enums/relationship-type'; export { RelationMutate } from './enums/relation-mutate'; export { IndexType } from './enums/index-type'; diff --git a/src/models.ts b/src/models.ts index 8f9521eb..684c6056 100644 --- a/src/models.ts +++ b/src/models.ts @@ -562,14 +562,6 @@ export namespace Models { * Database type. */ type: DatabaseType; - /** - * Database backup policies. - */ - policies: Index[]; - /** - * Database backup archives. - */ - archives: Collection[]; } /** @@ -1298,6 +1290,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1340,6 +1336,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1382,6 +1382,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1424,6 +1428,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2152,6 +2160,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2194,6 +2206,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2236,6 +2252,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2278,6 +2298,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -4344,200 +4368,4 @@ export namespace Models { */ expired: boolean; } - - /** - * Archive - */ - export type BackupArchive = { - /** - * Archive ID. - */ - $id: string; - /** - * Archive creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Archive update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Archive policy ID. - */ - policyId: string; - /** - * Archive size in bytes. - */ - size: number; - /** - * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this archive. - */ - services: string[]; - /** - * The resources that are backed up by this archive. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this archive should backup a single resource. - */ - resourceId?: string; - /** - * The resource type to backup. Set only if this archive should backup a single resource. - */ - resourceType?: string; - } - - /** - * backup - */ - export type BackupPolicy = { - /** - * Backup policy ID. - */ - $id: string; - /** - * Backup policy name. - */ - name: string; - /** - * Policy creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Policy update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this policy should backup a single resource. - */ - resourceId?: string; - /** - * The resource type to backup. Set only if this policy should backup a single resource. - */ - resourceType?: string; - /** - * How many days to keep the backup before it will be automatically deleted. - */ - retention: number; - /** - * Policy backup schedule in CRON format. - */ - schedule: string; - /** - * Is this policy enabled. - */ - enabled: boolean; - } - - /** - * Restoration - */ - export type BackupRestoration = { - /** - * Restoration ID. - */ - $id: string; - /** - * Restoration creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Restoration update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Backup archive ID. - */ - archiveId: string; - /** - * Backup policy ID. - */ - policyId: string; - /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. - */ - resources: string[]; - /** - * Optional data in key-value object. - */ - options: string; - } - - /** - * Backup archive list - */ - export type BackupArchiveList = { - /** - * Total number of archives that matched your query. - */ - total: number; - /** - * List of archives. - */ - archives: BackupArchive[]; - } - - /** - * Backup policy list - */ - export type BackupPolicyList = { - /** - * Total number of policies that matched your query. - */ - total: number; - /** - * List of policies. - */ - policies: BackupPolicy[]; - } - - /** - * Backup restoration list - */ - export type BackupRestorationList = { - /** - * Total number of restorations that matched your query. - */ - total: number; - /** - * List of restorations. - */ - restorations: BackupRestoration[]; - } } diff --git a/src/services/backups.ts b/src/services/backups.ts deleted file mode 100644 index 32774270..00000000 --- a/src/services/backups.ts +++ /dev/null @@ -1,753 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { BackupServices } from '../enums/backup-services'; - -export class Backups { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List all archives for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - */ - listArchives(params?: { queries?: string[] }): Promise; - /** - * List all archives for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listArchives(queries?: string[]): Promise; - listArchives( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} params.services - Array of services to backup - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise} - */ - createArchive(params: { services: BackupServices[], resourceId?: string }): Promise; - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} services - Array of services to backup - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createArchive(services: BackupServices[], resourceId?: string): Promise; - createArchive( - paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], - ...rest: [(string)?] - ): Promise { - let params: { services: BackupServices[], resourceId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { services: BackupServices[], resourceId?: string }; - } else { - params = { - services: paramsOrFirst as BackupServices[], - resourceId: rest[0] as string - }; - } - - const services = params.services; - const resourceId = params.resourceId; - - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a backup archive using it's ID. - * - * @param {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - getArchive(params: { archiveId: string }): Promise; - /** - * Get a backup archive using it's ID. - * - * @param {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getArchive(archiveId: string): Promise; - getArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an existing archive for a project. - * - * @param {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteArchive(params: { archiveId: string }): Promise<{}>; - /** - * Delete an existing archive for a project. - * - * @param {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteArchive(archiveId: string): Promise<{}>; - deleteArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<{}> { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List all policies for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - */ - listPolicies(params?: { queries?: string[] }): Promise; - /** - * List all policies for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPolicies(queries?: string[]): Promise; - listPolicies( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new backup policy. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {BackupServices[]} params.services - Array of services to backup - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Schedule CRON syntax. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise} - */ - createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise; - /** - * Create a new backup policy. - * - * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {BackupServices[]} services - Array of services to backup - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Schedule CRON syntax. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise; - createPolicy( - paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, - ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise { - let params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - retention: rest[1] as number, - schedule: rest[2] as string, - name: rest[3] as string, - resourceId: rest[4] as string, - enabled: rest[5] as boolean - }; - } - - const policyId = params.policyId; - const services = params.services; - const retention = params.retention; - const schedule = params.schedule; - const name = params.name; - const resourceId = params.resourceId; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - if (typeof retention === 'undefined') { - throw new AppwriteException('Missing required parameter: "retention"'); - } - if (typeof schedule === 'undefined') { - throw new AppwriteException('Missing required parameter: "schedule"'); - } - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof policyId !== 'undefined') { - payload['policyId'] = policyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a backup policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - getPolicy(params: { policyId: string }): Promise; - /** - * Get a backup policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPolicy(policyId: string): Promise; - getPolicy( - paramsOrFirst: { policyId: string } | string - ): Promise { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an existing policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Cron expression - * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise; - /** - * Update an existing policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Cron expression - * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise; - updatePolicy( - paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, - ...rest: [(string)?, (number)?, (string)?, (boolean)?] - ): Promise { - let params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - name: rest[0] as string, - retention: rest[1] as number, - schedule: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const policyId = params.policyId; - const name = params.name; - const retention = params.retention; - const schedule = params.schedule; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePolicy(params: { policyId: string }): Promise<{}>; - /** - * Delete a policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePolicy(policyId: string): Promise<{}>; - deletePolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<{}> { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} params.archiveId - Backup archive ID to restore - * @param {BackupServices[]} params.services - Array of services to restore - * @param {string} params.newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise; - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} archiveId - Backup archive ID to restore - * @param {BackupServices[]} services - Array of services to restore - * @param {string} newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise; - createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?] - ): Promise { - let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - } else { - params = { - archiveId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - newResourceId: rest[1] as string, - newResourceName: rest[2] as string - }; - } - - const archiveId = params.archiveId; - const services = params.services; - const newResourceId = params.newResourceId; - const newResourceName = params.newResourceName; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/restoration'; - const payload: Payload = {}; - if (typeof archiveId !== 'undefined') { - payload['archiveId'] = archiveId; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof newResourceId !== 'undefined') { - payload['newResourceId'] = newResourceId; - } - if (typeof newResourceName !== 'undefined') { - payload['newResourceName'] = newResourceName; - } - 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, - ); - } - - /** - * List all backup restorations for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - */ - listRestorations(params?: { queries?: string[] }): Promise; - /** - * List all backup restorations for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRestorations(queries?: string[]): Promise; - listRestorations( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/restorations'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the current status of a backup restoration. - * - * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - getRestoration(params: { restorationId: string }): Promise; - /** - * Get the current status of a backup restoration. - * - * @param {string} restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRestoration(restorationId: string): Promise; - getRestoration( - paramsOrFirst: { restorationId: string } | string - ): Promise { - let params: { restorationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { restorationId: string }; - } else { - params = { - restorationId: paramsOrFirst as string - }; - } - - const restorationId = params.restorationId; - - if (typeof restorationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "restorationId"'); - } - - const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/databases.ts b/src/services/databases.ts index d739a193..f7d5c32d 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2747,10 +2747,11 @@ export class Databases { * @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} */ - createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a longtext attribute. * @@ -2761,19 +2762,20 @@ export class Databases { * @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. */ - createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2781,7 +2783,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2791,6 +2794,7 @@ export class Databases { 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"'); @@ -2819,6 +2823,9 @@ 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 } = { @@ -2939,10 +2946,11 @@ export class Databases { * @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} */ - createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a mediumtext attribute. * @@ -2953,19 +2961,20 @@ export class Databases { * @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. */ - createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2973,7 +2982,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2983,6 +2993,7 @@ export class Databases { 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"'); @@ -3011,6 +3022,9 @@ 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 } = { @@ -3820,10 +3834,11 @@ export class Databases { * @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} */ - createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a text attribute. * @@ -3834,19 +3849,20 @@ export class Databases { * @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. */ - createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -3854,7 +3870,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -3864,6 +3881,7 @@ export class Databases { 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"'); @@ -3892,6 +3910,9 @@ 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 } = { @@ -4207,10 +4228,11 @@ export class Databases { * @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} */ - createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a varchar attribute. * @@ -4222,19 +4244,20 @@ export class Databases { * @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. */ - createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: 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)?] + 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 }; + 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 }; + 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, @@ -4243,7 +4266,8 @@ export class Databases { size: rest[2] as number, required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, + encrypt: rest[6] as boolean }; } @@ -4254,6 +4278,7 @@ export class Databases { 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"'); @@ -4288,6 +4313,9 @@ 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 } = { diff --git a/src/services/health.ts b/src/services/health.ts index f3598669..d0b7d06f 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -227,108 +227,6 @@ export class Health { ); } - /** - * Get billing project aggregation queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueBillingProjectAggregation(params?: { threshold?: number }): Promise; - /** - * Get billing project aggregation queue. - * - * @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. - */ - getQueueBillingProjectAggregation(threshold?: number): Promise; - getQueueBillingProjectAggregation( - 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/billing-project-aggregation'; - 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 billing team aggregation queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueBillingTeamAggregation(params?: { threshold?: number }): Promise; - /** - * Get billing team aggregation queue. - * - * @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. - */ - getQueueBillingTeamAggregation(threshold?: number): Promise; - getQueueBillingTeamAggregation( - 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/billing-team-aggregation'; - 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. * @@ -380,57 +278,6 @@ export class Health { ); } - /** - * Get the priority builds queue size. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueuePriorityBuilds(params?: { threshold?: number }): Promise; - /** - * Get the priority builds queue size. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueuePriorityBuilds(threshold?: number): Promise; - getQueuePriorityBuilds( - 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/builds-priority'; - 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 certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. * @@ -908,57 +755,6 @@ export class Health { ); } - /** - * Get region manager queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueRegionManager(params?: { threshold?: number }): Promise; - /** - * Get region manager queue. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueRegionManager(threshold?: number): Promise; - getQueueRegionManager( - 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/region-manager'; - 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 metrics that are waiting to be processed in the Appwrite stats resources queue. * @@ -1061,57 +857,6 @@ export class Health { ); } - /** - * Get threats queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueThreats(params?: { threshold?: number }): Promise; - /** - * Get threats queue. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueThreats(threshold?: number): Promise; - getQueueThreats( - 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/threats'; - 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 webhooks that are waiting to be processed in the Appwrite internal queue server. * diff --git a/src/services/storage.ts b/src/services/storage.ts index 794ac76d..ec5046ef 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -86,7 +86,7 @@ export class Storage { * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). * @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 5GB. + * @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 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 @@ -104,7 +104,7 @@ export class Storage { * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). * @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 5GB. + * @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 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 @@ -266,7 +266,7 @@ export class Storage { * @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). * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). * @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 5GB. + * @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 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 @@ -284,7 +284,7 @@ export class Storage { * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). * @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 5GB. + * @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 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 diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index d40301b4..398450ff 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2718,10 +2718,11 @@ export class TablesDB { * @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} */ - createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a longtext column. * @@ -2732,19 +2733,20 @@ export class TablesDB { * @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. */ - createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2752,7 +2754,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2762,6 +2765,7 @@ export class TablesDB { 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"'); @@ -2790,6 +2794,9 @@ 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 } = { @@ -2910,10 +2917,11 @@ export class TablesDB { * @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} */ - createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a mediumtext column. * @@ -2924,19 +2932,20 @@ export class TablesDB { * @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. */ - createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2944,7 +2953,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2954,6 +2964,7 @@ export class TablesDB { 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"'); @@ -2982,6 +2993,9 @@ 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 } = { @@ -3786,10 +3800,11 @@ export class TablesDB { * @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} */ - createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a text column. * @@ -3800,19 +3815,20 @@ export class TablesDB { * @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. */ - createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, 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, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -3820,7 +3836,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -3830,6 +3847,7 @@ export class TablesDB { 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"'); @@ -3858,6 +3876,9 @@ 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 } = { @@ -4171,10 +4192,11 @@ export class TablesDB { * @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} */ - createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a varchar column. * @@ -4186,19 +4208,20 @@ export class TablesDB { * @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. */ - createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: 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)?] + 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 }; + 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 }; + 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, @@ -4207,7 +4230,8 @@ export class TablesDB { size: rest[2] as number, required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, + encrypt: rest[6] as boolean }; } @@ -4218,6 +4242,7 @@ export class TablesDB { 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"'); @@ -4252,6 +4277,9 @@ 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 } = {