From 4338c4761fce875cf8294ecb2d893a3855865cbb Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Mar 2026 08:42:31 +0000 Subject: [PATCH 1/3] updated sdk --- CHANGELOG.md | 14 +- README.md | 2 +- docs/examples/activities/get-event.md | 14 - docs/examples/activities/list-events.md | 14 - docs/examples/backups/create-archive.md | 15 - docs/examples/backups/create-policy.md | 20 - docs/examples/backups/create-restoration.md | 17 - docs/examples/backups/delete-archive.md | 14 - docs/examples/backups/delete-policy.md | 14 - docs/examples/backups/get-archive.md | 14 - docs/examples/backups/get-policy.md | 14 - docs/examples/backups/get-restoration.md | 14 - docs/examples/backups/list-archives.md | 14 - docs/examples/backups/list-policies.md | 14 - docs/examples/backups/list-restorations.md | 14 - docs/examples/backups/update-policy.md | 18 - docs/examples/databases/list-documents.md | 3 +- docs/examples/sites/create-deployment.md | 4 +- docs/examples/tablesdb/list-rows.md | 3 +- package.json | 2 +- src/client.ts | 4 +- src/enums/backup-services.ts | 5 - src/enums/build-runtime.ts | 3 + src/enums/runtime.ts | 3 + src/enums/scopes.ts | 9 - src/index.ts | 3 - src/models.ts | 356 +-------- src/services/activities.ts | 115 --- src/services/backups.ts | 753 -------------------- src/services/databases.ts | 193 ++--- src/services/health.ts | 255 ------- src/services/messaging.ts | 4 +- src/services/sites.ts | 29 +- src/services/storage.ts | 8 +- src/services/tables-db.ts | 21 +- src/services/teams.ts | 8 +- 36 files changed, 156 insertions(+), 1851 deletions(-) delete mode 100644 docs/examples/activities/get-event.md delete mode 100644 docs/examples/activities/list-events.md delete mode 100644 docs/examples/backups/create-archive.md delete mode 100644 docs/examples/backups/create-policy.md delete mode 100644 docs/examples/backups/create-restoration.md delete mode 100644 docs/examples/backups/delete-archive.md delete mode 100644 docs/examples/backups/delete-policy.md delete mode 100644 docs/examples/backups/get-archive.md delete mode 100644 docs/examples/backups/get-policy.md delete mode 100644 docs/examples/backups/get-restoration.md delete mode 100644 docs/examples/backups/list-archives.md delete mode 100644 docs/examples/backups/list-policies.md delete mode 100644 docs/examples/backups/list-restorations.md delete mode 100644 docs/examples/backups/update-policy.md delete mode 100644 src/enums/backup-services.ts delete mode 100644 src/services/activities.ts delete mode 100644 src/services/backups.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fdaeb0c..01a79ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,8 @@ # Change Log -## 22.1.2 - -* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals - -## 22.1.1 - -* Removed unused BigNumber import from src/client.ts to clean up dependencies -* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples -* Updated README to specify Appwrite server compatibility with 1.8.x -* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) - ## 22.0.1 * Fix doc examples with proper formatting -* Add support for the new `Backups` service ## 22.0.0 @@ -119,4 +107,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 4be156d7..764e488d 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 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version latest. 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/activities/get-event.md b/docs/examples/activities/get-event.md deleted file mode 100644 index da7c261f..00000000 --- a/docs/examples/activities/get-event.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 activities = new sdk.Activities(client); - -const result = await activities.getEvent({ - eventId: '' -}); -``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md deleted file mode 100644 index 11407e89..00000000 --- a/docs/examples/activities/list-events.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 activities = new sdk.Activities(client); - -const result = await activities.listEvents({ - queries: '' // optional -}); -``` 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/list-documents.md b/docs/examples/databases/list-documents.md index be2b3703..11fcec2d 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -13,6 +13,7 @@ const result = await databases.listDocuments({ collectionId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); ``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 1fea6050..2603dda9 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -12,9 +12,9 @@ const sites = new sdk.Sites(client); const result = await sites.createDeployment({ siteId: '', code: InputFile.fromPath('/path/to/file', 'filename'), - activate: false, installCommand: '', // optional buildCommand: '', // optional - outputDirectory: '' // optional + outputDirectory: '', // optional + activate: false // optional }); ``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 1f6894b3..2777730b 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -13,6 +13,7 @@ const result = await tablesDB.listRows({ tableId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); ``` diff --git a/package.json b/package.json index d962a23e..5b25687a 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.2", + "version": "22.0.1", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index b6a5991a..11f4a110 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/22.1.2'; + let ua = 'AppwriteNodeJSSDK/22.0.1'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -122,7 +122,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '22.1.2', + 'x-sdk-version': '22.0.1', '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 3f85913f..0741a17e 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -30,6 +30,9 @@ export enum BuildRuntime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', + 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 fda3bab3..68765627 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -30,6 +30,9 @@ export enum Runtime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', + 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 083114b2..c09d0e26 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -56,13 +56,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', - EventsRead = 'events.read', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 2e7ab5fc..90112c81 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,6 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; -export { Activities } from './services/activities'; 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'; @@ -31,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 e688dcc9..46610fcb 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[]; } /** @@ -2413,7 +2405,7 @@ export namespace Models { */ $id: string; /** - * Row automatically incrementing ID. + * Row sequence ID. */ $sequence: number; /** @@ -2452,7 +2444,7 @@ export namespace Models { */ $id: string; /** - * Document automatically incrementing ID. + * Document sequence ID. */ $sequence: number; /** @@ -4376,348 +4368,4 @@ export namespace Models { */ expired: boolean; } - - /** - * ActivityEvent - */ - export type ActivityEvent = { - /** - * Event ID. - */ - $id: string; - /** - * User type. - */ - userType: string; - /** - * User ID. - */ - userId: string; - /** - * User Email. - */ - userEmail: string; - /** - * User Name. - */ - userName: string; - /** - * Resource parent. - */ - resourceParent: string; - /** - * Resource type. - */ - resourceType: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource. - */ - resource: string; - /** - * Event name. - */ - event: string; - /** - * User agent. - */ - userAgent: string; - /** - * IP address. - */ - ip: string; - /** - * API mode when event triggered. - */ - mode: string; - /** - * Location. - */ - country: string; - /** - * Log creation date in ISO 8601 format. - */ - time: string; - /** - * Project ID. - */ - projectId: string; - /** - * Team ID. - */ - teamId: string; - /** - * Hostname. - */ - hostname: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * 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; - } - - /** - * Activity event list - */ - export type ActivityEventList = { - /** - * Total number of events that matched your query. - */ - total: number; - /** - * List of events. - */ - events: ActivityEvent[]; - } - - /** - * 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/activities.ts b/src/services/activities.ts deleted file mode 100644 index 23071821..00000000 --- a/src/services/activities.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -export class Activities { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List all events for selected filters. - * - * @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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise} - */ - listEvents(params?: { queries?: string }): Promise; - /** - * List all events for selected filters. - * - * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEvents(queries?: string): Promise; - listEvents( - 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 = '/activities/events'; - 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 event by ID. - * - * - * @param {string} params.eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getEvent(params: { eventId: string }): Promise; - /** - * Get event by ID. - * - * - * @param {string} eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getEvent(eventId: string): Promise; - getEvent( - paramsOrFirst: { eventId: string } | string - ): Promise { - let params: { eventId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { eventId: string }; - } else { - params = { - eventId: paramsOrFirst as string - }; - } - - const eventId = params.eventId; - - if (typeof eventId === 'undefined') { - throw new AppwriteException('Missing required parameter: "eventId"'); - } - - const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); - 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/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 f7d5c32d..b559e71e 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1134,7 +1134,7 @@ export class Databases { * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -1149,7 +1149,7 @@ export class Databases { * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -3606,6 +3606,90 @@ export class Databases { ); } + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + */ + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; + updateRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Create a string attribute. * @@ -4568,90 +4652,6 @@ export class Databases { ); } - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. - */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; - updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4660,11 +4660,12 @@ export class Databases { * @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. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4673,26 +4674,28 @@ export class Databases { * @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. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -4701,6 +4704,7 @@ export class Databases { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4720,6 +4724,9 @@ export class Databases { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } 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/messaging.ts b/src/services/messaging.ts index f3f94f04..16dd8998 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -4928,7 +4928,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @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. You may filter on the following attributes: name, provider, type, enabled + * @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. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} @@ -4939,7 +4939,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @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. You may filter on the following attributes: name, provider, type, enabled + * @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. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} diff --git a/src/services/sites.ts b/src/services/sites.ts index 365e8091..5018382a 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -733,56 +733,56 @@ export class Sites { * * @param {string} params.siteId - Site ID. * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @param {string} params.installCommand - Install Commands. * @param {string} params.buildCommand - Build Commands. * @param {string} params.outputDirectory - Output Directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise; /** * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. * * @param {string} siteId - Site ID. * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @param {string} installCommand - Install Commands. * @param {string} buildCommand - Build Commands. * @param {string} outputDirectory - Output Directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void): Promise; + createDeployment(siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (boolean)?, (string)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] ): Promise { - let params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + let params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; let onProgress: ((progress: UploadProgress) => void); if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + params = (paramsOrFirst || {}) as { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { siteId: paramsOrFirst as string, code: rest[0] as File, - activate: rest[1] as boolean, - installCommand: rest[2] as string, - buildCommand: rest[3] as string, - outputDirectory: rest[4] as string + installCommand: rest[1] as string, + buildCommand: rest[2] as string, + outputDirectory: rest[3] as string, + activate: rest[4] as boolean }; onProgress = rest[5] as ((progress: UploadProgress) => void); } const siteId = params.siteId; const code = params.code; - const activate = params.activate; const installCommand = params.installCommand; const buildCommand = params.buildCommand; const outputDirectory = params.outputDirectory; + const activate = params.activate; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -790,9 +790,6 @@ export class Sites { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); const payload: Payload = {}; 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 398450ff..af1fa996 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -4933,10 +4933,11 @@ export class TablesDB { * @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. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -4945,26 +4946,28 @@ export class TablesDB { * @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. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -4973,6 +4976,7 @@ export class TablesDB { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4992,6 +4996,9 @@ export class TablesDB { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/teams.ts b/src/services/teams.ts index 099111b3..0666aec8 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -398,7 +398,7 @@ export class Teams { * * * @param {string} params.teamId - Team ID. - * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} params.email - Email of the new team member. * @param {string} params.userId - ID of the user to be added to a team. * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -419,7 +419,7 @@ export class Teams { * * * @param {string} teamId - Team ID. - * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} email - Email of the new team member. * @param {string} userId - ID of the user to be added to a team. * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -564,7 +564,7 @@ export class Teams { * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. - * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} */ @@ -575,7 +575,7 @@ export class Teams { * * @param {string} teamId - Team ID. * @param {string} membershipId - Membership ID. - * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. From f41ae3129caf7c56933194f4ccb5199d8f46ab5b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Mar 2026 10:11:59 +0000 Subject: [PATCH 2/3] regen --- CHANGELOG.md | 14 +- README.md | 2 +- docs/examples/activities/get-event.md | 14 + docs/examples/activities/list-events.md | 14 + docs/examples/backups/create-archive.md | 15 + docs/examples/backups/create-policy.md | 20 + docs/examples/backups/create-restoration.md | 17 + docs/examples/backups/delete-archive.md | 14 + docs/examples/backups/delete-policy.md | 14 + docs/examples/backups/get-archive.md | 14 + docs/examples/backups/get-policy.md | 14 + docs/examples/backups/get-restoration.md | 14 + docs/examples/backups/list-archives.md | 14 + docs/examples/backups/list-policies.md | 14 + docs/examples/backups/list-restorations.md | 14 + docs/examples/backups/update-policy.md | 18 + docs/examples/health/get-console-pausing.md | 15 + package.json | 2 +- src/client.ts | 4 +- src/enums/backup-services.ts | 5 + src/enums/build-runtime.ts | 3 - src/enums/runtime.ts | 3 - src/enums/scopes.ts | 9 + src/index.ts | 3 + src/models.ts | 352 +++++++++ src/services/activities.ts | 115 +++ src/services/backups.ts | 753 ++++++++++++++++++++ src/services/health.ts | 316 ++++++++ src/services/storage.ts | 8 +- 29 files changed, 1799 insertions(+), 15 deletions(-) create mode 100644 docs/examples/activities/get-event.md create mode 100644 docs/examples/activities/list-events.md create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/health/get-console-pausing.md create mode 100644 src/enums/backup-services.ts create mode 100644 src/services/activities.ts create mode 100644 src/services/backups.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a79ab9..0fdaeb0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,20 @@ # Change Log +## 22.1.2 + +* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals + +## 22.1.1 + +* Removed unused BigNumber import from src/client.ts to clean up dependencies +* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples +* Updated README to specify Appwrite server compatibility with 1.8.x +* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) + ## 22.0.1 * Fix doc examples with proper formatting +* Add support for the new `Backups` service ## 22.0.0 @@ -107,4 +119,4 @@ * Rename `templateBranch` to `templateVersion` in `createFunction()`. * Rename `downloadDeployment()` to `getDeploymentDownload()` -> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. \ No newline at end of file +> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. diff --git a/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/activities/get-event.md b/docs/examples/activities/get-event.md new file mode 100644 index 00000000..da7c261f --- /dev/null +++ b/docs/examples/activities/get-event.md @@ -0,0 +1,14 @@ +```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 activities = new sdk.Activities(client); + +const result = await activities.getEvent({ + eventId: '' +}); +``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md new file mode 100644 index 00000000..11407e89 --- /dev/null +++ b/docs/examples/activities/list-events.md @@ -0,0 +1,14 @@ +```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 activities = new sdk.Activities(client); + +const result = await activities.listEvents({ + queries: '' // optional +}); +``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 00000000..1a11d459 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,15 @@ +```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 new file mode 100644 index 00000000..71670929 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,20 @@ +```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 new file mode 100644 index 00000000..f41a2344 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,17 @@ +```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 new file mode 100644 index 00000000..f0c5615d --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..493e89ef --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..ade4e222 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..391c0196 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..46d18f3a --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..d6f51c56 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..7f87b1d6 --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..4475a17d --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,14 @@ +```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 new file mode 100644 index 00000000..5912b39f --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,18 @@ +```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/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..a3dfca6f --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,15 @@ +```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.getConsolePausing({ + threshold: null, // optional + inactivityDays: null // optional +}); +``` diff --git a/package.json b/package.json index 5b25687a..e9e4bbb8 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.0.1", + "version": "22.2.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 11f4a110..87a58c94 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/22.0.1'; + let ua = 'AppwriteNodeJSSDK/22.2.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -122,7 +122,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '22.0.1', + 'x-sdk-version': '22.2.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts new file mode 100644 index 00000000..f0f829ab --- /dev/null +++ b/src/enums/backup-services.ts @@ -0,0 +1,5 @@ +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 0741a17e..3f85913f 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -30,9 +30,6 @@ export enum BuildRuntime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - 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 68765627..fda3bab3 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -30,9 +30,6 @@ export enum Runtime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - 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 c09d0e26..083114b2 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -56,4 +56,13 @@ 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', + EventsRead = 'events.read', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 90112c81..2e7ab5fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,8 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; +export { Activities } from './services/activities'; 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'; @@ -29,6 +31,7 @@ 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 46610fcb..fea4da85 100644 --- a/src/models.ts +++ b/src/models.ts @@ -562,6 +562,14 @@ export namespace Models { * Database type. */ type: DatabaseType; + /** + * Database backup policies. + */ + policies: Index[]; + /** + * Database backup archives. + */ + archives: Collection[]; } /** @@ -4368,4 +4376,348 @@ export namespace Models { */ expired: boolean; } + + /** + * ActivityEvent + */ + export type ActivityEvent = { + /** + * Event ID. + */ + $id: string; + /** + * User type. + */ + userType: string; + /** + * User ID. + */ + userId: string; + /** + * User Email. + */ + userEmail: string; + /** + * User Name. + */ + userName: string; + /** + * Resource parent. + */ + resourceParent: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource. + */ + resource: string; + /** + * Event name. + */ + event: string; + /** + * User agent. + */ + userAgent: string; + /** + * IP address. + */ + ip: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * Location. + */ + country: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Project ID. + */ + projectId: string; + /** + * Team ID. + */ + teamId: string; + /** + * Hostname. + */ + hostname: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * 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; + } + + /** + * Activity event list + */ + export type ActivityEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: ActivityEvent[]; + } + + /** + * 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/activities.ts b/src/services/activities.ts new file mode 100644 index 00000000..23071821 --- /dev/null +++ b/src/services/activities.ts @@ -0,0 +1,115 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Activities { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all events for selected filters. + * + * @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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise} + */ + listEvents(params?: { queries?: string }): Promise; + /** + * List all events for selected filters. + * + * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEvents(queries?: string): Promise; + listEvents( + 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 = '/activities/events'; + 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 event by ID. + * + * + * @param {string} params.eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getEvent(params: { eventId: string }): Promise; + /** + * Get event by ID. + * + * + * @param {string} eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEvent(eventId: string): Promise; + getEvent( + paramsOrFirst: { eventId: string } | string + ): Promise { + let params: { eventId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { eventId: string }; + } else { + params = { + eventId: paramsOrFirst as string + }; + } + + const eventId = params.eventId; + + if (typeof eventId === 'undefined') { + throw new AppwriteException('Missing required parameter: "eventId"'); + } + + const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); + 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/backups.ts b/src/services/backups.ts new file mode 100644 index 00000000..32774270 --- /dev/null +++ b/src/services/backups.ts @@ -0,0 +1,753 @@ +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/health.ts b/src/services/health.ts index d0b7d06f..e3d724c3 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -130,6 +130,67 @@ export class Health { ); } + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise} + */ + getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise; + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsolePausing(threshold?: number, inactivityDays?: number): Promise; + getConsolePausing( + paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, + ...rest: [(number)?] + ): Promise { + let params: { threshold?: number, inactivityDays?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; + } else { + params = { + threshold: paramsOrFirst as number, + inactivityDays: rest[0] as number + }; + } + + const threshold = params.threshold; + const inactivityDays = params.inactivityDays; + + + const apiPath = '/health/console-pausing'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + if (typeof inactivityDays !== 'undefined') { + payload['inactivityDays'] = inactivityDays; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * Check the Appwrite database servers are up and connection is successful. * @@ -227,6 +288,108 @@ 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. * @@ -278,6 +441,57 @@ 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. * @@ -755,6 +969,57 @@ 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. * @@ -857,6 +1122,57 @@ 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 ec5046ef..794ac76d 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 30MB. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. * @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 30MB. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. * @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 30MB. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. * @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 30MB. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. * @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 From 78b1f9d3fc8a594b449e11bc8ffc58645ba6cef8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Mar 2026 10:32:03 +0000 Subject: [PATCH 3/3] regen --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- src/client.ts | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fdaeb0c..503400a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 22.2.0 + +* Added ttl option to listDocuments for cached responses +* Added getConsolePausing health status endpoint in Health service +* Added Health.getConsolePausing overloads (object and positional) +* Added updateRelationshipAttribute for Databases to manage relationship attributes +* Added console pausing example to health docs +* Made activate optional in createDeployment object parameter + ## 22.1.2 * Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals diff --git a/package.json b/package.json index e9e4bbb8..d962a23e 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.2.0", + "version": "22.1.2", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 87a58c94..b6a5991a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/22.2.0'; + let ua = 'AppwriteNodeJSSDK/22.1.2'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -122,7 +122,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '22.2.0', + 'x-sdk-version': '22.1.2', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', };