diff --git a/CHANGELOG.md b/CHANGELOG.md index 842e0fb3..86e993ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Change Log +## 13.2.0 + +* Added: `Apps` service for managing OAuth2 apps, secrets, and tokens +* Added: `Compute` service for dedicated database management (backups, branches, connections, replicas, restorations) +* Added: `Advisor` service with `listInsights`, `getInsight`, `listReports`, `getReport`, and `deleteReport` +* Added: `getAuditsDB` method on `Health` service +* Added: `createSesProvider` and `updateSesProvider` methods on `Messaging` service +* Added: `updateOAuth2Server` method on `Project` service +* Added: `updatePasswordStrengthPolicy` method on `Project` service +* Added: Models for dedicated databases, apps, advisor insights/reports, and new password policies +* Updated: `getPolicy` now also returns password-strength and email-deny policy types +* Updated: Renamed enums to match server naming (`FunctionRuntime` to `Runtime`, `SiteFramework` to `Framework`, `SiteBuildRuntime` to `BuildRuntime`, `SiteAdapter` to `Adapter`, `MigrationOnDuplicate` to `OnDuplicate`, `RedirectStatusCode` to `StatusCode`, `OrganizationAddon` to `Addon`, `ProjectStatus` to `Status`) +* Updated: `X-Appwrite-Project` is now sent per request instead of set globally on `setProject` + +## 13.1.0 + +* Added: `Organization` service with organization-scoped key methods (`listKeys`, `createKey`, `getKey`, `updateKey`, `deleteKey`) +* Added: `Presences` service with `list`, `get`, and `getUsage` methods +* Added: `Usage` service with `listEvents` and `listGauges` methods +* Added: `listOrganizationScopes` and `getEmailTemplate` methods on `Console` service +* Updated: Renamed enums for clearer namespacing (e.g. `Scopes` to `AccountKeyScopes`, `Theme` to `BrowserTheme`, `Runtime` to `FunctionRuntime`) + ## 13.0.0 * Breaking: Renamed `updateCanonicalEmails` to `updateDenyCanonicalEmailPolicy` on `Project` service diff --git a/README.md b/README.md index 8cf6f116..a58f3c0a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 5699dab4..c3f841ec 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -9,7 +9,7 @@ const account = new Account(client); const result = await account.updatePassword({ password: '', - oldPassword: 'password' // optional + oldPassword: '' // optional }); console.log(result); diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 00000000..d549dddb --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Advisor } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.deleteReport({ + reportId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 00000000..bf59a7ed --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getInsight({ + reportId: '', + insightId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 00000000..cdb46636 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Advisor } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getReport({ + reportId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 00000000..e3d97867 --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Advisor } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listInsights({ + reportId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 00000000..5cf736e5 --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listReports({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md new file mode 100644 index 00000000..651f45ac --- /dev/null +++ b/docs/examples/apps/create-secret.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.createSecret({ + appId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md new file mode 100644 index 00000000..75cf2997 --- /dev/null +++ b/docs/examples/apps/create.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.create({ + appId: '', + name: '', + redirectUris: [], + enabled: false, // optional + internal: false, // optional + type: 'public', // optional + teamId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md new file mode 100644 index 00000000..563d686f --- /dev/null +++ b/docs/examples/apps/delete-secret.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.deleteSecret({ + appId: '', + secretId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md new file mode 100644 index 00000000..ed8b5ead --- /dev/null +++ b/docs/examples/apps/delete-tokens.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.deleteTokens({ + appId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md new file mode 100644 index 00000000..4ca4b2c7 --- /dev/null +++ b/docs/examples/apps/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.delete({ + appId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md new file mode 100644 index 00000000..84c82082 --- /dev/null +++ b/docs/examples/apps/get-secret.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.getSecret({ + appId: '', + secretId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md new file mode 100644 index 00000000..5a278482 --- /dev/null +++ b/docs/examples/apps/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.get({ + appId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md new file mode 100644 index 00000000..58124086 --- /dev/null +++ b/docs/examples/apps/list-secrets.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.listSecrets({ + appId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md new file mode 100644 index 00000000..7fadc60d --- /dev/null +++ b/docs/examples/apps/list.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.list({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md new file mode 100644 index 00000000..fc93365c --- /dev/null +++ b/docs/examples/apps/update-team.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.updateTeam({ + appId: '', + teamId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md new file mode 100644 index 00000000..292ad93e --- /dev/null +++ b/docs/examples/apps/update.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Apps } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const apps = new Apps(client); + +const result = await apps.update({ + appId: '', + name: '', + enabled: false, // optional + internal: false, // optional + redirectUris: [], // optional + type: 'public' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-backup-policy.md b/docs/examples/compute/create-database-backup-policy.md new file mode 100644 index 00000000..5e6ac7f3 --- /dev/null +++ b/docs/examples/compute/create-database-backup-policy.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseBackupPolicy({ + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-backup.md b/docs/examples/compute/create-database-backup.md new file mode 100644 index 00000000..56aa3645 --- /dev/null +++ b/docs/examples/compute/create-database-backup.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseBackup({ + databaseId: '', + type: 'full' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-branch.md b/docs/examples/compute/create-database-branch.md new file mode 100644 index 00000000..67a02c62 --- /dev/null +++ b/docs/examples/compute/create-database-branch.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseBranch({ + databaseId: '', + branchId: '', // optional + ttl: 300 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-connection.md b/docs/examples/compute/create-database-connection.md new file mode 100644 index 00000000..63376f04 --- /dev/null +++ b/docs/examples/compute/create-database-connection.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseConnection({ + databaseId: '', + username: '', + role: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-execution.md b/docs/examples/compute/create-database-execution.md new file mode 100644 index 00000000..4308bd39 --- /dev/null +++ b/docs/examples/compute/create-database-execution.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseExecution({ + databaseId: '', + sql: '', + bindings: {}, // optional + timeoutSeconds: 1 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-extension.md b/docs/examples/compute/create-database-extension.md new file mode 100644 index 00000000..ef35473d --- /dev/null +++ b/docs/examples/compute/create-database-extension.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseExtension({ + databaseId: '', + name: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-failover.md b/docs/examples/compute/create-database-failover.md new file mode 100644 index 00000000..d66e8191 --- /dev/null +++ b/docs/examples/compute/create-database-failover.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseFailover({ + databaseId: '', + targetReplicaId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-migration.md b/docs/examples/compute/create-database-migration.md new file mode 100644 index 00000000..9e08e3ce --- /dev/null +++ b/docs/examples/compute/create-database-migration.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseMigration({ + databaseId: '', + targetType: 'shared', + specification: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-query-explanation.md b/docs/examples/compute/create-database-query-explanation.md new file mode 100644 index 00000000..b041fb63 --- /dev/null +++ b/docs/examples/compute/create-database-query-explanation.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseQueryExplanation({ + databaseId: '', + query: '', + analyze: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-restoration.md b/docs/examples/compute/create-database-restoration.md new file mode 100644 index 00000000..2ca09f21 --- /dev/null +++ b/docs/examples/compute/create-database-restoration.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseRestoration({ + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetTime: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-schema-preview.md b/docs/examples/compute/create-database-schema-preview.md new file mode 100644 index 00000000..f0fecfa6 --- /dev/null +++ b/docs/examples/compute/create-database-schema-preview.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseSchemaPreview({ + databaseId: '', + sql: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database-upgrade.md b/docs/examples/compute/create-database-upgrade.md new file mode 100644 index 00000000..94ea1c71 --- /dev/null +++ b/docs/examples/compute/create-database-upgrade.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabaseUpgrade({ + databaseId: '', + targetVersion: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/create-database.md b/docs/examples/compute/create-database.md new file mode 100644 index 00000000..d3738db2 --- /dev/null +++ b/docs/examples/compute/create-database.md @@ -0,0 +1,45 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.createDatabase({ + databaseId: '', + name: '', + database: '', // optional + engine: 'postgres', // optional + version: '17', // optional + region: 'fra', // optional + type: 'shared', // optional + specification: '', // optional + backend: 'prisma', // optional + cpu: 125, // optional + memory: 128, // optional + storage: 1, // optional + storageClass: 'ssd', // optional + storageMaxGb: 0, // optional + highAvailability: false, // optional + highAvailabilityReplicaCount: 0, // optional + highAvailabilitySyncMode: 'async', // optional + networkMaxConnections: 10, // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + backupEnabled: false, // optional + backupPitr: false, // optional + backupCron: '', // optional + backupRetentionDays: 1, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsEnabled: false, // optional + poolerEnabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/delete-database-backup.md b/docs/examples/compute/delete-database-backup.md new file mode 100644 index 00000000..650a377a --- /dev/null +++ b/docs/examples/compute/delete-database-backup.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.deleteDatabaseBackup({ + databaseId: '', + backupId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/delete-database-branch.md b/docs/examples/compute/delete-database-branch.md new file mode 100644 index 00000000..d75cdbbb --- /dev/null +++ b/docs/examples/compute/delete-database-branch.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.deleteDatabaseBranch({ + databaseId: '', + branchId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/delete-database-connection.md b/docs/examples/compute/delete-database-connection.md new file mode 100644 index 00000000..a1114da5 --- /dev/null +++ b/docs/examples/compute/delete-database-connection.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.deleteDatabaseConnection({ + databaseId: '', + connectionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/delete-database-extension.md b/docs/examples/compute/delete-database-extension.md new file mode 100644 index 00000000..1ca0fc97 --- /dev/null +++ b/docs/examples/compute/delete-database-extension.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.deleteDatabaseExtension({ + databaseId: '', + extensionName: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/delete-database.md b/docs/examples/compute/delete-database.md new file mode 100644 index 00000000..f9af218f --- /dev/null +++ b/docs/examples/compute/delete-database.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.deleteDatabase({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-backup.md b/docs/examples/compute/get-database-backup.md new file mode 100644 index 00000000..ae9460dd --- /dev/null +++ b/docs/examples/compute/get-database-backup.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseBackup({ + databaseId: '', + backupId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-credentials.md b/docs/examples/compute/get-database-credentials.md new file mode 100644 index 00000000..990ca006 --- /dev/null +++ b/docs/examples/compute/get-database-credentials.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseCredentials({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-ha-status.md b/docs/examples/compute/get-database-ha-status.md new file mode 100644 index 00000000..b54d506d --- /dev/null +++ b/docs/examples/compute/get-database-ha-status.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseHAStatus({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-insights.md b/docs/examples/compute/get-database-insights.md new file mode 100644 index 00000000..42598c39 --- /dev/null +++ b/docs/examples/compute/get-database-insights.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseInsights({ + databaseId: '', + period: '1h', // optional + limit: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-metrics.md b/docs/examples/compute/get-database-metrics.md new file mode 100644 index 00000000..2feccab2 --- /dev/null +++ b/docs/examples/compute/get-database-metrics.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseMetrics({ + databaseId: '', + period: '1h' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-pitr-windows.md b/docs/examples/compute/get-database-pitr-windows.md new file mode 100644 index 00000000..9112375e --- /dev/null +++ b/docs/examples/compute/get-database-pitr-windows.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabasePITRWindows({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-pooler.md b/docs/examples/compute/get-database-pooler.md new file mode 100644 index 00000000..494f7866 --- /dev/null +++ b/docs/examples/compute/get-database-pooler.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabasePooler({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-restoration.md b/docs/examples/compute/get-database-restoration.md new file mode 100644 index 00000000..da1637dc --- /dev/null +++ b/docs/examples/compute/get-database-restoration.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseRestoration({ + databaseId: '', + restorationId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-schema.md b/docs/examples/compute/get-database-schema.md new file mode 100644 index 00000000..fcff3bab --- /dev/null +++ b/docs/examples/compute/get-database-schema.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseSchema({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database-status.md b/docs/examples/compute/get-database-status.md new file mode 100644 index 00000000..7d57a227 --- /dev/null +++ b/docs/examples/compute/get-database-status.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabaseStatus({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/get-database.md b/docs/examples/compute/get-database.md new file mode 100644 index 00000000..6522195d --- /dev/null +++ b/docs/examples/compute/get-database.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.getDatabase({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-backup-policies.md b/docs/examples/compute/list-database-backup-policies.md new file mode 100644 index 00000000..f636f120 --- /dev/null +++ b/docs/examples/compute/list-database-backup-policies.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseBackupPolicies({ + databaseId: '', + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-backups.md b/docs/examples/compute/list-database-backups.md new file mode 100644 index 00000000..cabb1578 --- /dev/null +++ b/docs/examples/compute/list-database-backups.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseBackups({ + databaseId: '', + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-branches.md b/docs/examples/compute/list-database-branches.md new file mode 100644 index 00000000..067ae247 --- /dev/null +++ b/docs/examples/compute/list-database-branches.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseBranches({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-connections.md b/docs/examples/compute/list-database-connections.md new file mode 100644 index 00000000..beec11f0 --- /dev/null +++ b/docs/examples/compute/list-database-connections.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseConnections({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-extensions.md b/docs/examples/compute/list-database-extensions.md new file mode 100644 index 00000000..5e71d2c2 --- /dev/null +++ b/docs/examples/compute/list-database-extensions.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseExtensions({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-queries.md b/docs/examples/compute/list-database-queries.md new file mode 100644 index 00000000..34348704 --- /dev/null +++ b/docs/examples/compute/list-database-queries.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseQueries({ + databaseId: '', + limit: 1, // optional + thresholdMs: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-restorations.md b/docs/examples/compute/list-database-restorations.md new file mode 100644 index 00000000..15f3fe20 --- /dev/null +++ b/docs/examples/compute/list-database-restorations.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseRestorations({ + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/list-database-specifications.md b/docs/examples/compute/list-database-specifications.md new file mode 100644 index 00000000..3a7ef6fc --- /dev/null +++ b/docs/examples/compute/list-database-specifications.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabaseSpecifications(); + +console.log(result); +``` diff --git a/docs/examples/compute/list-databases.md b/docs/examples/compute/list-databases.md new file mode 100644 index 00000000..d091bc2c --- /dev/null +++ b/docs/examples/compute/list-databases.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.listDatabases({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/update-database-backup-storage.md b/docs/examples/compute/update-database-backup-storage.md new file mode 100644 index 00000000..deaa05bf --- /dev/null +++ b/docs/examples/compute/update-database-backup-storage.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.updateDatabaseBackupStorage({ + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/update-database-credentials.md b/docs/examples/compute/update-database-credentials.md new file mode 100644 index 00000000..2aaf75bb --- /dev/null +++ b/docs/examples/compute/update-database-credentials.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.updateDatabaseCredentials({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/compute/update-database-maintenance-window.md b/docs/examples/compute/update-database-maintenance-window.md new file mode 100644 index 00000000..9f96a7d4 --- /dev/null +++ b/docs/examples/compute/update-database-maintenance-window.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.updateDatabaseMaintenanceWindow({ + databaseId: '', + day: 'sun', + hourUtc: 0 +}); + +console.log(result); +``` diff --git a/docs/examples/compute/update-database-pooler.md b/docs/examples/compute/update-database-pooler.md new file mode 100644 index 00000000..26139d58 --- /dev/null +++ b/docs/examples/compute/update-database-pooler.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.updateDatabasePooler({ + databaseId: '', + mode: 'transaction', // optional + maxConnections: 10, // optional + defaultPoolSize: 1, // optional + readWriteSplitting: false, // optional + poolerCpuRequest: '', // optional + poolerCpuLimit: '', // optional + poolerMemoryRequest: '', // optional + poolerMemoryLimit: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/compute/update-database.md b/docs/examples/compute/update-database.md new file mode 100644 index 00000000..e99feeb8 --- /dev/null +++ b/docs/examples/compute/update-database.md @@ -0,0 +1,46 @@ +```javascript +import { Client, Compute } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const compute = new Compute(client); + +const result = await compute.updateDatabase({ + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + cpu: 125, // optional + memory: 128, // optional + storage: 1, // optional + storageClass: 'ssd', // optional + highAvailability: false, // optional + highAvailabilityReplicaCount: 0, // optional + highAvailabilitySyncMode: 'async', // optional + networkMaxConnections: 10, // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + backupEnabled: false, // optional + backupPitr: false, // optional + backupCron: '', // optional + backupRetentionDays: 1, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + poolerEnabled: false, // optional + metricsEnabled: false, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index c7b20209..cd1c7983 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Functions, FunctionRuntime, ProjectKeyScopes } from "@appwrite.io/console"; +import { Client, Functions, Runtime, ProjectKeyScopes } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -10,7 +10,7 @@ const functions = new Functions(client); const result = await functions.create({ functionId: '', name: '', - runtime: FunctionRuntime.Node145, + runtime: Runtime.Node145, execute: ["any"], // optional events: [], // optional schedule: '', // optional diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md index e28df0b4..0218028a 100644 --- a/docs/examples/functions/list-templates.md +++ b/docs/examples/functions/list-templates.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Functions, FunctionRuntime, FunctionTemplateUseCase } from "@appwrite.io/console"; +import { Client, Functions, Runtime, FunctionTemplateUseCase } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -8,7 +8,7 @@ const client = new Client() const functions = new Functions(client); const result = await functions.listTemplates({ - runtimes: [FunctionRuntime.Node145], // optional + runtimes: [Runtime.Node145], // optional useCases: [FunctionTemplateUseCase.Starter], // optional limit: 1, // optional offset: 0, // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index c84018bb..98a161de 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Functions, FunctionRuntime, ProjectKeyScopes } from "@appwrite.io/console"; +import { Client, Functions, Runtime, ProjectKeyScopes } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -10,7 +10,7 @@ const functions = new Functions(client); const result = await functions.update({ functionId: '', name: '', - runtime: FunctionRuntime.Node145, // optional + runtime: Runtime.Node145, // optional execute: ["any"], // optional events: [], // optional schedule: '', // optional diff --git a/docs/examples/health/get-audits-db.md b/docs/examples/health/get-audits-db.md new file mode 100644 index 00000000..0dbf5a89 --- /dev/null +++ b/docs/examples/health/get-audits-db.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getAuditsDB(); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-ses-provider.md b/docs/examples/messaging/create-ses-provider.md new file mode 100644 index 00000000..2021d442 --- /dev/null +++ b/docs/examples/messaging/create-ses-provider.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Messaging } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSesProvider({ + providerId: '', + name: '', + accessKey: '', // optional + secretKey: '', // optional + region: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-ses-provider.md b/docs/examples/messaging/update-ses-provider.md new file mode 100644 index 00000000..63d572f3 --- /dev/null +++ b/docs/examples/messaging/update-ses-provider.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Messaging } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.updateSesProvider({ + providerId: '', + name: '', // optional + enabled: false, // optional + accessKey: '', // optional + secretKey: '', // optional + region: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md index 39d13eed..9729806f 100644 --- a/docs/examples/migrations/create-appwrite-migration.md +++ b/docs/examples/migrations/create-appwrite-migration.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations, AppwriteMigrationResource, MigrationOnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations, AppwriteMigrationResource, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -12,7 +12,7 @@ const result = await migrations.createAppwriteMigration({ endpoint: 'https://example.com', projectId: '', apiKey: '', - onDuplicate: MigrationOnDuplicate.Fail // optional + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/migrations/create-csv-import.md b/docs/examples/migrations/create-csv-import.md index 1a2a97d8..d24792b6 100644 --- a/docs/examples/migrations/create-csv-import.md +++ b/docs/examples/migrations/create-csv-import.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations, MigrationOnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -12,7 +12,7 @@ const result = await migrations.createCSVImport({ fileId: '', resourceId: '', internalFile: false, // optional - onDuplicate: MigrationOnDuplicate.Fail // optional + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/migrations/create-json-import.md b/docs/examples/migrations/create-json-import.md index 7af6d23e..f55fc8ff 100644 --- a/docs/examples/migrations/create-json-import.md +++ b/docs/examples/migrations/create-json-import.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations, MigrationOnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -12,7 +12,7 @@ const result = await migrations.createJSONImport({ fileId: '', resourceId: '', internalFile: false, // optional - onDuplicate: MigrationOnDuplicate.Fail // optional + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/organizations/get-addon-price.md b/docs/examples/organizations/get-addon-price.md index 90043327..1f96ba39 100644 --- a/docs/examples/organizations/get-addon-price.md +++ b/docs/examples/organizations/get-addon-price.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Organizations, OrganizationAddon } from "@appwrite.io/console"; +import { Client, Organizations, Addon } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -9,7 +9,7 @@ const organizations = new Organizations(client); const result = await organizations.getAddonPrice({ organizationId: '', - addon: OrganizationAddon.Baa + addon: Addon.Baa }); console.log(result); diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md new file mode 100644 index 00000000..1c92a89f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-server.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Project } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Server({ + enabled: false, + authorizationUrl: 'https://example.com', + scopes: [], // optional + accessTokenDuration: 60, // optional + refreshTokenDuration: 60, // optional + publicAccessTokenDuration: 60, // optional + publicRefreshTokenDuration: 60, // optional + confidentialPkce: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-password-strength-policy.md b/docs/examples/project/update-password-strength-policy.md new file mode 100644 index 00000000..88913c74 --- /dev/null +++ b/docs/examples/project/update-password-strength-policy.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const project = new Project(client); + +const result = await project.updatePasswordStrengthPolicy({ + min: 8, // optional + uppercase: false, // optional + lowercase: false, // optional + number: false, // optional + symbols: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/projects/update-status.md b/docs/examples/projects/update-status.md index 42345b7c..d795d87e 100644 --- a/docs/examples/projects/update-status.md +++ b/docs/examples/projects/update-status.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Projects, ProjectStatus } from "@appwrite.io/console"; +import { Client, Projects, Status } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -9,7 +9,7 @@ const projects = new Projects(client); const result = await projects.updateStatus({ projectId: '', - status: ProjectStatus.Active + status: Status.Active }); console.log(result); diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index 0e632cc2..0ab36157 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Proxy, RedirectStatusCode, ProxyResourceType } from "@appwrite.io/console"; +import { Client, Proxy, StatusCode, ProxyResourceType } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -10,7 +10,7 @@ const proxy = new Proxy(client); const result = await proxy.createRedirectRule({ domain: '', url: 'https://example.com', - statusCode: RedirectStatusCode.MovedPermanently, + statusCode: StatusCode.MovedPermanently, resourceId: '', resourceType: ProxyResourceType.Site }); diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 8a4f1595..b6d0c8b6 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Sites, SiteFramework, SiteBuildRuntime, SiteAdapter } from "@appwrite.io/console"; +import { Client, Sites, Framework, BuildRuntime, Adapter } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -10,8 +10,8 @@ const sites = new Sites(client); const result = await sites.create({ siteId: '', name: '', - framework: SiteFramework.Analog, - buildRuntime: SiteBuildRuntime.Node145, + framework: Framework.Analog, + buildRuntime: BuildRuntime.Node145, enabled: false, // optional logging: false, // optional timeout: 1, // optional @@ -19,7 +19,7 @@ const result = await sites.create({ buildCommand: '', // optional startCommand: '', // optional outputDirectory: '', // optional - adapter: SiteAdapter.Static, // optional + adapter: Adapter.Static, // optional installationId: '', // optional fallbackFile: '', // optional providerRepositoryId: '', // optional diff --git a/docs/examples/sites/list-templates.md b/docs/examples/sites/list-templates.md index 50b56240..bf6db4d1 100644 --- a/docs/examples/sites/list-templates.md +++ b/docs/examples/sites/list-templates.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Sites, SiteFramework, SiteTemplateUseCase } from "@appwrite.io/console"; +import { Client, Sites, Framework, SiteTemplateUseCase } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -8,7 +8,7 @@ const client = new Client() const sites = new Sites(client); const result = await sites.listTemplates({ - frameworks: [SiteFramework.Analog], // optional + frameworks: [Framework.Analog], // optional useCases: [SiteTemplateUseCase.Portfolio], // optional limit: 1, // optional offset: 0 // optional diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 47f2f7ae..e635761d 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Sites, SiteFramework, SiteBuildRuntime, SiteAdapter } from "@appwrite.io/console"; +import { Client, Sites, Framework, BuildRuntime, Adapter } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -10,7 +10,7 @@ const sites = new Sites(client); const result = await sites.update({ siteId: '', name: '', - framework: SiteFramework.Analog, + framework: Framework.Analog, enabled: false, // optional logging: false, // optional timeout: 1, // optional @@ -18,8 +18,8 @@ const result = await sites.update({ buildCommand: '', // optional startCommand: '', // optional outputDirectory: '', // optional - buildRuntime: SiteBuildRuntime.Node145, // optional - adapter: SiteAdapter.Static, // optional + buildRuntime: BuildRuntime.Node145, // optional + adapter: Adapter.Static, // optional fallbackFile: '', // optional installationId: '', // optional providerRepositoryId: '', // optional diff --git a/docs/examples/vectorsdb/create-text-embeddings.md b/docs/examples/vectorsdb/create-text-embeddings.md index 01654bc4..f5d825e4 100644 --- a/docs/examples/vectorsdb/create-text-embeddings.md +++ b/docs/examples/vectorsdb/create-text-embeddings.md @@ -9,7 +9,7 @@ const vectorsDB = new VectorsDB(client); const result = await vectorsDB.createTextEmbeddings({ texts: [], - model: EmbeddingModel.Embeddinggemma // optional + model: EmbeddingModel.NomicEmbedText // optional }); console.log(result); diff --git a/package-lock.json b/package-lock.json index bbeff03c..32619248 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "13.1.0", + "version": "13.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "13.1.0", + "version": "13.2.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 17c9e470..6ae615b6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@appwrite.io/console", "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": "13.1.0", + "version": "13.2.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 69b7e60f..4c9069a3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -390,7 +390,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '13.1.0', + 'x-sdk-version': '13.2.0', 'X-Appwrite-Response-Format': '1.9.5', }; @@ -472,7 +472,6 @@ class Client { * @return {this} */ setProject(value: string): this { - this.headers['X-Appwrite-Project'] = value; this.config.project = value; return this; } @@ -1103,7 +1102,9 @@ class Client { } async ping(): Promise { - return this.call('GET', new URL(this.config.endpoint + '/ping')); + return this.call('GET', new URL(this.config.endpoint + '/ping'), { + 'X-Appwrite-Project': this.config.project, + }); } async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise { diff --git a/src/enums/site-adapter.ts b/src/enums/adapter.ts similarity index 61% rename from src/enums/site-adapter.ts rename to src/enums/adapter.ts index 8d593a5d..a3b1ae0c 100644 --- a/src/enums/site-adapter.ts +++ b/src/enums/adapter.ts @@ -1,4 +1,4 @@ -export enum SiteAdapter { +export enum Adapter { Static = 'static', Ssr = 'ssr', } \ No newline at end of file diff --git a/src/enums/organization-addon.ts b/src/enums/addon.ts similarity index 64% rename from src/enums/organization-addon.ts rename to src/enums/addon.ts index ff5b7aab..b20c87e6 100644 --- a/src/enums/organization-addon.ts +++ b/src/enums/addon.ts @@ -1,4 +1,4 @@ -export enum OrganizationAddon { +export enum Addon { Baa = 'baa', BackupRecovery = 'backup_recovery', } \ No newline at end of file diff --git a/src/enums/appwrite-migration-resource.ts b/src/enums/appwrite-migration-resource.ts index c8dee275..0ce6d078 100644 --- a/src/enums/appwrite-migration-resource.ts +++ b/src/enums/appwrite-migration-resource.ts @@ -2,6 +2,9 @@ export enum AppwriteMigrationResource { User = 'user', Team = 'team', Membership = 'membership', + Authmethods = 'auth-methods', + Policies = 'policies', + Oauth2provider = 'oauth2-provider', Database = 'database', Table = 'table', Column = 'column', @@ -25,5 +28,14 @@ export enum AppwriteMigrationResource { Sitedeployment = 'site-deployment', Sitevariable = 'site-variable', Platform = 'platform', + Apikey = 'api-key', + Webhook = 'webhook', + Smtp = 'smtp', Backuppolicy = 'backup-policy', + Projectvariable = 'project-variable', + Projectprotocols = 'project-protocols', + Projectlabels = 'project-labels', + Projectservices = 'project-services', + Projectemailtemplate = 'project-email-template', + Rule = 'rule', } \ No newline at end of file diff --git a/src/enums/function-runtime.ts b/src/enums/build-runtime.ts similarity index 98% rename from src/enums/function-runtime.ts rename to src/enums/build-runtime.ts index b80690d8..6c0f0008 100644 --- a/src/enums/function-runtime.ts +++ b/src/enums/build-runtime.ts @@ -1,4 +1,4 @@ -export enum FunctionRuntime { +export enum BuildRuntime { Node145 = 'node-14.5', Node160 = 'node-16.0', Node180 = 'node-18.0', diff --git a/src/enums/embedding-model.ts b/src/enums/embedding-model.ts index cfdbeef1..d06bb77b 100644 --- a/src/enums/embedding-model.ts +++ b/src/enums/embedding-model.ts @@ -1,3 +1,6 @@ export enum EmbeddingModel { - Embeddinggemma = 'embeddinggemma', + Nomicembedtext = 'nomic-embed-text', + Embeddinggemma = 'embedding-gemma', + Allminilm = 'all-minilm', + Bgesmall = 'bge-small', } \ No newline at end of file diff --git a/src/enums/site-framework.ts b/src/enums/framework.ts similarity index 92% rename from src/enums/site-framework.ts rename to src/enums/framework.ts index ec4eaf51..7093da33 100644 --- a/src/enums/site-framework.ts +++ b/src/enums/framework.ts @@ -1,4 +1,4 @@ -export enum SiteFramework { +export enum Framework { Analog = 'analog', Angular = 'angular', Nextjs = 'nextjs', diff --git a/src/enums/migration-on-duplicate.ts b/src/enums/on-duplicate.ts similarity index 66% rename from src/enums/migration-on-duplicate.ts rename to src/enums/on-duplicate.ts index 8b5b9b89..9ab3dc85 100644 --- a/src/enums/migration-on-duplicate.ts +++ b/src/enums/on-duplicate.ts @@ -1,4 +1,4 @@ -export enum MigrationOnDuplicate { +export enum OnDuplicate { Fail = 'fail', Skip = 'skip', Overwrite = 'overwrite', diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index fe019965..47125ddc 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -92,5 +92,7 @@ export enum ProjectKeyScopes { DomainsRead = 'domains.read', DomainsWrite = 'domains.write', EventsRead = 'events.read', + AppsRead = 'apps.read', + AppsWrite = 'apps.write', UsageRead = 'usage.read', } \ No newline at end of file diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts index 2031ce9b..be2ea723 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -1,6 +1,7 @@ export enum ProjectPolicyId { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', + Passwordstrength = 'password-strength', Passwordpersonaldata = 'password-personal-data', Sessionalert = 'session-alert', Sessionduration = 'session-duration', @@ -8,4 +9,7 @@ export enum ProjectPolicyId { Sessionlimit = 'session-limit', Userlimit = 'user-limit', Membershipprivacy = 'membership-privacy', + Denyaliasedemail = 'deny-aliased-email', + Denydisposableemail = 'deny-disposable-email', + Denyfreeemail = 'deny-free-email', } \ No newline at end of file diff --git a/src/enums/project-status.ts b/src/enums/project-status.ts deleted file mode 100644 index 65720b43..00000000 --- a/src/enums/project-status.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum ProjectStatus { - Active = 'active', -} \ No newline at end of file diff --git a/src/enums/query-suggestion-resource.ts b/src/enums/query-suggestion-resource.ts index a17f2788..1d0c8590 100644 --- a/src/enums/query-suggestion-resource.ts +++ b/src/enums/query-suggestion-resource.ts @@ -62,6 +62,9 @@ export enum QuerySuggestionResource { Threats = 'threats', Feedbacks = 'feedbacks', ShInstallations = 'sh_installations', + Apps = 'apps', + AppSecrets = 'appsecrets', + Oauth2Grants = 'oauth2grants', Attributes = 'attributes', Indexes = 'indexes', Functions = 'functions', diff --git a/src/enums/site-build-runtime.ts b/src/enums/runtime.ts similarity index 98% rename from src/enums/site-build-runtime.ts rename to src/enums/runtime.ts index 440ce2b0..40616625 100644 --- a/src/enums/site-build-runtime.ts +++ b/src/enums/runtime.ts @@ -1,4 +1,4 @@ -export enum SiteBuildRuntime { +export enum Runtime { Node145 = 'node-14.5', Node160 = 'node-16.0', Node180 = 'node-18.0', diff --git a/src/enums/redirect-status-code.ts b/src/enums/status-code.ts similarity index 77% rename from src/enums/redirect-status-code.ts rename to src/enums/status-code.ts index 63580669..425d65c3 100644 --- a/src/enums/redirect-status-code.ts +++ b/src/enums/status-code.ts @@ -1,4 +1,4 @@ -export enum RedirectStatusCode { +export enum StatusCode { MovedPermanently = '301', Found = '302', TemporaryRedirect = '307', diff --git a/src/enums/status.ts b/src/enums/status.ts new file mode 100644 index 00000000..abaf754f --- /dev/null +++ b/src/enums/status.ts @@ -0,0 +1,3 @@ +export enum Status { + Active = 'active', +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c26bc0d8..d2303ae4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,8 +8,10 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Activities } from './services/activities'; +export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; +export { Compute } from './services/compute'; export { Assistant } from './services/assistant'; export { Console } from './services/console'; export { Databases } from './services/databases'; @@ -28,6 +30,7 @@ export { Presences } from './services/presences'; export { Project } from './services/project'; export { Projects } from './services/projects'; export { Proxy } from './services/proxy'; +export { Advisor } from './services/advisor'; export { Sites } from './services/sites'; export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; @@ -72,7 +75,7 @@ export { OrderBy } from './enums/order-by'; export { DocumentsDBIndexType } from './enums/documents-db-index-type'; export { DomainRegistrationType } from './enums/domain-registration-type'; export { DomainSuggestionType } from './enums/domain-suggestion-type'; -export { FunctionRuntime } from './enums/function-runtime'; +export { Runtime } from './enums/runtime'; export { ProjectKeyScopes } from './enums/project-key-scopes'; export { FunctionTemplateUseCase } from './enums/function-template-use-case'; export { TemplateReferenceType } from './enums/template-reference-type'; @@ -87,12 +90,12 @@ export { CacheDatabase } from './enums/cache-database'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; export { AppwriteMigrationResource } from './enums/appwrite-migration-resource'; -export { MigrationOnDuplicate } from './enums/migration-on-duplicate'; +export { OnDuplicate } from './enums/on-duplicate'; export { FirebaseMigrationResource } from './enums/firebase-migration-resource'; export { NHostMigrationResource } from './enums/n-host-migration-resource'; export { SupabaseMigrationResource } from './enums/supabase-migration-resource'; export { OrganizationKeyScopes } from './enums/organization-key-scopes'; -export { OrganizationAddon } from './enums/organization-addon'; +export { Addon } from './enums/addon'; export { ProjectAuthMethodId } from './enums/project-auth-method-id'; export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; @@ -102,12 +105,12 @@ export { ProjectServiceId } from './enums/project-service-id'; export { ProjectSMTPSecure } from './enums/project-smtp-secure'; export { ProjectUsageRange } from './enums/project-usage-range'; export { ScheduleResourceType } from './enums/schedule-resource-type'; -export { ProjectStatus } from './enums/project-status'; -export { RedirectStatusCode } from './enums/redirect-status-code'; +export { Status } from './enums/status'; +export { StatusCode } from './enums/status-code'; export { ProxyResourceType } from './enums/proxy-resource-type'; -export { SiteFramework } from './enums/site-framework'; -export { SiteBuildRuntime } from './enums/site-build-runtime'; -export { SiteAdapter } from './enums/site-adapter'; +export { Framework } from './enums/framework'; +export { BuildRuntime } from './enums/build-runtime'; +export { Adapter } from './enums/adapter'; export { SiteTemplateUseCase } from './enums/site-template-use-case'; export { Compression } from './enums/compression'; export { ImageGravity } from './enums/image-gravity'; diff --git a/src/models.ts b/src/models.ts index 2d8e3619..b3350c01 100644 --- a/src/models.ts +++ b/src/models.ts @@ -607,7 +607,7 @@ export namespace Models { /** * List of policies. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail)[]; } /** @@ -834,6 +834,34 @@ export namespace Models { embeddings: Embedding[]; } + /** + * Insights List + */ + export type InsightList = { + /** + * Total number of insights that matched your query. + */ + total: number; + /** + * List of insights. + */ + insights: Insight[]; + } + + /** + * Reports List + */ + export type ReportList = { + /** + * Total number of reports that matched your query. + */ + total: number; + /** + * List of reports. + */ + reports: Report[]; + } + /** * Database */ @@ -5139,6 +5167,10 @@ export namespace Models { * Project team ID. */ teamId: string; + /** + * Project region + */ + region: string; /** * Deprecated since 1.9.5: List of dev keys. */ @@ -5212,21 +5244,53 @@ export namespace Models { */ protocols: ProjectProtocol[]; /** - * Project region + * Project blocks information */ - region: string; + blocks: Block[]; + /** + * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + */ + consoleAccessedAt: string; /** * Billing limits reached */ billingLimits?: BillingLimits; /** - * Project blocks information + * OAuth2 server status */ - blocks: Block[]; + oAuth2ServerEnabled: boolean; /** - * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + * OAuth2 server authorization URL */ - consoleAccessedAt: string; + oAuth2ServerAuthorizationUrl: string; + /** + * OAuth2 server allowed scopes + */ + oAuth2ServerScopes: string[]; + /** + * OAuth2 server access token duration in seconds for confidential clients + */ + oAuth2ServerAccessTokenDuration: number; + /** + * OAuth2 server refresh token duration in seconds for confidential clients + */ + oAuth2ServerRefreshTokenDuration: number; + /** + * OAuth2 server access token duration in seconds for public clients (SPAs, mobile, native) + */ + oAuth2ServerPublicAccessTokenDuration: number; + /** + * OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native) + */ + oAuth2ServerPublicRefreshTokenDuration: number; + /** + * When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + */ + oAuth2ServerConfidentialPkce: boolean; + /** + * OAuth2 server discovery URL + */ + oAuth2ServerDiscoveryUrl: string; } /** @@ -6459,6 +6523,36 @@ export namespace Models { total: number; } + /** + * Policy Password Strength + */ + export type PolicyPasswordStrength = { + /** + * Policy ID. + */ + $id: string; + /** + * Minimum password length required for user passwords. + */ + min: number; + /** + * Whether passwords must include at least one uppercase letter. + */ + uppercase: boolean; + /** + * Whether passwords must include at least one lowercase letter. + */ + lowercase: boolean; + /** + * Whether passwords must include at least one number. + */ + number: boolean; + /** + * Whether passwords must include at least one symbol. + */ + symbols: boolean; + } + /** * Policy Password Personal Data */ @@ -8865,6 +8959,50 @@ export namespace Models { * Number of platforms to be migrated. */ platform: number; + /** + * Number of API keys to be migrated. + */ + apikey: number; + /** + * Number of project variables to be migrated. + */ + projectvariable: number; + /** + * Number of webhooks to be migrated. + */ + webhook: number; + /** + * Number of auth-method configs to be migrated (always 0 or 1 — the project-level flag bundle). + */ + authmethods: number; + /** + * Number of protocol configs to be migrated (always 0 or 1 — the project-level REST/GraphQL/WebSocket flags). + */ + projectprotocols: number; + /** + * Number of label sets to be migrated (always 0 or 1 — the project-level RBAC label array). + */ + projectlabels: number; + /** + * Number of service configs to be migrated (always 0 or 1 — the project-level enable/disable flags for all 17 services). + */ + projectservices: number; + /** + * Number of policy bundles to be migrated (always 0 or 1 — the project-level security policies covering password rules, session behavior, user limits, and membership privacy). + */ + policies: number; + /** + * Number of SMTP configurations to be migrated (always 0 or 1 — the project-level custom SMTP settings; password is not exposed by the source API). + */ + smtp: number; + /** + * Number of custom-domain proxy rules to be migrated. Auto-generated `.appwrite.network` rules are skipped — they are recreated by parent Function/Site migration. + */ + rule: number; + /** + * Number of custom email templates to be migrated (one per templateId × locale pair). + */ + projectemailtemplate: number; /** * Number of sites to be migrated. */ @@ -8893,12 +9031,166 @@ export namespace Models { * Version of the Appwrite instance to be migrated. */ version: string; + /** + * Number of OAuth2 provider configurations to be migrated. Secrets (clientSecret, p8File) are never migrated — destination admin must re-enter them per provider. + */ + oauth2provider: number; /** * Number of backup policies to be migrated. */ backuppolicy: number; } + /** + * Insight + */ + export type Insight = { + /** + * Insight ID. + */ + $id: string; + /** + * Insight creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Insight update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Parent report ID. Insights always belong to a report. + */ + reportId: string; + /** + * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). + */ + type: string; + /** + * Insight severity. One of info, warning, critical. + */ + severity: string; + /** + * Insight status. One of active, dismissed. + */ + status: string; + /** + * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. + */ + resourceType: string; + /** + * ID of the resource the insight is about. + */ + resourceId: string; + /** + * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. + */ + parentResourceType: string; + /** + * ID of the parent resource. Empty when the resource has no parent. + */ + parentResourceId: string; + /** + * Insight title. + */ + title: string; + /** + * Short markdown summary describing the insight. + */ + summary: string; + /** + * List of call-to-action buttons attached to this insight. + */ + ctas: InsightCTA[]; + /** + * Time the insight was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + /** + * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. + */ + dismissedAt?: string; + /** + * User ID that dismissed the insight. Empty when not dismissed. + */ + dismissedBy?: string; + } + + /** + * InsightCTA + */ + export type InsightCTA = { + /** + * Human-readable label for the CTA, used in UI. + */ + label: string; + /** + * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. + */ + service: string; + /** + * Public API method on the chosen service the client should invoke when this CTA is triggered. + */ + method: string; + /** + * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). + */ + params: object; + } + + /** + * Report + */ + export type Report = { + /** + * Report ID. + */ + $id: string; + /** + * Report creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Report update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the third-party app that submitted the report. + */ + appId: string; + /** + * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. + */ + type: string; + /** + * Short, human-readable title for the report. + */ + title: string; + /** + * Markdown summary describing the report. + */ + summary: string; + /** + * Plural noun describing what the report analyzes, e.g. databases, sites, urls. + */ + targetType: string; + /** + * Free-form target identifier (URL for lighthouse, resource ID for db). + */ + target: string; + /** + * Categories covered by the report, e.g. performance, accessibility. + */ + categories: string[]; + /** + * Insights nested under this report. + */ + insights: Insight[]; + /** + * Time the report was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + } + /** * ActivityEvent */ @@ -9349,6 +9641,108 @@ export namespace Models { resourceType?: string; } + /** + * Backup + */ + export type DedicatedDatabaseBackup = { + /** + * Backup ID. + */ + $id: string; + /** + * Backup creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database ID this backup belongs to. + */ + databaseId: string; + /** + * Project ID. + */ + projectId: string; + /** + * Backup policy ID when the backup was created by a schedule. + */ + policyId: string; + /** + * Backup trigger. Possible values: manual, schedule. + */ + trigger: string; + /** + * Backup type. Possible values: full (complete database snapshot), incremental (changes since last backup), wal (write-ahead log continuous archival). + */ + type: string; + /** + * Backup status. Possible values: pending (queued for processing), running (currently in progress), completed (successfully finished), failed (encountered an error), verified (integrity check passed). + */ + status: string; + /** + * Backup size in bytes. + */ + sizeBytes: number; + /** + * Backup start time in ISO 8601 format. + */ + startedAt: string; + /** + * Backup completion time in ISO 8601 format. + */ + completedAt: string; + /** + * Backup verification time in ISO 8601 format. + */ + verifiedAt: string; + /** + * Backup expiration time in ISO 8601 format. + */ + expiresAt: string; + /** + * Error message if backup failed. + */ + error: string; + } + + /** + * BackupList + */ + export type DedicatedDatabaseBackupList = { + /** + * Total number of backups. + */ + total: number; + /** + * List of backups. + */ + backups: DedicatedDatabaseBackup[]; + } + + /** + * BackupStorageConfig + */ + export type DedicatedDatabaseBackupStorage = { + /** + * Storage provider. Possible values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + */ + provider: string; + /** + * Storage bucket or container name. + */ + bucket: string; + /** + * Storage region. + */ + region: string; + /** + * Object key prefix for backups. + */ + prefix: string; + /** + * Custom endpoint for S3-compatible storage. + */ + endpoint: string; + } + /** * Address */ @@ -9641,6 +10035,10 @@ export namespace Models { * Does plan support blocking free email addresses. */ supportsFreeEmailValidation: boolean; + /** + * Does plan support project-specific member roles. + */ + supportsProjectSpecificRoles: boolean; /** * Does plan support backup policies. */ @@ -9819,6 +10217,38 @@ export namespace Models { blocks: Block[]; } + /** + * Branch + */ + export type DedicatedDatabaseBranch = { + /** + * Branch identifier. + */ + branchId: string; + /** + * Branch name. + */ + branchName: string; + /** + * Kubernetes namespace where the branch is deployed. + */ + namespace: string; + /** + * Unix timestamp when the branch expires. + */ + expiresAt: number; + } + + /** + * BranchList + */ + export type DedicatedDatabaseBranchList = { + /** + * List of branches. + */ + branches: DedicatedDatabaseBranch[]; + } + /** * Campaign */ @@ -9873,6 +10303,32 @@ export namespace Models { footer?: boolean; } + /** + * Connection + */ + export type DedicatedDatabaseConnection = { + /** + * Connection ID. + */ + $id: string; + /** + * Connection username. + */ + username: string; + /** + * Database name. + */ + database: string; + /** + * Connection role. Common values: readonly, readwrite. + */ + role: string; + /** + * Connection creation date in ISO 8601 format. + */ + $createdAt: string; + } + /** * Coupon */ @@ -9911,6 +10367,48 @@ export namespace Models { onlyNewOrgs: boolean; } + /** + * Credentials + */ + export type DedicatedDatabaseCredentials = { + /** + * Database ID. + */ + $id: string; + /** + * Database hostname. + */ + host: string; + /** + * Database port. + */ + port: number; + /** + * Database username. + */ + username: string; + /** + * Database password. + */ + password: string; + /** + * Database name. + */ + database: string; + /** + * Database engine. Possible values: postgres, mysql, mariadb, mongodb. + */ + engine: string; + /** + * Whether SSL is required. + */ + ssl: boolean; + /** + * Full connection string. + */ + connectionString: string; + } + /** * Credit */ @@ -9990,319 +10488,711 @@ export namespace Models { } /** - * DNSRecord + * DatabaseMetrics */ - export type DnsRecord = { - /** - * DNS Record ID. - */ - $id: string; + export type DedicatedDatabaseMetrics = { /** - * DNS Record creation time in ISO 8601 format. + * Metrics aggregation period. Possible values: 1h (last hour), 24h (last 24 hours), 7d (last 7 days), 30d (last 30 days). */ - $createdAt: string; + period: string; /** - * DNS Record update date in ISO 8601 format. + * Average CPU usage percentage. */ - $updatedAt: string; + cpuPercent: number; /** - * DNS record type (e.g. A, CNAME, MX). + * Average memory usage percentage. */ - type: string; + memoryPercent: number; /** - * Record name or subdomain. + * Memory used in bytes. */ - name: string; + memoryUsedBytes: number; /** - * Value of the record (IP address, domain, etc.). + * Maximum memory available in bytes. */ - value: string; + memoryMaxBytes: number; /** - * Time to live (in seconds). + * Storage used in bytes. */ - ttl: number; + storageUsedBytes: number; /** - * Record priority (commonly used for MX). + * Current active connections. */ - priority: number; + connectionsActive: number; /** - * Whether this record is locked (read-only). + * Maximum connections configured. */ - lock: boolean; + connectionsMax: number; /** - * Record weight (used for SRV records). + * Average read IOPS. */ - weight: number; + iopsRead: number; /** - * Target port (used for SRV records). + * Average write IOPS. */ - port: number; + iopsWrite: number; /** - * Comment for the DNS record. + * Queries per second. */ - comment: string; + qps: number; } /** - * Domain + * DedicatedDatabase */ - export type Domain = { + export type DedicatedDatabase = { /** - * Domain ID. + * Dedicated database ID. */ $id: string; /** - * Domain creation time in ISO 8601 format. + * Database creation time in ISO 8601 format. */ $createdAt: string; /** - * Domain update date in ISO 8601 format. + * Database update date in ISO 8601 format. */ $updatedAt: string; /** - * Domain name. + * Project ID that owns this database. */ - domain: string; + projectId: string; /** - * Domain registrar (e.g. "appwrite" or "third_party"). + * Database display name. */ - registrar: string; + name: string; /** - * Nameservers setting. "Appwrite" or empty string. + * Database type: shared (serverless) or dedicated (always-on). */ - nameservers: string; + type: string; /** - * Domain expiry date in ISO 8601 format. + * Product API that owns this database: compute, documentsdb, or vectorsdb. */ - expire: string; + api: string; /** - * Domain renewal date in ISO 8601 format. + * Region identifier (e.g., fra, nyc, syd). */ - renewal: string; + region: string; /** - * If set to true, the domain will automatically renew. + * Database engine: postgres, mysql, mariadb, or mongodb. */ - autoRenewal: boolean; + engine: string; /** - * Renewal price (in cents). + * Database engine version. */ - renewalPrice: number; + version: string; /** - * Transfer status for domains being transferred in. + * Specification identifier. */ - transferStatus: DomainTransferStatusEnum; + specification: string; /** - * Team ID. + * Database backend provider. Possible values: prisma, edge. */ - teamId: string; + backend: string; /** - * Dns records + * Database hostname for connections. */ - dnsRecords: DnsRecord[]; - } - - /** - * DomainPrice - */ - export type DomainPrice = { + hostname: string; /** - * Domain name. + * Database port for connections. */ - domain: string; + connectionPort: number; /** - * Top-level domain for the requested domain. + * Database username for connections. */ - tld: string; + connectionUser: string; /** - * Whether the domain is currently available for registration. + * Database password for connections. */ - available: boolean; + connectionPassword: string; /** - * Domain registration price. + * Full database connection string (URI format). */ - price: number; + connectionString: string; /** - * Price period in years. + * Database status. Possible values: provisioning, ready, inactive, paused, failed, deleted, restoring, scaling. */ - periodYears: number; + status: string; /** - * Whether the domain is a premium domain. + * Container status for shared databases: active or inactive. */ - premium: boolean; - } - - /** - * DomainPurchase - */ - export type DomainPurchase = { + containerStatus: string; /** - * Purchase/invoice ID. + * Last activity timestamp in ISO 8601 format. */ - $id: string; + lastAccessedAt: string; /** - * Purchase creation time in ISO 8601 format. + * Timestamp when container will be considered idle and scale to zero (ISO 8601 format). */ - $createdAt: string; + idleUntil: string; /** - * Purchase update date in ISO 8601 format. + * Minutes of inactivity before container scales to zero. */ - $updatedAt: string; + idleTimeoutMinutes: number; /** - * Domain document ID. + * CPU allocated in millicores. */ - domainId: string; + cpu: number; /** - * Domain name. + * Memory allocated in MB. */ - domain: string; + memory: number; /** - * Team ID that owns the domain. + * Storage allocated in GB. */ - organizationId: string; + storage: number; /** - * Domain purchase status. + * Storage class: ssd, nvme, or hdd. */ - status: DomainPurchaseStatus; + storageClass: string; /** - * Stripe client secret for 3DS; empty when not applicable. + * Maximum storage allowed in GB. 0 means use system default. */ - clientSecret: string; + storageMaxGb: number; /** - * Purchase amount. + * Kubernetes node pool where the database is scheduled. */ - amount: number; + nodePool: string; /** - * Currency code. + * Whether high availability is enabled. */ - currency: string; - } - - /** - * DomainSuggestion - */ - export type DomainSuggestion = { + highAvailability: boolean; /** - * Domain suggestion. + * Number of high availability replicas. */ - domain: string; + highAvailabilityReplicaCount: number; /** - * Is the domain premium? + * Replication sync mode: async, sync, or quorum. */ - premium: boolean; + highAvailabilitySyncMode: string; /** - * Domain price. + * Maximum concurrent connections. */ - price?: number; + networkMaxConnections: number; /** - * Is the domain available? + * Connection idle timeout in seconds. */ - available: boolean; - } - - /** - * domainTransferOut - */ - export type DomainTransferOut = { + networkIdleTimeoutSeconds: number; /** - * Domain transfer authorization code. + * IP addresses/CIDR ranges allowed to connect. */ - authCode: string; - } - - /** - * domainTransferStatus - */ - export type DomainTransferStatus = { + networkIPAllowlist: string[]; /** - * Transfer status. + * Whether automatic backups are enabled. */ - status: DomainTransferStatusEnum; + backupEnabled: boolean; /** - * Additional transfer status information. + * Whether point-in-time recovery is enabled. */ - reason: string; + backupPitr: boolean; /** - * Transfer status timestamp in ISO 8601 format. + * Backup schedule in cron format. */ - timestamp: string; - } - - /** - * Downgrade Feedback - */ - export type DowngradeFeedback = { + backupCron: string; /** - * Feedback ID. + * Number of days to retain backups. */ - $id: string; + backupRetentionDays: number; /** - * Feedback creation date in ISO 8601 format. + * Number of days to retain PITR data. */ - $createdAt: string; + pitrRetentionDays: number; /** - * Feedback update date in ISO 8601 format. + * Whether automatic storage expansion is enabled. */ - $updatedAt: string; + storageAutoscaling: boolean; /** - * Feedback reason + * Storage usage percentage that triggers automatic expansion. */ - title: string; + storageAutoscalingThresholdPercent: number; /** - * Feedback message + * Maximum storage size in GB for autoscaling. 0 means no limit. */ - message: string; + storageAutoscalingMaxGb: number; /** - * Plan ID downgrading from + * Day of the week for the maintenance window. Possible values: sun, mon, tue, wed, thu, fri, sat. */ - fromPlanId: string; + maintenanceWindowDay: string; /** - * Plan ID downgrading to + * Hour in UTC (0-23) when the maintenance window starts. */ - toPlanId: string; + maintenanceWindowHourUtc: number; /** - * Organization ID + * Whether metrics collection is enabled. */ - teamId: string; + metricsEnabled: boolean; /** - * User ID who submitted feedback + * Whether the SQL API sidecar is enabled for this database. */ - userId: string; + sqlApiEnabled: boolean; /** - * Console version + * Statement types accepted by the SQL API. Allowed values: SELECT, INSERT, UPDATE, DELETE. */ - version: string; + sqlApiAllowedStatements: string[]; + /** + * Maximum rows returned per SQL API execution. Results larger than this are truncated. + */ + sqlApiMaxRows: number; + /** + * Maximum serialised SQL API result payload in bytes. Results larger than this are truncated. + */ + sqlApiMaxBytes: number; + /** + * Maximum server-side SQL API execution time in seconds before the query is cancelled. + */ + sqlApiTimeoutSeconds: number; + /** + * Error message if status is failed. + */ + error: string; } /** - * Estimation + * Execution */ - export type Estimation = { + export type DedicatedDatabaseExecution = { /** - * Total amount + * Result rows as a list of column-name => value maps. Empty for non-returning statements. */ - amount: number; + rows: object; /** - * Gross payable amount + * Number of rows returned (for SELECT) or affected (for INSERT/UPDATE/DELETE). */ - grossAmount: number; + rowCount: number; /** - * Discount amount + * Column metadata in result-set order. */ - discount: number; + columns: DedicatedDatabaseExecutionColumn[]; /** - * Credits amount + * Server-side execution time in milliseconds. */ - credits: number; + durationMs: number; /** - * Estimation items + * True when the configured row or byte cap was hit and the result was truncated. */ - items: EstimationItem[]; + truncated: boolean; /** - * Estimation discount items + * Serialised payload size in bytes. */ - discounts: EstimationItem[]; - /** - * Trial days + bytes: number; + } + + /** + * ExecutionColumn + */ + export type DedicatedDatabaseExecutionColumn = { + /** + * Column name as returned by the database. + */ + name: string; + /** + * Engine-specific column type (e.g. int4, text, timestamptz). + */ + type: string; + } + + /** + * Restoration + */ + export type DedicatedDatabaseRestoration = { + /** + * Restoration ID. + */ + $id: string; + /** + * Restoration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database ID being restored. + */ + databaseId: string; + /** + * Project ID. + */ + projectId: string; + /** + * Backup ID used for restoration (null for PITR). + */ + backupId: string; + /** + * Restoration type. Possible values: backup (restore from a specific backup snapshot), pitr (point-in-time recovery to a specific timestamp). + */ + type: string; + /** + * Restoration status. Possible values: pending (queued for processing), running (currently in progress), completed (successfully finished), failed (encountered an error). + */ + status: string; + /** + * Target time for PITR restoration in ISO 8601 format. + */ + targetTime: string; + /** + * Restoration start time in ISO 8601 format. + */ + startedAt: string; + /** + * Restoration completion time in ISO 8601 format. + */ + completedAt: string; + /** + * Error message if restoration failed. + */ + error: string; + } + + /** + * Status + */ + export type DatabaseStatus = { + /** + * Overall health status: healthy, degraded, or unhealthy. + */ + health: string; + /** + * Whether the database is ready to accept connections. + */ + ready: boolean; + /** + * Database engine: postgres, mysql, mariadb, or mongodb. + */ + engine: string; + /** + * Database engine version. + */ + version: string; + /** + * Database uptime in seconds. + */ + uptime: number; + /** + * Connection statistics. + */ + connections: DatabaseStatusConnections; + /** + * List of database replicas and their status. + */ + replicas: DatabaseStatusReplica[]; + /** + * Storage volume information. + */ + volumes: DatabaseStatusVolume[]; + } + + /** + * DNSRecord + */ + export type DnsRecord = { + /** + * DNS Record ID. + */ + $id: string; + /** + * DNS Record creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * DNS Record update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * DNS record type (e.g. A, CNAME, MX). + */ + type: string; + /** + * Record name or subdomain. + */ + name: string; + /** + * Value of the record (IP address, domain, etc.). + */ + value: string; + /** + * Time to live (in seconds). + */ + ttl: number; + /** + * Record priority (commonly used for MX). + */ + priority: number; + /** + * Whether this record is locked (read-only). + */ + lock: boolean; + /** + * Record weight (used for SRV records). + */ + weight: number; + /** + * Target port (used for SRV records). + */ + port: number; + /** + * Comment for the DNS record. + */ + comment: string; + } + + /** + * Domain + */ + export type Domain = { + /** + * Domain ID. + */ + $id: string; + /** + * Domain creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Domain update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Domain name. + */ + domain: string; + /** + * Domain registrar (e.g. "appwrite" or "third_party"). + */ + registrar: string; + /** + * Nameservers setting. "Appwrite" or empty string. + */ + nameservers: string; + /** + * Domain expiry date in ISO 8601 format. + */ + expire: string; + /** + * Domain renewal date in ISO 8601 format. + */ + renewal: string; + /** + * If set to true, the domain will automatically renew. + */ + autoRenewal: boolean; + /** + * Renewal price (in cents). + */ + renewalPrice: number; + /** + * Transfer status for domains being transferred in. + */ + transferStatus: DomainTransferStatusEnum; + /** + * Team ID. + */ + teamId: string; + /** + * Dns records + */ + dnsRecords: DnsRecord[]; + } + + /** + * DomainPrice + */ + export type DomainPrice = { + /** + * Domain name. + */ + domain: string; + /** + * Top-level domain for the requested domain. + */ + tld: string; + /** + * Whether the domain is currently available for registration. + */ + available: boolean; + /** + * Domain registration price. + */ + price: number; + /** + * Price period in years. + */ + periodYears: number; + /** + * Whether the domain is a premium domain. + */ + premium: boolean; + } + + /** + * DomainPurchase + */ + export type DomainPurchase = { + /** + * Purchase/invoice ID. + */ + $id: string; + /** + * Purchase creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Purchase update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Domain document ID. + */ + domainId: string; + /** + * Domain name. + */ + domain: string; + /** + * Team ID that owns the domain. + */ + organizationId: string; + /** + * Domain purchase status. + */ + status: DomainPurchaseStatus; + /** + * Stripe client secret for 3DS; empty when not applicable. + */ + clientSecret: string; + /** + * Purchase amount. + */ + amount: number; + /** + * Currency code. + */ + currency: string; + } + + /** + * DomainSuggestion + */ + export type DomainSuggestion = { + /** + * Domain suggestion. + */ + domain: string; + /** + * Is the domain premium? + */ + premium: boolean; + /** + * Domain price. + */ + price?: number; + /** + * Is the domain available? + */ + available: boolean; + } + + /** + * domainTransferOut + */ + export type DomainTransferOut = { + /** + * Domain transfer authorization code. + */ + authCode: string; + } + + /** + * domainTransferStatus + */ + export type DomainTransferStatus = { + /** + * Transfer status. + */ + status: DomainTransferStatusEnum; + /** + * Additional transfer status information. + */ + reason: string; + /** + * Transfer status timestamp in ISO 8601 format. + */ + timestamp: string; + } + + /** + * Downgrade Feedback + */ + export type DowngradeFeedback = { + /** + * Feedback ID. + */ + $id: string; + /** + * Feedback creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Feedback update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Feedback reason + */ + title: string; + /** + * Feedback message + */ + message: string; + /** + * Plan ID downgrading from + */ + fromPlanId: string; + /** + * Plan ID downgrading to + */ + toPlanId: string; + /** + * Organization ID + */ + teamId: string; + /** + * User ID who submitted feedback + */ + userId: string; + /** + * Console version + */ + version: string; + } + + /** + * Estimation + */ + export type Estimation = { + /** + * Total amount + */ + amount: number; + /** + * Gross payable amount + */ + grossAmount: number; + /** + * Discount amount + */ + discount: number; + /** + * Credits amount + */ + credits: number; + /** + * Estimation items + */ + items: EstimationItem[]; + /** + * Estimation discount items + */ + discounts: EstimationItem[]; + /** + * Trial days */ trialDays: number; /** @@ -10403,6 +11293,64 @@ export namespace Models { organizationCredits: number; } + /** + * Extensions + */ + export type DedicatedDatabaseExtensions = { + /** + * List of installed extensions. + */ + installed: string[]; + /** + * List of available extensions that can be installed. + */ + available: string[]; + } + + /** + * HAReplica + */ + export type DedicatedDatabaseHAReplica = { + /** + * Replica identifier. + */ + $id: string; + /** + * Replica role. Possible values: primary (accepts reads and writes), replica (read-only follower). + */ + role: string; + /** + * Replica health status. Possible values: healthy (fully synced), degraded (lagging behind primary), unhealthy (replication broken or unreachable). + */ + status: string; + /** + * Replication lag in seconds. + */ + lagSeconds: number; + } + + /** + * HAStatus + */ + export type DedicatedDatabaseHAStatus = { + /** + * Whether high availability is enabled. + */ + enabled: boolean; + /** + * Number of configured replicas. + */ + replicaCount: number; + /** + * Replication sync mode. Possible values: async (asynchronous, fastest), sync (synchronous, strong consistency), quorum (quorum-based, majority of replicas must confirm). + */ + syncMode: string; + /** + * List of replica statuses. + */ + replicas: DedicatedDatabaseHAReplica[]; + } + /** * Invoice */ @@ -10738,25 +11686,113 @@ export namespace Models { */ country: string; /** - * State of the payment method + * State of the payment method + */ + state: string; + /** + * Last payment error associated with the payment method. + */ + lastError: string; + /** + * True when it's the default payment method. + */ + default: boolean; + /** + * True when payment method has expired. + */ + expired: boolean; + /** + * True when payment method has failed to process multiple times. + */ + failed: boolean; + } + + /** + * PerformanceInsights + */ + export type DedicatedDatabasePerformanceInsights = { + /** + * Top queries by total execution time. + */ + topQueries: DedicatedDatabasePerformanceInsightsQuery[]; + /** + * Active wait events. + */ + waitEvents: DedicatedDatabasePerformanceInsightsWaitEvent[]; + /** + * Total number of query calls. + */ + totalCalls: number; + /** + * Total query execution time in milliseconds. + */ + totalTimeMs: number; + /** + * Average query execution time in milliseconds. + */ + avgTimeMs: number; + } + + /** + * PerformanceInsightsQuery + */ + export type DedicatedDatabasePerformanceInsightsQuery = { + /** + * The SQL query text. + */ + query: string; + /** + * Number of times this query has been executed. + */ + calls: number; + /** + * Total execution time in milliseconds. + */ + totalTimeMs: number; + /** + * Mean execution time in milliseconds. + */ + meanTimeMs: number; + /** + * Total rows returned or affected. + */ + rows: number; + } + + /** + * PerformanceInsightsWaitEvent + */ + export type DedicatedDatabasePerformanceInsightsWaitEvent = { + /** + * Wait event name. + */ + event: string; + /** + * Wait event type or category. */ - state: string; + type: string; /** - * Last payment error associated with the payment method. + * Number of occurrences. */ - lastError: string; + count: number; /** - * True when it's the default payment method. + * Total wait time in milliseconds. */ - default: boolean; + totalWaitMs: number; + } + + /** + * PITRWindows + */ + export type DedicatedDatabasePITRWindows = { /** - * True when payment method has expired. + * Earliest available recovery point. */ - expired: boolean; + earliest: string; /** - * True when payment method has failed to process multiple times. + * Latest available recovery point. */ - failed: boolean; + latest: string; } /** @@ -10916,179 +11952,501 @@ export namespace Models { */ resourceId?: string; /** - * The resource type to backup. Set only if this policy should backup a single resource. + * 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; + } + + /** + * Policy Deny Aliased Email + */ + export type PolicyDenyAliasedEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny aliased email policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Deny Disposable Email + */ + export type PolicyDenyDisposableEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny disposable email policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Deny Free Email + */ + export type PolicyDenyFreeEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny free email policy is enabled. + */ + enabled: boolean; + } + + /** + * PoolerConfig + */ + export type DedicatedDatabasePooler = { + /** + * Whether connection pooling is enabled. + */ + enabled: boolean; + /** + * Connection pool mode. Possible values: transaction (releases connections back to pool after each transaction), session (holds connections for the entire client session). + */ + mode: string; + /** + * Maximum number of pooled connections. + */ + maxConnections: number; + /** + * Default pool size per user. + */ + defaultPoolSize: number; + /** + * Pooler listening port. + */ + port: number; + /** + * Whether SELECTs are routed to HA replicas while writes and locked reads stay on the primary. Active only when HA is enabled. + */ + readWriteSplitting: boolean; + /** + * Effective CPU request applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (5% of DB CPU, floor 100m) unless overridden. + */ + poolerCpuRequest: string; + /** + * Effective CPU limit applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (10% of DB CPU, floor 200m) unless overridden. + */ + poolerCpuLimit: string; + /** + * Effective memory request applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (7.5% of DB memory, floor 64Mi) unless overridden. + */ + poolerMemoryRequest: string; + /** + * Effective memory limit applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (15% of DB memory, floor 128Mi) unless overridden. + */ + poolerMemoryLimit: string; + } + + /** + * Program + */ + export type Program = { + /** + * Program ID + */ + $id: string; + /** + * Program title + */ + title: string; + /** + * Program description + */ + description: string; + /** + * Program tag for highlighting on console + */ + tag: string; + /** + * Program icon for highlighting on console + */ + icon: string; + /** + * URL for more information on this program + */ + url: string; + /** + * Whether this program is active + */ + active: boolean; + /** + * Whether this program is external + */ + external: boolean; + /** + * Billing plan ID that this is program is associated with. + */ + billingPlanId: string; + } + + /** + * QueryExplanation + */ + export type DedicatedDatabaseQueryExplanation = { + /** + * Structured query execution plan. Contents are engine-specific. + */ + plan: Record[]; + /** + * Raw EXPLAIN output from the database engine. + */ + raw: string; + } + + /** + * Region + */ + export type ConsoleRegion = { + /** + * Region ID + */ + $id: string; + /** + * Region name + */ + name: string; + /** + * Does the organization have access to this region. + */ + available: boolean; + /** + * Does the backend support this region. + */ + disabled: boolean; + /** + * Is this the region default. + */ + default: boolean; + /** + * Region flag code. + */ + flag: string; + } + + /** + * 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; + } + + /** + * Dedicated database restorations list + */ + export type DedicatedDatabaseRestorationList = { + /** + * Total number of restorations that matched your query. + */ + total: number; + /** + * List of restorations. + */ + restorations: DedicatedDatabaseRestoration[]; + } + + /** + * Review + */ + export type Review = { + /** + * Name of user + */ + name: string; + /** + * Reviewer image + */ + image: string; + /** + * Reviewer description + */ + description: string; + /** + * Review + */ + review: string; + } + + /** + * Roles + */ + export type Roles = { + /** + * Array of scopes accessible to current user. */ - resourceType?: string; + scopes: string[]; /** - * How many days to keep the backup before it will be automatically deleted. + * Array of roles assigned to current user. */ - retention: number; + roles: string[]; + } + + /** + * Schema + */ + export type DedicatedDatabaseSchema = { /** - * Policy backup schedule in CRON format. + * List of tables with columns, types, and constraints. */ - schedule: string; + tables: Record[]; /** - * Is this policy enabled. + * List of indexes across all tables. */ - enabled: boolean; + indexes: Record[]; } /** - * Program + * SchemaPreview */ - export type Program = { - /** - * Program ID - */ - $id: string; + export type DedicatedDatabaseSchemaPreview = { /** - * Program title + * Whether the engine supports transactional DDL for safe preview. */ - title: string; + supportsTransactionalDDL: boolean; /** - * Program description + * Schema change preview output. */ - description: string; + preview: string; /** - * Program tag for highlighting on console + * List of tables in the database after the change. */ - tag: string; + tables: string[]; + } + + /** + * SlowQuery + */ + export type DedicatedDatabaseSlowQuery = { /** - * Program icon for highlighting on console + * The SQL query text. */ - icon: string; + query: string; /** - * URL for more information on this program + * Query duration in milliseconds. */ - url: string; + durationMs: number; /** - * Whether this program is active + * Number of times this query has been executed. */ - active: boolean; + calls: number; /** - * Whether this program is external + * Database user that executed the query. */ - external: boolean; + user: string; /** - * Billing plan ID that this is program is associated with. + * Database name. */ - billingPlanId: string; + database: string; } /** - * Region + * Specification */ - export type ConsoleRegion = { + export type DedicatedDatabaseSpecification = { /** - * Region ID + * Specification slug. Use this value when creating a dedicated database. */ - $id: string; + slug: string; /** - * Region name + * Human readable specification name. */ name: string; /** - * Does the organization have access to this region. + * Monthly price of the specification in USD. */ - available: boolean; + price: number; /** - * Does the backend support this region. + * Allocated CPU in millicores. */ - disabled: boolean; + cpu: number; /** - * Is this the region default. + * Allocated memory in MB. */ - default: boolean; + memory: number; /** - * Region flag code. + * Maximum number of concurrent connections. */ - flag: string; + maxConnections: number; + /** + * Included storage in GB before overage charges apply. + */ + includedStorage: number; + /** + * Included bandwidth in GB before overage charges apply. + */ + includedBandwidth: number; + /** + * Whether the specification is available on the current plan. + */ + enabled: boolean; } /** - * Restoration + * SpecificationList */ - export type BackupRestoration = { + export type DedicatedDatabaseSpecificationList = { /** - * Restoration ID. + * List of dedicated database specifications. */ - $id: string; + specifications: DedicatedDatabaseSpecification[]; /** - * Restoration creation time in ISO 8601 format. + * Total number of specifications. */ - $createdAt: string; + total: number; /** - * Restoration update date in ISO 8601 format. + * Overage and add-on pricing shared across all specifications. */ - $updatedAt: string; + pricing: DedicatedDatabaseSpecificationPricing; + } + + /** + * SpecificationPricing + */ + export type DedicatedDatabaseSpecificationPricing = { /** - * Backup archive ID. + * Price per GB of storage above the included amount, per month, in USD. */ - archiveId: string; + storageOverageRate: number; /** - * Backup policy ID. + * Price per GB of bandwidth above the included amount, per month, in USD. */ - policyId: string; + bandwidthOverageRate: number; /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + * High availability replica price as a fraction of the specification cost. */ - status: string; + haReplicaRate: number; /** - * The backup start time. + * Cross-region replica price as a fraction of the specification cost. */ - startedAt: string; + crossRegionReplicaRate: number; /** - * Migration ID. + * Cross-region transfer price as a fraction of the specification cost. */ - migrationId: string; + crossRegionRate: number; /** - * The services that are backed up by this policy. + * Point-in-time recovery price as a fraction of the specification cost. */ - services: string[]; + pitrRate: number; + } + + /** + * Connections + */ + export type DatabaseStatusConnections = { /** - * The resources that are backed up by this policy. + * Current number of active connections. */ - resources: string[]; + current: number; /** - * Optional data in key-value object. + * Maximum allowed connections. */ - options: string; + max: number; } /** - * Review + * Replica */ - export type Review = { + export type DatabaseStatusReplica = { /** - * Name of user + * StatefulSet pod index (0 = primary, 1+ = replicas). */ - name: string; + index: number; /** - * Reviewer image + * Replica role: primary or replica. */ - image: string; + role: string; /** - * Reviewer description + * Whether the replica is healthy. */ - description: string; + healthy: boolean; /** - * Review + * Replication lag in seconds (null for primary). */ - review: string; + lagSeconds?: number; } /** - * Roles + * Volume */ - export type Roles = { + export type DatabaseStatusVolume = { /** - * Array of scopes accessible to current user. + * Mount path of the volume. */ - scopes: string[]; + path: string; /** - * Array of roles assigned to current user. + * Percentage of storage used. */ - roles: string[]; + usedPercent: string; + /** + * Available storage space. + */ + available: string; + /** + * Whether the volume is mounted. + */ + mounted: boolean; } /** @@ -11467,6 +12825,132 @@ export namespace Models { resourceId: string; } + /** + * App + */ + export type App = { + /** + * App ID. + */ + $id: string; + /** + * App creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * App update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application name. + */ + name: string; + /** + * List of authorized redirect URIs. These URIs can be used to redirect users after they authenticate. + */ + redirectUris: string[]; + /** + * When true, the application is restricted to the owner user (if `userId` is set) or members of `teamId` (if set). When false, any user in the project can authorize against the app. + */ + internal: boolean; + /** + * Whether the app is enabled or not. + */ + enabled: boolean; + /** + * OAuth2 client type. `public` for SPAs, mobile, and native apps that cannot keep a client secret (PKCE required); `confidential` for server-side clients that authenticate with a client secret. + */ + type: string; + /** + * ID of team that owns the application, if owned by team. Otherwise, user ID will be used. + */ + teamId: string; + /** + * ID of user who owns the application, if owned by user. Otherwise, team ID will be used. + */ + userId: string; + /** + * List of application secrets. + */ + secrets: AppSecret[]; + } + + /** + * AppSecret + */ + export type AppSecret = { + /** + * Secret ID. + */ + $id: string; + /** + * Secret creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Secret update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application ID this secret belongs to. + */ + appId: string; + /** + * Masked application client secret. Only the last 6 characters are returned. + */ + secret: string; + /** + * ID of the user who created the secret. + */ + createdById: string; + /** + * Name of the user who created the secret. + */ + createdByName: string; + /** + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + + /** + * AppSecretPlaintext + */ + export type AppSecretPlaintext = { + /** + * Secret ID. + */ + $id: string; + /** + * Secret creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Secret update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application ID this secret belongs to. + */ + appId: string; + /** + * Application client secret. Returned in full only when the secret is created; subsequent reads return a masked value. + */ + secret: string; + /** + * ID of the user who created the secret. + */ + createdById: string; + /** + * Name of the user who created the secret. + */ + createdByName: string; + /** + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + /** * Activity event list */ @@ -11607,6 +13091,48 @@ export namespace Models { blocks: Block[]; } + /** + * Dedicated database connections list + */ + export type DedicatedDatabaseConnectionList = { + /** + * Total number of connections that matched your query. + */ + total: number; + /** + * List of connections. + */ + connections: DedicatedDatabaseConnection[]; + } + + /** + * Dedicated database slow queries list + */ + export type DedicatedDatabaseSlowQueryList = { + /** + * Total number of slowQueries that matched your query. + */ + total: number; + /** + * List of slowQueries. + */ + slowQueries: DedicatedDatabaseSlowQuery[]; + } + + /** + * Dedicated databases list + */ + export type DedicatedDatabaseList = { + /** + * Total number of databases that matched your query. + */ + total: number; + /** + * List of databases. + */ + databases: DedicatedDatabase[]; + } + /** * DNS records list */ @@ -11718,4 +13244,32 @@ export namespace Models { */ gauges: UsageGauge[]; } + + /** + * Apps list + */ + export type AppsList = { + /** + * Total number of apps that matched your query. + */ + total: number; + /** + * List of apps. + */ + apps: App[]; + } + + /** + * App secrets list + */ + export type AppSecretList = { + /** + * Total number of secrets that matched your query. + */ + total: number; + /** + * List of secrets. + */ + secrets: AppSecret[]; + } } diff --git a/src/services/account.ts b/src/services/account.ts index b76a97c2..f78cb6c8 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -27,6 +27,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -109,6 +110,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -133,6 +135,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -185,6 +188,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -281,6 +285,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -333,6 +338,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -436,6 +442,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -488,6 +495,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -540,6 +548,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -609,6 +618,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -669,6 +679,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -720,6 +731,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -772,6 +784,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -823,6 +836,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -875,6 +889,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -947,6 +962,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -999,6 +1015,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1078,6 +1095,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1130,6 +1148,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1190,6 +1209,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1244,6 +1264,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1297,6 +1318,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1349,6 +1371,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1413,6 +1436,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1476,6 +1500,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1529,6 +1554,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1581,6 +1607,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1637,6 +1664,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1692,6 +1720,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1759,6 +1788,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1825,6 +1855,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1850,6 +1881,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1873,6 +1905,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1897,6 +1930,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1920,6 +1954,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1944,6 +1979,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1968,6 +2004,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1993,6 +2030,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2017,6 +2055,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2072,6 +2111,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2087,7 +2127,7 @@ export class Account { * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * * @param {string} params.password - New user password. Must be at least 8 chars. - * @param {string} params.oldPassword - Current user password. Must be at least 8 chars. + * @param {string} params.oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise>} */ @@ -2096,7 +2136,7 @@ export class Account { * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * * @param {string} password - New user password. Must be at least 8 chars. - * @param {string} oldPassword - Current user password. Must be at least 8 chars. + * @param {string} oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. @@ -2135,6 +2175,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2187,6 +2228,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2210,6 +2252,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2262,6 +2305,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2341,6 +2385,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2393,6 +2438,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2473,6 +2519,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2525,6 +2572,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2591,6 +2639,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2615,6 +2664,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2669,6 +2719,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2735,6 +2786,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2815,6 +2867,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2839,6 +2892,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2862,6 +2916,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2886,6 +2941,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2956,6 +3012,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3023,6 +3080,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3107,6 +3165,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -3179,6 +3238,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3245,6 +3305,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3297,6 +3358,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -3348,6 +3410,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3400,6 +3463,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3424,6 +3488,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3497,6 +3562,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3560,6 +3626,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3612,6 +3679,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3691,6 +3759,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3777,6 +3846,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3859,6 +3929,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -3934,6 +4005,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3995,6 +4067,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4057,6 +4130,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4123,6 +4197,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4190,6 +4265,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4214,6 +4290,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4280,6 +4357,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/activities.ts b/src/services/activities.ts index bf9a2b45..a8d30333 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -51,6 +51,7 @@ export class Activities { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -104,6 +105,7 @@ export class Activities { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/advisor.ts b/src/services/advisor.ts new file mode 100644 index 00000000..e8a7edca --- /dev/null +++ b/src/services/advisor.ts @@ -0,0 +1,314 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Advisor { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @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: appId, type, targetType, target, analyzedAt + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listReports(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @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: appId, type, targetType, target, analyzedAt + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listReports(queries?: string[], total?: boolean): Promise; + listReports( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/reports'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReport(params: { reportId: string }): Promise; + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReport(reportId: string): Promise; + getReport( + paramsOrFirst: { reportId: string } | string + ): Promise { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteReport(params: { reportId: string }): Promise<{}>; + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteReport(reportId: string): Promise<{}>; + deleteReport( + paramsOrFirst: { reportId: string } | string + ): Promise<{}> { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} params.reportId - Parent report ID. + * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise; + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} reportId - Parent report ID. + * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInsights(reportId: string, queries?: string[], total?: boolean): Promise; + listInsights( + paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { reportId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; + } else { + params = { + reportId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const reportId = params.reportId; + const queries = params.queries; + const total = params.total; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} params.reportId - Parent report ID. + * @param {string} params.insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getInsight(params: { reportId: string, insightId: string }): Promise; + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} reportId - Parent report ID. + * @param {string} insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInsight(reportId: string, insightId: string): Promise; + getInsight( + paramsOrFirst: { reportId: string, insightId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { reportId: string, insightId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; + } else { + params = { + reportId: paramsOrFirst as string, + insightId: rest[0] as string + }; + } + + const reportId = params.reportId; + const insightId = params.insightId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + if (typeof insightId === 'undefined') { + throw new AppwriteException('Missing required parameter: "insightId"'); + } + + const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/apps.ts b/src/services/apps.ts new file mode 100644 index 00000000..dcae06f3 --- /dev/null +++ b/src/services/apps.ts @@ -0,0 +1,732 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Apps { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List applications. + * + * @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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { queries?: string[], total?: boolean }): Promise; + /** + * List applications. + * + * @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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/apps'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new application. + * + * @param {string} params.appId - Application 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.name - Application name. + * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). + * @param {boolean} params.enabled - Is application enabled? + * @param {boolean} params.internal - When true, the application is restricted to the owner user or members of the configured team. Defaults to false (any user in the project can authorize). + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {string} params.teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, internal?: boolean, type?: string, teamId?: string }): Promise; + /** + * Create a new application. + * + * @param {string} appId - Application 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} name - Application name. + * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). + * @param {boolean} enabled - Is application enabled? + * @param {boolean} internal - When true, the application is restricted to the owner user or members of the configured team. Defaults to false (any user in the project can authorize). + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {string} teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(appId: string, name: string, redirectUris: string[], enabled?: boolean, internal?: boolean, type?: string, teamId?: string): Promise; + create( + paramsOrFirst: { appId: string, name: string, redirectUris: string[], enabled?: boolean, internal?: boolean, type?: string, teamId?: string } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, internal?: boolean, type?: string, teamId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, redirectUris: string[], enabled?: boolean, internal?: boolean, type?: string, teamId?: string }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + redirectUris: rest[1] as string[], + enabled: rest[2] as boolean, + internal: rest[3] as boolean, + type: rest[4] as string, + teamId: rest[5] as string + }; + } + + const appId = params.appId; + const name = params.name; + const redirectUris = params.redirectUris; + const enabled = params.enabled; + const internal = params.internal; + const type = params.type; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof redirectUris === 'undefined') { + throw new AppwriteException('Missing required parameter: "redirectUris"'); + } + + const apiPath = '/apps'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof internal !== 'undefined') { + payload['internal'] = internal; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { appId: string }): Promise; + /** + * Get an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(appId: string): Promise; + get( + paramsOrFirst: { appId: string } | string + ): Promise { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.name - Application name. + * @param {boolean} params.enabled - Is application enabled? + * @param {boolean} params.internal - When true, the application is restricted to the owner user or members of the configured team. Defaults to false (any user in the project can authorize). + * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { appId: string, name: string, enabled?: boolean, internal?: boolean, redirectUris?: string[], type?: string }): Promise; + /** + * Update an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} name - Application name. + * @param {boolean} enabled - Is application enabled? + * @param {boolean} internal - When true, the application is restricted to the owner user or members of the configured team. Defaults to false (any user in the project can authorize). + * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(appId: string, name: string, enabled?: boolean, internal?: boolean, redirectUris?: string[], type?: string): Promise; + update( + paramsOrFirst: { appId: string, name: string, enabled?: boolean, internal?: boolean, redirectUris?: string[], type?: string } | string, + ...rest: [(string)?, (boolean)?, (boolean)?, (string[])?, (string)?] + ): Promise { + let params: { appId: string, name: string, enabled?: boolean, internal?: boolean, redirectUris?: string[], type?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, enabled?: boolean, internal?: boolean, redirectUris?: string[], type?: string }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + internal: rest[2] as boolean, + redirectUris: rest[3] as string[], + type: rest[4] as string + }; + } + + const appId = params.appId; + const name = params.name; + const enabled = params.enabled; + const internal = params.internal; + const redirectUris = params.redirectUris; + const type = params.type; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof internal !== 'undefined') { + payload['internal'] = internal; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { appId: string }): Promise<{}>; + /** + * Delete an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(appId: string): Promise<{}>; + delete( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List client secrets for an application. + * + * @param {string} params.appId - Application unique ID. + * @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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listSecrets(params: { appId: string, queries?: string[], total?: boolean }): Promise; + /** + * List client secrets for an application. + * + * @param {string} appId - Application unique ID. + * @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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSecrets(appId: string, queries?: string[], total?: boolean): Promise; + listSecrets( + paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { appId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const appId = params.appId; + const queries = params.queries; + const total = params.total; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new client secret for an application. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + createSecret(params: { appId: string }): Promise; + /** + * Create a new client secret for an application. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSecret(appId: string): Promise; + createSecret( + paramsOrFirst: { appId: string } | string + ): Promise { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getSecret(params: { appId: string, secretId: string }): Promise; + /** + * Get an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSecret(appId: string, secretId: string): Promise; + getSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSecret(params: { appId: string, secretId: string }): Promise<{}>; + /** + * Delete an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSecret(appId: string, secretId: string): Promise<{}>; + deleteSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateTeam(params: { appId: string, teamId: string }): Promise; + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTeam(appId: string, teamId: string): Promise; + updateTeam( + paramsOrFirst: { appId: string, teamId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, teamId: string }; + } else { + params = { + appId: paramsOrFirst as string, + teamId: rest[0] as string + }; + } + + const appId = params.appId; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/apps/{appId}/team'.replace('{appId}', appId); + const payload: Payload = {}; + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTokens(params: { appId: string }): Promise<{}>; + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTokens(appId: string): Promise<{}>; + deleteTokens( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/tokens'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/assistant.ts b/src/services/assistant.ts index 56836a75..dc3b5725 100644 --- a/src/services/assistant.ts +++ b/src/services/assistant.ts @@ -54,6 +54,7 @@ export class Assistant { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 48d2215b..1acf6df2 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -84,6 +84,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -164,6 +165,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -223,6 +225,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -303,6 +306,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -381,6 +385,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -465,6 +470,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -544,6 +550,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -741,6 +748,7 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; diff --git a/src/services/backups.ts b/src/services/backups.ts index 99b1fabd..7df0eaec 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -52,6 +52,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -114,6 +115,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -166,6 +168,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -217,6 +220,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -269,6 +273,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -375,6 +380,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -427,6 +433,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -507,6 +514,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -559,6 +567,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -639,6 +648,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -691,6 +701,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -742,6 +753,7 @@ export class Backups { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/compute.ts b/src/services/compute.ts new file mode 100644 index 00000000..464f14fe --- /dev/null +++ b/src/services/compute.ts @@ -0,0 +1,3169 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Compute { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} params.queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabases(params?: { queries?: string[] }): Promise; + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabases(queries?: string[]): Promise; + listDatabases( + 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 = '/compute/databases'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} params.databaseId - Database 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.name - Database display name. Max length: 128 chars. + * @param {string} params.database - Physical database/catalog name. Defaults to databaseId. + * @param {string} params.engine - Database engine: postgres, mysql, mariadb, or mongodb. + * @param {string} params.version - Database engine version. Defaults to latest for selected engine. + * @param {string} params.region - Region identifier. Use one of the enabled region codes (e.g., fra, nyc, syd). + * @param {string} params.type - Database type: shared (serverless) or dedicated (always-on). + * @param {string} params.specification - Specification identifier. + * @param {string} params.backend - Database backend provider: prisma, or edge. + * @param {number} params.cpu - CPU in millicores (125-16000). + * @param {number} params.memory - Memory in MB to allocate (128-65536). + * @param {number} params.storage - Storage in GB to allocate (1-16384). + * @param {string} params.storageClass - Storage class: ssd, nvme, or hdd. + * @param {number} params.storageMaxGb - Maximum storage limit in GB. 0 uses system default. + * @param {boolean} params.highAvailability - Enable high availability. + * @param {number} params.highAvailabilityReplicaCount - Number of high availability replicas (0-5). + * @param {string} params.highAvailabilitySyncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkMaxConnections - Maximum concurrent connections. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} params.backupEnabled - Enable automatic backups. + * @param {boolean} params.backupPitr - Enable point-in-time recovery. + * @param {string} params.backupCron - Backup schedule in cron format. + * @param {number} params.backupRetentionDays - Number of days to retain backups. + * @param {number} params.pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {boolean} params.metricsEnabled - Enable metrics collection. + * @param {boolean} params.poolerEnabled - Enable connection pooler on provision. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabase(params: { databaseId: string, name: string, database?: string, engine?: string, version?: string, region?: string, type?: string, specification?: string, backend?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, storageMaxGb?: number, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, metricsEnabled?: boolean, poolerEnabled?: boolean }): Promise; + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} databaseId - Database 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} name - Database display name. Max length: 128 chars. + * @param {string} database - Physical database/catalog name. Defaults to databaseId. + * @param {string} engine - Database engine: postgres, mysql, mariadb, or mongodb. + * @param {string} version - Database engine version. Defaults to latest for selected engine. + * @param {string} region - Region identifier. Use one of the enabled region codes (e.g., fra, nyc, syd). + * @param {string} type - Database type: shared (serverless) or dedicated (always-on). + * @param {string} specification - Specification identifier. + * @param {string} backend - Database backend provider: prisma, or edge. + * @param {number} cpu - CPU in millicores (125-16000). + * @param {number} memory - Memory in MB to allocate (128-65536). + * @param {number} storage - Storage in GB to allocate (1-16384). + * @param {string} storageClass - Storage class: ssd, nvme, or hdd. + * @param {number} storageMaxGb - Maximum storage limit in GB. 0 uses system default. + * @param {boolean} highAvailability - Enable high availability. + * @param {number} highAvailabilityReplicaCount - Number of high availability replicas (0-5). + * @param {string} highAvailabilitySyncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkMaxConnections - Maximum concurrent connections. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} backupEnabled - Enable automatic backups. + * @param {boolean} backupPitr - Enable point-in-time recovery. + * @param {string} backupCron - Backup schedule in cron format. + * @param {number} backupRetentionDays - Number of days to retain backups. + * @param {number} pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {boolean} metricsEnabled - Enable metrics collection. + * @param {boolean} poolerEnabled - Enable connection pooler on provision. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabase(databaseId: string, name: string, database?: string, engine?: string, version?: string, region?: string, type?: string, specification?: string, backend?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, storageMaxGb?: number, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, metricsEnabled?: boolean, poolerEnabled?: boolean): Promise; + createDatabase( + paramsOrFirst: { databaseId: string, name: string, database?: string, engine?: string, version?: string, region?: string, type?: string, specification?: string, backend?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, storageMaxGb?: number, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, metricsEnabled?: boolean, poolerEnabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (string)?, (number)?, (boolean)?, (number)?, (string)?, (number)?, (number)?, (string[])?, (number)?, (boolean)?, (boolean)?, (string)?, (number)?, (number)?, (boolean)?, (number)?, (number)?, (boolean)?, (boolean)?] + ): Promise { + let params: { databaseId: string, name: string, database?: string, engine?: string, version?: string, region?: string, type?: string, specification?: string, backend?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, storageMaxGb?: number, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, metricsEnabled?: boolean, poolerEnabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string, database?: string, engine?: string, version?: string, region?: string, type?: string, specification?: string, backend?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, storageMaxGb?: number, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, metricsEnabled?: boolean, poolerEnabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + database: rest[1] as string, + engine: rest[2] as string, + version: rest[3] as string, + region: rest[4] as string, + type: rest[5] as string, + specification: rest[6] as string, + backend: rest[7] as string, + cpu: rest[8] as number, + memory: rest[9] as number, + storage: rest[10] as number, + storageClass: rest[11] as string, + storageMaxGb: rest[12] as number, + highAvailability: rest[13] as boolean, + highAvailabilityReplicaCount: rest[14] as number, + highAvailabilitySyncMode: rest[15] as string, + networkMaxConnections: rest[16] as number, + networkIdleTimeoutSeconds: rest[17] as number, + networkIPAllowlist: rest[18] as string[], + idleTimeoutMinutes: rest[19] as number, + backupEnabled: rest[20] as boolean, + backupPitr: rest[21] as boolean, + backupCron: rest[22] as string, + backupRetentionDays: rest[23] as number, + pitrRetentionDays: rest[24] as number, + storageAutoscaling: rest[25] as boolean, + storageAutoscalingThresholdPercent: rest[26] as number, + storageAutoscalingMaxGb: rest[27] as number, + metricsEnabled: rest[28] as boolean, + poolerEnabled: rest[29] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const database = params.database; + const engine = params.engine; + const version = params.version; + const region = params.region; + const type = params.type; + const specification = params.specification; + const backend = params.backend; + const cpu = params.cpu; + const memory = params.memory; + const storage = params.storage; + const storageClass = params.storageClass; + const storageMaxGb = params.storageMaxGb; + const highAvailability = params.highAvailability; + const highAvailabilityReplicaCount = params.highAvailabilityReplicaCount; + const highAvailabilitySyncMode = params.highAvailabilitySyncMode; + const networkMaxConnections = params.networkMaxConnections; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const backupEnabled = params.backupEnabled; + const backupPitr = params.backupPitr; + const backupCron = params.backupCron; + const backupRetentionDays = params.backupRetentionDays; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + const metricsEnabled = params.metricsEnabled; + const poolerEnabled = params.poolerEnabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/compute/databases'; + const payload: Payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof database !== 'undefined') { + payload['database'] = database; + } + if (typeof engine !== 'undefined') { + payload['engine'] = engine; + } + if (typeof version !== 'undefined') { + payload['version'] = version; + } + if (typeof region !== 'undefined') { + payload['region'] = region; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } + if (typeof backend !== 'undefined') { + payload['backend'] = backend; + } + if (typeof cpu !== 'undefined') { + payload['cpu'] = cpu; + } + if (typeof memory !== 'undefined') { + payload['memory'] = memory; + } + if (typeof storage !== 'undefined') { + payload['storage'] = storage; + } + if (typeof storageClass !== 'undefined') { + payload['storageClass'] = storageClass; + } + if (typeof storageMaxGb !== 'undefined') { + payload['storageMaxGb'] = storageMaxGb; + } + if (typeof highAvailability !== 'undefined') { + payload['highAvailability'] = highAvailability; + } + if (typeof highAvailabilityReplicaCount !== 'undefined') { + payload['highAvailabilityReplicaCount'] = highAvailabilityReplicaCount; + } + if (typeof highAvailabilitySyncMode !== 'undefined') { + payload['highAvailabilitySyncMode'] = highAvailabilitySyncMode; + } + if (typeof networkMaxConnections !== 'undefined') { + payload['networkMaxConnections'] = networkMaxConnections; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + payload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + payload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + payload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof backupEnabled !== 'undefined') { + payload['backupEnabled'] = backupEnabled; + } + if (typeof backupPitr !== 'undefined') { + payload['backupPitr'] = backupPitr; + } + if (typeof backupCron !== 'undefined') { + payload['backupCron'] = backupCron; + } + if (typeof backupRetentionDays !== 'undefined') { + payload['backupRetentionDays'] = backupRetentionDays; + } + if (typeof pitrRetentionDays !== 'undefined') { + payload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + payload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + payload['storageAutoscalingThresholdPercent'] = storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + payload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + if (typeof metricsEnabled !== 'undefined') { + payload['metricsEnabled'] = metricsEnabled; + } + if (typeof poolerEnabled !== 'undefined') { + payload['poolerEnabled'] = poolerEnabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseSpecifications(): Promise { + + const apiPath = '/compute/databases/specifications'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabase(params: { databaseId: string }): Promise; + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabase(databaseId: string): Promise; + getDatabase( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Resource changes (cpu, memory) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database display name. + * @param {string} params.status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume, or "inactive" to spin down a shared database. + * @param {string} params.specification - Specification. Changes cpu, memory, and type based on specification config. + * @param {number} params.cpu - CPU cores to allocate (125-16000). + * @param {number} params.memory - Memory in MB to allocate (128-65536). + * @param {number} params.storage - Storage in GB to allocate (1-16384). + * @param {string} params.storageClass - Storage class. Allowed values: ssd, nvme, hdd. + * @param {boolean} params.highAvailability - Enable high availability. + * @param {number} params.highAvailabilityReplicaCount - Number of high availability replicas (0-5). + * @param {string} params.highAvailabilitySyncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkMaxConnections - Maximum concurrent connections. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} params.backupEnabled - Enable automatic backups. + * @param {boolean} params.backupPitr - Enable point-in-time recovery. + * @param {string} params.backupCron - Backup schedule in cron format. + * @param {number} params.backupRetentionDays - Days to retain backups. + * @param {number} params.pitrRetentionDays - Days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {boolean} params.poolerEnabled - Attach or detach the connection pooler sidecar. Set to true to add the sidecar (no-op if already attached) or false to remove it. + * @param {boolean} params.metricsEnabled - Enable or disable the metrics-agent sidecar. + * @param {number} params.metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} params.metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} params.sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} params.sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE. + * @param {number} params.sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} params.sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} params.sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatabase(params: { databaseId: string, name?: string, status?: string, specification?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, poolerEnabled?: boolean, metricsEnabled?: boolean, metricsTraceSampleRate?: number, metricsSlowQueryLogThresholdMs?: number, sqlApiEnabled?: boolean, sqlApiAllowedStatements?: string[], sqlApiMaxRows?: number, sqlApiMaxBytes?: number, sqlApiTimeoutSeconds?: number }): Promise; + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Resource changes (cpu, memory) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database display name. + * @param {string} status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume, or "inactive" to spin down a shared database. + * @param {string} specification - Specification. Changes cpu, memory, and type based on specification config. + * @param {number} cpu - CPU cores to allocate (125-16000). + * @param {number} memory - Memory in MB to allocate (128-65536). + * @param {number} storage - Storage in GB to allocate (1-16384). + * @param {string} storageClass - Storage class. Allowed values: ssd, nvme, hdd. + * @param {boolean} highAvailability - Enable high availability. + * @param {number} highAvailabilityReplicaCount - Number of high availability replicas (0-5). + * @param {string} highAvailabilitySyncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkMaxConnections - Maximum concurrent connections. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} backupEnabled - Enable automatic backups. + * @param {boolean} backupPitr - Enable point-in-time recovery. + * @param {string} backupCron - Backup schedule in cron format. + * @param {number} backupRetentionDays - Days to retain backups. + * @param {number} pitrRetentionDays - Days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {boolean} poolerEnabled - Attach or detach the connection pooler sidecar. Set to true to add the sidecar (no-op if already attached) or false to remove it. + * @param {boolean} metricsEnabled - Enable or disable the metrics-agent sidecar. + * @param {number} metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE. + * @param {number} sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatabase(databaseId: string, name?: string, status?: string, specification?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, poolerEnabled?: boolean, metricsEnabled?: boolean, metricsTraceSampleRate?: number, metricsSlowQueryLogThresholdMs?: number, sqlApiEnabled?: boolean, sqlApiAllowedStatements?: string[], sqlApiMaxRows?: number, sqlApiMaxBytes?: number, sqlApiTimeoutSeconds?: number): Promise; + updateDatabase( + paramsOrFirst: { databaseId: string, name?: string, status?: string, specification?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, poolerEnabled?: boolean, metricsEnabled?: boolean, metricsTraceSampleRate?: number, metricsSlowQueryLogThresholdMs?: number, sqlApiEnabled?: boolean, sqlApiAllowedStatements?: string[], sqlApiMaxRows?: number, sqlApiMaxBytes?: number, sqlApiTimeoutSeconds?: number } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (string)?, (boolean)?, (number)?, (string)?, (number)?, (number)?, (string[])?, (number)?, (boolean)?, (boolean)?, (string)?, (number)?, (number)?, (boolean)?, (number)?, (number)?, (boolean)?, (boolean)?, (number)?, (number)?, (boolean)?, (string[])?, (number)?, (number)?, (number)?] + ): Promise { + let params: { databaseId: string, name?: string, status?: string, specification?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, poolerEnabled?: boolean, metricsEnabled?: boolean, metricsTraceSampleRate?: number, metricsSlowQueryLogThresholdMs?: number, sqlApiEnabled?: boolean, sqlApiAllowedStatements?: string[], sqlApiMaxRows?: number, sqlApiMaxBytes?: number, sqlApiTimeoutSeconds?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, status?: string, specification?: string, cpu?: number, memory?: number, storage?: number, storageClass?: string, highAvailability?: boolean, highAvailabilityReplicaCount?: number, highAvailabilitySyncMode?: string, networkMaxConnections?: number, networkIdleTimeoutSeconds?: number, networkIPAllowlist?: string[], idleTimeoutMinutes?: number, backupEnabled?: boolean, backupPitr?: boolean, backupCron?: string, backupRetentionDays?: number, pitrRetentionDays?: number, storageAutoscaling?: boolean, storageAutoscalingThresholdPercent?: number, storageAutoscalingMaxGb?: number, poolerEnabled?: boolean, metricsEnabled?: boolean, metricsTraceSampleRate?: number, metricsSlowQueryLogThresholdMs?: number, sqlApiEnabled?: boolean, sqlApiAllowedStatements?: string[], sqlApiMaxRows?: number, sqlApiMaxBytes?: number, sqlApiTimeoutSeconds?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + status: rest[1] as string, + specification: rest[2] as string, + cpu: rest[3] as number, + memory: rest[4] as number, + storage: rest[5] as number, + storageClass: rest[6] as string, + highAvailability: rest[7] as boolean, + highAvailabilityReplicaCount: rest[8] as number, + highAvailabilitySyncMode: rest[9] as string, + networkMaxConnections: rest[10] as number, + networkIdleTimeoutSeconds: rest[11] as number, + networkIPAllowlist: rest[12] as string[], + idleTimeoutMinutes: rest[13] as number, + backupEnabled: rest[14] as boolean, + backupPitr: rest[15] as boolean, + backupCron: rest[16] as string, + backupRetentionDays: rest[17] as number, + pitrRetentionDays: rest[18] as number, + storageAutoscaling: rest[19] as boolean, + storageAutoscalingThresholdPercent: rest[20] as number, + storageAutoscalingMaxGb: rest[21] as number, + poolerEnabled: rest[22] as boolean, + metricsEnabled: rest[23] as boolean, + metricsTraceSampleRate: rest[24] as number, + metricsSlowQueryLogThresholdMs: rest[25] as number, + sqlApiEnabled: rest[26] as boolean, + sqlApiAllowedStatements: rest[27] as string[], + sqlApiMaxRows: rest[28] as number, + sqlApiMaxBytes: rest[29] as number, + sqlApiTimeoutSeconds: rest[30] as number + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const status = params.status; + const specification = params.specification; + const cpu = params.cpu; + const memory = params.memory; + const storage = params.storage; + const storageClass = params.storageClass; + const highAvailability = params.highAvailability; + const highAvailabilityReplicaCount = params.highAvailabilityReplicaCount; + const highAvailabilitySyncMode = params.highAvailabilitySyncMode; + const networkMaxConnections = params.networkMaxConnections; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const backupEnabled = params.backupEnabled; + const backupPitr = params.backupPitr; + const backupCron = params.backupCron; + const backupRetentionDays = params.backupRetentionDays; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + const poolerEnabled = params.poolerEnabled; + const metricsEnabled = params.metricsEnabled; + const metricsTraceSampleRate = params.metricsTraceSampleRate; + const metricsSlowQueryLogThresholdMs = params.metricsSlowQueryLogThresholdMs; + const sqlApiEnabled = params.sqlApiEnabled; + const sqlApiAllowedStatements = params.sqlApiAllowedStatements; + const sqlApiMaxRows = params.sqlApiMaxRows; + const sqlApiMaxBytes = params.sqlApiMaxBytes; + const sqlApiTimeoutSeconds = params.sqlApiTimeoutSeconds; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } + if (typeof cpu !== 'undefined') { + payload['cpu'] = cpu; + } + if (typeof memory !== 'undefined') { + payload['memory'] = memory; + } + if (typeof storage !== 'undefined') { + payload['storage'] = storage; + } + if (typeof storageClass !== 'undefined') { + payload['storageClass'] = storageClass; + } + if (typeof highAvailability !== 'undefined') { + payload['highAvailability'] = highAvailability; + } + if (typeof highAvailabilityReplicaCount !== 'undefined') { + payload['highAvailabilityReplicaCount'] = highAvailabilityReplicaCount; + } + if (typeof highAvailabilitySyncMode !== 'undefined') { + payload['highAvailabilitySyncMode'] = highAvailabilitySyncMode; + } + if (typeof networkMaxConnections !== 'undefined') { + payload['networkMaxConnections'] = networkMaxConnections; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + payload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + payload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + payload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof backupEnabled !== 'undefined') { + payload['backupEnabled'] = backupEnabled; + } + if (typeof backupPitr !== 'undefined') { + payload['backupPitr'] = backupPitr; + } + if (typeof backupCron !== 'undefined') { + payload['backupCron'] = backupCron; + } + if (typeof backupRetentionDays !== 'undefined') { + payload['backupRetentionDays'] = backupRetentionDays; + } + if (typeof pitrRetentionDays !== 'undefined') { + payload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + payload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + payload['storageAutoscalingThresholdPercent'] = storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + payload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + if (typeof poolerEnabled !== 'undefined') { + payload['poolerEnabled'] = poolerEnabled; + } + if (typeof metricsEnabled !== 'undefined') { + payload['metricsEnabled'] = metricsEnabled; + } + if (typeof metricsTraceSampleRate !== 'undefined') { + payload['metricsTraceSampleRate'] = metricsTraceSampleRate; + } + if (typeof metricsSlowQueryLogThresholdMs !== 'undefined') { + payload['metricsSlowQueryLogThresholdMs'] = metricsSlowQueryLogThresholdMs; + } + if (typeof sqlApiEnabled !== 'undefined') { + payload['sqlApiEnabled'] = sqlApiEnabled; + } + if (typeof sqlApiAllowedStatements !== 'undefined') { + payload['sqlApiAllowedStatements'] = sqlApiAllowedStatements; + } + if (typeof sqlApiMaxRows !== 'undefined') { + payload['sqlApiMaxRows'] = sqlApiMaxRows; + } + if (typeof sqlApiMaxBytes !== 'undefined') { + payload['sqlApiMaxBytes'] = sqlApiMaxBytes; + } + if (typeof sqlApiTimeoutSeconds !== 'undefined') { + payload['sqlApiTimeoutSeconds'] = sqlApiTimeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDatabase(params: { databaseId: string }): Promise<{}>; + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDatabase(databaseId: string): Promise<{}>; + deleteDatabase( + paramsOrFirst: { databaseId: string } | string + ): Promise<{}> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @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: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseBackups(params: { databaseId: string, queries?: string[] }): Promise; + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @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: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseBackups(databaseId: string, queries?: string[]): Promise; + listDatabaseBackups( + paramsOrFirst: { databaseId: string, queries?: string[] } | string, + ...rest: [(string[])?] + ): Promise { + let params: { databaseId: string, queries?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[] + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseBackup(params: { databaseId: string, type?: string }): Promise; + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseBackup(databaseId: string, type?: string): Promise; + createDatabaseBackup( + paramsOrFirst: { databaseId: string, type?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, type?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, type?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const type = params.type; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseBackupPolicies(params: { databaseId: string, queries?: string[] }): Promise; + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseBackupPolicies(databaseId: string, queries?: string[]): Promise; + listDatabaseBackupPolicies( + paramsOrFirst: { databaseId: string, queries?: string[] } | string, + ...rest: [(string[])?] + ): Promise { + let params: { databaseId: string, queries?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[] + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups/policies'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database 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. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {string} params.type - Backup type: full or incremental. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseBackupPolicy(params: { databaseId: string, policyId: string, name: string, schedule: string, retention: number, type?: string, enabled?: boolean }): Promise; + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database 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. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {string} type - Backup type: full or incremental. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseBackupPolicy(databaseId: string, policyId: string, name: string, schedule: string, retention: number, type?: string, enabled?: boolean): Promise; + createDatabaseBackupPolicy( + paramsOrFirst: { databaseId: string, policyId: string, name: string, schedule: string, retention: number, type?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, policyId: string, name: string, schedule: string, retention: number, type?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, policyId: string, name: string, schedule: string, retention: number, type?: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + type: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const type = params.type; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException('Missing required parameter: "schedule"'); + } + if (typeof retention === 'undefined') { + throw new AppwriteException('Missing required parameter: "retention"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups/policies'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof policyId !== 'undefined') { + payload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} params.bucket - Storage bucket or container name. + * @param {string} params.accessKey - Access key or client ID for authentication. + * @param {string} params.secretKey - Secret key or service account JSON for authentication. + * @param {string} params.region - Storage region. + * @param {string} params.prefix - Object key prefix for backups. + * @param {string} params.endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatabaseBackupStorage(params: { databaseId: string, provider: string, bucket: string, accessKey: string, secretKey: string, region?: string, prefix?: string, endpoint?: string }): Promise; + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} databaseId - Database ID. + * @param {string} provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} bucket - Storage bucket or container name. + * @param {string} accessKey - Access key or client ID for authentication. + * @param {string} secretKey - Secret key or service account JSON for authentication. + * @param {string} region - Storage region. + * @param {string} prefix - Object key prefix for backups. + * @param {string} endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatabaseBackupStorage(databaseId: string, provider: string, bucket: string, accessKey: string, secretKey: string, region?: string, prefix?: string, endpoint?: string): Promise; + updateDatabaseBackupStorage( + paramsOrFirst: { databaseId: string, provider: string, bucket: string, accessKey: string, secretKey: string, region?: string, prefix?: string, endpoint?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, provider: string, bucket: string, accessKey: string, secretKey: string, region?: string, prefix?: string, endpoint?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, provider: string, bucket: string, accessKey: string, secretKey: string, region?: string, prefix?: string, endpoint?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + provider: rest[0] as string, + bucket: rest[1] as string, + accessKey: rest[2] as string, + secretKey: rest[3] as string, + region: rest[4] as string, + prefix: rest[5] as string, + endpoint: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const provider = params.provider; + const bucket = params.bucket; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const prefix = params.prefix; + const endpoint = params.endpoint; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); + } + if (typeof bucket === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucket"'); + } + if (typeof accessKey === 'undefined') { + throw new AppwriteException('Missing required parameter: "accessKey"'); + } + if (typeof secretKey === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretKey"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups/storage'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof provider !== 'undefined') { + payload['provider'] = provider; + } + if (typeof bucket !== 'undefined') { + payload['bucket'] = bucket; + } + if (typeof region !== 'undefined') { + payload['region'] = region; + } + if (typeof prefix !== 'undefined') { + payload['prefix'] = prefix; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof accessKey !== 'undefined') { + payload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseBackup(params: { databaseId: string, backupId: string }): Promise; + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseBackup(databaseId: string, backupId: string): Promise; + getDatabaseBackup( + paramsOrFirst: { databaseId: string, backupId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, backupId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, backupId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException('Missing required parameter: "backupId"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups/{backupId}'.replace('{databaseId}', databaseId).replace('{backupId}', backupId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDatabaseBackup(params: { databaseId: string, backupId: string }): Promise<{}>; + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDatabaseBackup(databaseId: string, backupId: string): Promise<{}>; + deleteDatabaseBackup( + paramsOrFirst: { databaseId: string, backupId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, backupId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, backupId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException('Missing required parameter: "backupId"'); + } + + const apiPath = '/compute/databases/{databaseId}/backups/{backupId}'.replace('{databaseId}', databaseId).replace('{backupId}', backupId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseBranches(params: { databaseId: string }): Promise; + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseBranches(databaseId: string): Promise; + listDatabaseBranches( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/branches'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch 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 {number} params.ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseBranch(params: { databaseId: string, branchId?: string, ttl?: number }): Promise; + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch 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 {number} ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseBranch(databaseId: string, branchId?: string, ttl?: number): Promise; + createDatabaseBranch( + paramsOrFirst: { databaseId: string, branchId?: string, ttl?: number } | string, + ...rest: [(string)?, (number)?] + ): Promise { + let params: { databaseId: string, branchId?: string, ttl?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, branchId?: string, ttl?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + ttl: rest[1] as number + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + const ttl = params.ttl; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/branches'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof branchId !== 'undefined') { + payload['branchId'] = branchId; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteDatabaseBranch(params: { databaseId: string, branchId: string }): Promise; + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDatabaseBranch(databaseId: string, branchId: string): Promise; + deleteDatabaseBranch( + paramsOrFirst: { databaseId: string, branchId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, branchId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, branchId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof branchId === 'undefined') { + throw new AppwriteException('Missing required parameter: "branchId"'); + } + + const apiPath = '/compute/databases/{databaseId}/branches/{branchId}'.replace('{databaseId}', databaseId).replace('{branchId}', branchId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List all database connection users/roles for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseConnections(params: { databaseId: string }): Promise; + /** + * List all database connection users/roles for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseConnections(databaseId: string): Promise; + listDatabaseConnections( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/connections'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new database connection user/role. Returns the connection details including the generated credentials. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.username - Connection username. + * @param {string} params.role - Connection role for the new user. Common values: readonly (read-only access), readwrite (full read and write access). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseConnection(params: { databaseId: string, username: string, role?: string }): Promise; + /** + * Create a new database connection user/role. Returns the connection details including the generated credentials. + * + * @param {string} databaseId - Database ID. + * @param {string} username - Connection username. + * @param {string} role - Connection role for the new user. Common values: readonly (read-only access), readwrite (full read and write access). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseConnection(databaseId: string, username: string, role?: string): Promise; + createDatabaseConnection( + paramsOrFirst: { databaseId: string, username: string, role?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { databaseId: string, username: string, role?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, username: string, role?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + username: rest[0] as string, + role: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const username = params.username; + const role = params.role; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof username === 'undefined') { + throw new AppwriteException('Missing required parameter: "username"'); + } + + const apiPath = '/compute/databases/{databaseId}/connections'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof role !== 'undefined') { + payload['role'] = role; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a database connection user/role. The connection will be terminated immediately. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.connectionId - Connection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDatabaseConnection(params: { databaseId: string, connectionId: string }): Promise<{}>; + /** + * Delete a database connection user/role. The connection will be terminated immediately. + * + * @param {string} databaseId - Database ID. + * @param {string} connectionId - Connection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDatabaseConnection(databaseId: string, connectionId: string): Promise<{}>; + deleteDatabaseConnection( + paramsOrFirst: { databaseId: string, connectionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, connectionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, connectionId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + connectionId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const connectionId = params.connectionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof connectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "connectionId"'); + } + + const apiPath = '/compute/databases/{databaseId}/connections/{connectionId}'.replace('{databaseId}', databaseId).replace('{connectionId}', connectionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get connection credentials for a dedicated database. Returns the hostname, port, username, password, database name, and full connection string. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseCredentials(params: { databaseId: string }): Promise; + /** + * Get connection credentials for a dedicated database. Returns the hostname, port, username, password, database name, and full connection string. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseCredentials(databaseId: string): Promise; + getDatabaseCredentials( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/credentials'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Rotate the primary credentials for a dedicated database. Generates a new password and updates the database. Previous credentials will stop working immediately. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatabaseCredentials(params: { databaseId: string }): Promise; + /** + * Rotate the primary credentials for a dedicated database. Generates a new password and updates the database. Previous credentials will stop working immediately. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatabaseCredentials(databaseId: string): Promise; + updateDatabaseCredentials( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/credentials'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/execute` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.sql - SQL statement to execute. Exactly one statement per request. + * @param {object} params.bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} params.timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseExecution(params: { databaseId: string, sql: string, bindings?: object, timeoutSeconds?: number }): Promise; + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/execute` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} databaseId - Database ID. + * @param {string} sql - SQL statement to execute. Exactly one statement per request. + * @param {object} bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseExecution(databaseId: string, sql: string, bindings?: object, timeoutSeconds?: number): Promise; + createDatabaseExecution( + paramsOrFirst: { databaseId: string, sql: string, bindings?: object, timeoutSeconds?: number } | string, + ...rest: [(string)?, (object)?, (number)?] + ): Promise { + let params: { databaseId: string, sql: string, bindings?: object, timeoutSeconds?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, sql: string, bindings?: object, timeoutSeconds?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + sql: rest[0] as string, + bindings: rest[1] as object, + timeoutSeconds: rest[2] as number + }; + } + + const databaseId = params.databaseId; + const sql = params.sql; + const bindings = params.bindings; + const timeoutSeconds = params.timeoutSeconds; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof sql === 'undefined') { + throw new AppwriteException('Missing required parameter: "sql"'); + } + + const apiPath = '/compute/databases/{databaseId}/execution'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof sql !== 'undefined') { + payload['sql'] = sql; + } + if (typeof bindings !== 'undefined') { + payload['bindings'] = bindings; + } + if (typeof timeoutSeconds !== 'undefined') { + payload['timeoutSeconds'] = timeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Run EXPLAIN on a query against a dedicated database. Available for SQL-compatible engines. Returns the query execution plan including scan types, estimated cost, and resource usage. Optionally run EXPLAIN ANALYZE to get actual execution statistics. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.query - Query to explain. Must be a valid query for the database engine. + * @param {boolean} params.analyze - Run EXPLAIN ANALYZE to get actual execution statistics. This executes the query. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseQueryExplanation(params: { databaseId: string, query: string, analyze?: boolean }): Promise; + /** + * Run EXPLAIN on a query against a dedicated database. Available for SQL-compatible engines. Returns the query execution plan including scan types, estimated cost, and resource usage. Optionally run EXPLAIN ANALYZE to get actual execution statistics. + * + * @param {string} databaseId - Database ID. + * @param {string} query - Query to explain. Must be a valid query for the database engine. + * @param {boolean} analyze - Run EXPLAIN ANALYZE to get actual execution statistics. This executes the query. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseQueryExplanation(databaseId: string, query: string, analyze?: boolean): Promise; + createDatabaseQueryExplanation( + paramsOrFirst: { databaseId: string, query: string, analyze?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, query: string, analyze?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, query: string, analyze?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + query: rest[0] as string, + analyze: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const query = params.query; + const analyze = params.analyze; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof query === 'undefined') { + throw new AppwriteException('Missing required parameter: "query"'); + } + + const apiPath = '/compute/databases/{databaseId}/explanation'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof query !== 'undefined') { + payload['query'] = query; + } + if (typeof analyze !== 'undefined') { + payload['analyze'] = analyze; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * List installed and available extensions for a PostgreSQL database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseExtensions(params: { databaseId: string }): Promise; + /** + * List installed and available extensions for a PostgreSQL database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseExtensions(databaseId: string): Promise; + listDatabaseExtensions( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/extensions'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Install a database extension. Only available for PostgreSQL databases. The install runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Extension name (e.g., pgvector, postgis, uuid-ossp). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseExtension(params: { databaseId: string, name: string }): Promise; + /** + * Install a database extension. Only available for PostgreSQL databases. The install runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Extension name (e.g., pgvector, postgis, uuid-ossp). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseExtension(databaseId: string, name: string): Promise; + createDatabaseExtension( + paramsOrFirst: { databaseId: string, name: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const name = params.name; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/compute/databases/{databaseId}/extensions'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Uninstall a database extension from a PostgreSQL database. The uninstall runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.extensionName - Extension name to uninstall. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteDatabaseExtension(params: { databaseId: string, extensionName: string }): Promise; + /** + * Uninstall a database extension from a PostgreSQL database. The uninstall runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} databaseId - Database ID. + * @param {string} extensionName - Extension name to uninstall. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDatabaseExtension(databaseId: string, extensionName: string): Promise; + deleteDatabaseExtension( + paramsOrFirst: { databaseId: string, extensionName: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, extensionName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, extensionName: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + extensionName: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const extensionName = params.extensionName; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof extensionName === 'undefined') { + throw new AppwriteException('Missing required parameter: "extensionName"'); + } + + const apiPath = '/compute/databases/{databaseId}/extensions/{extensionName}'.replace('{databaseId}', databaseId).replace('{extensionName}', extensionName); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseHAStatus(params: { databaseId: string }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseHAStatus(databaseId: string): Promise; + getDatabaseHAStatus( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/ha'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseFailover(params: { databaseId: string, targetReplicaId?: string }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseFailover(databaseId: string, targetReplicaId?: string): Promise; + createDatabaseFailover( + paramsOrFirst: { databaseId: string, targetReplicaId?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, targetReplicaId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, targetReplicaId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/ha/failovers'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + payload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get query-level performance insights for a dedicated database. Returns top queries by execution time, wait events, and aggregate query statistics. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.period - Analysis period for performance insights. Allowed values: 1h (last hour), 24h (last 24 hours), 7d (last 7 days). + * @param {number} params.limit - Maximum number of queries to return. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseInsights(params: { databaseId: string, period?: string, limit?: number }): Promise; + /** + * Get query-level performance insights for a dedicated database. Returns top queries by execution time, wait events, and aggregate query statistics. + * + * @param {string} databaseId - Database ID. + * @param {string} period - Analysis period for performance insights. Allowed values: 1h (last hour), 24h (last 24 hours), 7d (last 7 days). + * @param {number} limit - Maximum number of queries to return. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseInsights(databaseId: string, period?: string, limit?: number): Promise; + getDatabaseInsights( + paramsOrFirst: { databaseId: string, period?: string, limit?: number } | string, + ...rest: [(string)?, (number)?] + ): Promise { + let params: { databaseId: string, period?: string, limit?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, period?: string, limit?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + period: rest[0] as string, + limit: rest[1] as number + }; + } + + const databaseId = params.databaseId; + const period = params.period; + const limit = params.limit; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/insights'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof period !== 'undefined') { + payload['period'] = period; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} params.hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatabaseMaintenanceWindow(params: { databaseId: string, day: string, hourUtc: number }): Promise; + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} databaseId - Database ID. + * @param {string} day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatabaseMaintenanceWindow(databaseId: string, day: string, hourUtc: number): Promise; + updateDatabaseMaintenanceWindow( + paramsOrFirst: { databaseId: string, day: string, hourUtc: number } | string, + ...rest: [(string)?, (number)?] + ): Promise { + let params: { databaseId: string, day: string, hourUtc: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, day: string, hourUtc: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + day: rest[0] as string, + hourUtc: rest[1] as number + }; + } + + const databaseId = params.databaseId; + const day = params.day; + const hourUtc = params.hourUtc; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof day === 'undefined') { + throw new AppwriteException('Missing required parameter: "day"'); + } + if (typeof hourUtc === 'undefined') { + throw new AppwriteException('Missing required parameter: "hourUtc"'); + } + + const apiPath = '/compute/databases/{databaseId}/maintenance'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof day !== 'undefined') { + payload['day'] = day; + } + if (typeof hourUtc !== 'undefined') { + payload['hourUtc'] = hourUtc; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get detailed performance metrics for a dedicated database. Returns CPU, memory, storage, IOPS, QPS, and connection metrics. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.period - Metrics aggregation period. Allowed values: 1h (last hour), 24h (last 24 hours), 7d (last 7 days), 30d (last 30 days). + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseMetrics(params: { databaseId: string, period?: string }): Promise; + /** + * Get detailed performance metrics for a dedicated database. Returns CPU, memory, storage, IOPS, QPS, and connection metrics. + * + * @param {string} databaseId - Database ID. + * @param {string} period - Metrics aggregation period. Allowed values: 1h (last hour), 24h (last 24 hours), 7d (last 7 days), 30d (last 30 days). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseMetrics(databaseId: string, period?: string): Promise; + getDatabaseMetrics( + paramsOrFirst: { databaseId: string, period?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, period?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, period?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + period: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const period = params.period; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/metrics'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof period !== 'undefined') { + payload['period'] = period; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} params.specification - Target compute specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseMigration(params: { databaseId: string, targetType: string, specification?: string }): Promise; + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} specification - Target compute specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseMigration(databaseId: string, targetType: string, specification?: string): Promise; + createDatabaseMigration( + paramsOrFirst: { databaseId: string, targetType: string, specification?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { databaseId: string, targetType: string, specification?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, targetType: string, specification?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetType: rest[0] as string, + specification: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const targetType = params.targetType; + const specification = params.specification; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof targetType === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetType"'); + } + + const apiPath = '/compute/databases/{databaseId}/migrations'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof targetType !== 'undefined') { + payload['targetType'] = targetType; + } + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabasePITRWindows(params: { databaseId: string }): Promise; + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabasePITRWindows(databaseId: string): Promise; + getDatabasePITRWindows( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/pitr'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabasePooler(params: { databaseId: string }): Promise; + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabasePooler(databaseId: string): Promise; + getDatabasePooler( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/pooler'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} params.maxConnections - Maximum pooled connections. + * @param {number} params.defaultPoolSize - Default pool size per user. + * @param {boolean} params.readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} params.poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} params.poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} params.poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} params.poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDatabasePooler(params: { databaseId: string, mode?: string, maxConnections?: number, defaultPoolSize?: number, readWriteSplitting?: boolean, poolerCpuRequest?: string, poolerCpuLimit?: string, poolerMemoryRequest?: string, poolerMemoryLimit?: string }): Promise; + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} databaseId - Database ID. + * @param {string} mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} maxConnections - Maximum pooled connections. + * @param {number} defaultPoolSize - Default pool size per user. + * @param {boolean} readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatabasePooler(databaseId: string, mode?: string, maxConnections?: number, defaultPoolSize?: number, readWriteSplitting?: boolean, poolerCpuRequest?: string, poolerCpuLimit?: string, poolerMemoryRequest?: string, poolerMemoryLimit?: string): Promise; + updateDatabasePooler( + paramsOrFirst: { databaseId: string, mode?: string, maxConnections?: number, defaultPoolSize?: number, readWriteSplitting?: boolean, poolerCpuRequest?: string, poolerCpuLimit?: string, poolerMemoryRequest?: string, poolerMemoryLimit?: string } | string, + ...rest: [(string)?, (number)?, (number)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { databaseId: string, mode?: string, maxConnections?: number, defaultPoolSize?: number, readWriteSplitting?: boolean, poolerCpuRequest?: string, poolerCpuLimit?: string, poolerMemoryRequest?: string, poolerMemoryLimit?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, mode?: string, maxConnections?: number, defaultPoolSize?: number, readWriteSplitting?: boolean, poolerCpuRequest?: string, poolerCpuLimit?: string, poolerMemoryRequest?: string, poolerMemoryLimit?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + mode: rest[0] as string, + maxConnections: rest[1] as number, + defaultPoolSize: rest[2] as number, + readWriteSplitting: rest[3] as boolean, + poolerCpuRequest: rest[4] as string, + poolerCpuLimit: rest[5] as string, + poolerMemoryRequest: rest[6] as string, + poolerMemoryLimit: rest[7] as string + }; + } + + const databaseId = params.databaseId; + const mode = params.mode; + const maxConnections = params.maxConnections; + const defaultPoolSize = params.defaultPoolSize; + const readWriteSplitting = params.readWriteSplitting; + const poolerCpuRequest = params.poolerCpuRequest; + const poolerCpuLimit = params.poolerCpuLimit; + const poolerMemoryRequest = params.poolerMemoryRequest; + const poolerMemoryLimit = params.poolerMemoryLimit; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/pooler'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof mode !== 'undefined') { + payload['mode'] = mode; + } + if (typeof maxConnections !== 'undefined') { + payload['maxConnections'] = maxConnections; + } + if (typeof defaultPoolSize !== 'undefined') { + payload['defaultPoolSize'] = defaultPoolSize; + } + if (typeof readWriteSplitting !== 'undefined') { + payload['readWriteSplitting'] = readWriteSplitting; + } + if (typeof poolerCpuRequest !== 'undefined') { + payload['poolerCpuRequest'] = poolerCpuRequest; + } + if (typeof poolerCpuLimit !== 'undefined') { + payload['poolerCpuLimit'] = poolerCpuLimit; + } + if (typeof poolerMemoryRequest !== 'undefined') { + payload['poolerMemoryRequest'] = poolerMemoryRequest; + } + if (typeof poolerMemoryLimit !== 'undefined') { + payload['poolerMemoryLimit'] = poolerMemoryLimit; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by restoration status. + * @param {string} params.type - Filter by restoration type. + * @param {number} params.limit - Maximum number of restorations to return. + * @param {number} params.offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseRestorations(params: { databaseId: string, status?: string, type?: string, limit?: number, offset?: number }): Promise; + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by restoration status. + * @param {string} type - Filter by restoration type. + * @param {number} limit - Maximum number of restorations to return. + * @param {number} offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseRestorations(databaseId: string, status?: string, type?: string, limit?: number, offset?: number): Promise; + listDatabaseRestorations( + paramsOrFirst: { databaseId: string, status?: string, type?: string, limit?: number, offset?: number } | string, + ...rest: [(string)?, (string)?, (number)?, (number)?] + ): Promise { + let params: { databaseId: string, status?: string, type?: string, limit?: number, offset?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, status?: string, type?: string, limit?: number, offset?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + type: rest[1] as string, + limit: rest[2] as number, + offset: rest[3] as number + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const type = params.type; + const limit = params.limit; + const offset = params.offset; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/restorations'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} params.backupId - Backup ID to restore from (required for backup type). + * @param {number} params.targetTime - Target time for PITR as Unix timestamp (required for pitr type). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseRestoration(params: { databaseId: string, type?: string, backupId?: string, targetTime?: number }): Promise; + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} backupId - Backup ID to restore from (required for backup type). + * @param {number} targetTime - Target time for PITR as Unix timestamp (required for pitr type). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseRestoration(databaseId: string, type?: string, backupId?: string, targetTime?: number): Promise; + createDatabaseRestoration( + paramsOrFirst: { databaseId: string, type?: string, backupId?: string, targetTime?: number } | string, + ...rest: [(string)?, (string)?, (number)?] + ): Promise { + let params: { databaseId: string, type?: string, backupId?: string, targetTime?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, type?: string, backupId?: string, targetTime?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + backupId: rest[1] as string, + targetTime: rest[2] as number + }; + } + + const databaseId = params.databaseId; + const type = params.type; + const backupId = params.backupId; + const targetTime = params.targetTime; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/restorations'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof backupId !== 'undefined') { + payload['backupId'] = backupId; + } + if (typeof targetTime !== 'undefined') { + payload['targetTime'] = targetTime; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseRestoration(params: { databaseId: string, restorationId: string }): Promise; + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseRestoration(databaseId: string, restorationId: string): Promise; + getDatabaseRestoration( + paramsOrFirst: { databaseId: string, restorationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, restorationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, restorationId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + restorationId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const restorationId = params.restorationId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof restorationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "restorationId"'); + } + + const apiPath = '/compute/databases/{databaseId}/restorations/{restorationId}'.replace('{databaseId}', databaseId).replace('{restorationId}', restorationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the current schema for a dedicated database. Returns collections, fields, data types, constraints, and indexes. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseSchema(params: { databaseId: string }): Promise; + /** + * Get the current schema for a dedicated database. Returns collections, fields, data types, constraints, and indexes. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseSchema(databaseId: string): Promise; + getDatabaseSchema( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/schema'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Preview a schema change against a dedicated database. Returns the expected impact including affected collections, records, and a dry-run diff of the schema before and after the change. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.sql - Schema statement to preview. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseSchemaPreview(params: { databaseId: string, sql: string }): Promise; + /** + * Preview a schema change against a dedicated database. Returns the expected impact including affected collections, records, and a dry-run diff of the schema before and after the change. + * + * @param {string} databaseId - Database ID. + * @param {string} sql - Schema statement to preview. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseSchemaPreview(databaseId: string, sql: string): Promise; + createDatabaseSchemaPreview( + paramsOrFirst: { databaseId: string, sql: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, sql: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, sql: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + sql: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const sql = params.sql; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof sql === 'undefined') { + throw new AppwriteException('Missing required parameter: "sql"'); + } + + const apiPath = '/compute/databases/{databaseId}/schema/preview'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof sql !== 'undefined') { + payload['sql'] = sql; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * List slow queries for a dedicated database. Returns queries that exceeded the specified threshold. + * + * @param {string} params.databaseId - Database ID. + * @param {number} params.limit - Maximum number of queries to return. + * @param {number} params.thresholdMs - Minimum query duration in milliseconds. + * @throws {AppwriteException} + * @returns {Promise} + */ + listDatabaseQueries(params: { databaseId: string, limit?: number, thresholdMs?: number }): Promise; + /** + * List slow queries for a dedicated database. Returns queries that exceeded the specified threshold. + * + * @param {string} databaseId - Database ID. + * @param {number} limit - Maximum number of queries to return. + * @param {number} thresholdMs - Minimum query duration in milliseconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDatabaseQueries(databaseId: string, limit?: number, thresholdMs?: number): Promise; + listDatabaseQueries( + paramsOrFirst: { databaseId: string, limit?: number, thresholdMs?: number } | string, + ...rest: [(number)?, (number)?] + ): Promise { + let params: { databaseId: string, limit?: number, thresholdMs?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, limit?: number, thresholdMs?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + limit: rest[0] as number, + thresholdMs: rest[1] as number + }; + } + + const databaseId = params.databaseId; + const limit = params.limit; + const thresholdMs = params.thresholdMs; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/slow-queries'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof thresholdMs !== 'undefined') { + payload['thresholdMs'] = thresholdMs; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDatabaseStatus(databaseId: string): Promise; + getDatabaseStatus( + paramsOrFirst: { databaseId: string } | string + ): Promise { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/compute/databases/{databaseId}/status'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDatabaseUpgrade(params: { databaseId: string, targetVersion: string }): Promise; + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatabaseUpgrade(databaseId: string, targetVersion: string): Promise; + createDatabaseUpgrade( + paramsOrFirst: { databaseId: string, targetVersion: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, targetVersion: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, targetVersion: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetVersion: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const targetVersion = params.targetVersion; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof targetVersion === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetVersion"'); + } + + const apiPath = '/compute/databases/{databaseId}/upgrades'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof targetVersion !== 'undefined') { + payload['targetVersion'] = targetVersion; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/console.ts b/src/services/console.ts index 278fc464..816e7bfd 100644 --- a/src/services/console.ts +++ b/src/services/console.ts @@ -56,6 +56,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -107,6 +108,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -130,6 +132,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -181,6 +184,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -232,6 +236,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -283,6 +288,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -334,6 +340,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -358,6 +365,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -423,6 +431,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -446,6 +455,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -469,6 +479,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -549,6 +560,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -636,6 +648,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -715,6 +728,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -796,6 +810,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -855,6 +870,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -878,6 +894,7 @@ export class Console { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/databases.ts b/src/services/databases.ts index e21b9918..f1edf163 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -72,6 +72,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -147,6 +148,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -199,6 +201,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -250,6 +253,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -302,6 +306,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -368,6 +373,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -420,6 +426,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -480,6 +487,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -533,6 +541,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -585,6 +594,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -652,6 +662,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -705,6 +716,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -780,6 +792,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -888,6 +901,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -949,6 +963,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1044,6 +1059,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1105,6 +1121,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1180,6 +1197,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1290,6 +1308,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1401,6 +1420,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1498,6 +1518,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1593,6 +1614,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1688,6 +1710,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1783,6 +1806,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1880,6 +1904,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1977,6 +2002,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2084,6 +2110,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2191,6 +2218,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2302,6 +2330,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2413,6 +2442,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2524,6 +2554,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2635,6 +2666,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2732,6 +2764,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2829,6 +2862,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2917,6 +2951,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3009,6 +3044,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3112,6 +3148,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3208,6 +3245,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3311,6 +3349,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3407,6 +3446,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3495,6 +3535,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3587,6 +3628,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3675,6 +3717,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3767,6 +3810,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3878,6 +3922,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3962,6 +4007,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4076,6 +4122,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4180,6 +4227,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4283,6 +4331,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4379,6 +4428,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4476,6 +4526,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4573,6 +4624,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4686,6 +4738,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4789,6 +4842,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4857,6 +4911,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4924,6 +4979,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5013,6 +5069,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5107,6 +5164,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5185,6 +5243,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5265,6 +5324,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5347,6 +5407,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5422,6 +5483,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5504,6 +5566,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5592,6 +5655,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5681,6 +5745,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5756,6 +5821,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5831,6 +5897,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5926,6 +5993,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6022,6 +6090,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6097,6 +6166,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6203,6 +6273,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6271,6 +6342,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6338,6 +6410,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6406,6 +6479,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6473,6 +6547,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6533,6 +6608,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6593,6 +6669,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/documents-db.ts b/src/services/documents-db.ts index 052f9ee4..820987c4 100644 --- a/src/services/documents-db.ts +++ b/src/services/documents-db.ts @@ -62,6 +62,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -136,6 +137,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -188,6 +190,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -239,6 +242,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -291,6 +295,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -357,6 +362,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -409,6 +415,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -461,6 +468,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -512,6 +520,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -581,6 +590,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -633,6 +643,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -707,6 +718,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -814,6 +826,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -874,6 +887,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -971,6 +985,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1031,6 +1046,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1119,6 +1135,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1205,6 +1222,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1275,6 +1293,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1354,6 +1373,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1435,6 +1455,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1509,6 +1530,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1590,6 +1612,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1677,6 +1700,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1765,6 +1789,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1839,6 +1864,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1934,6 +1960,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2029,6 +2056,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2103,6 +2131,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2208,6 +2237,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2275,6 +2305,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2341,6 +2372,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2408,6 +2440,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2467,6 +2500,7 @@ export class DocumentsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/domains.ts b/src/services/domains.ts index be74c959..a2eb3f32 100644 --- a/src/services/domains.ts +++ b/src/services/domains.ts @@ -61,6 +61,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -126,6 +127,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -196,6 +198,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -349,6 +352,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -412,6 +416,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -503,6 +508,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -595,6 +601,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -658,6 +665,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -724,6 +732,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -776,6 +785,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -829,6 +839,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -892,6 +903,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -948,6 +960,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1000,6 +1013,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1053,6 +1067,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1105,6 +1120,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1158,6 +1174,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1210,6 +1227,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1263,6 +1281,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1315,6 +1334,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1368,6 +1388,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1420,6 +1441,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1473,6 +1495,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1525,6 +1548,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1578,6 +1602,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1640,6 +1665,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1731,6 +1757,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1832,6 +1859,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1924,6 +1952,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2025,6 +2054,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2119,6 +2149,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2224,6 +2255,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2316,6 +2348,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2417,6 +2450,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2515,6 +2549,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2612,6 +2647,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2704,6 +2740,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2805,6 +2842,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2911,6 +2949,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3018,6 +3057,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3110,6 +3150,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3213,6 +3254,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3337,6 +3379,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3490,6 +3533,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3581,6 +3625,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3684,6 +3729,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3752,6 +3798,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -3813,6 +3860,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3882,6 +3930,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3934,6 +3983,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -3987,6 +4037,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4051,6 +4102,7 @@ export class Domains { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/functions.ts b/src/services/functions.ts index 528372d9..d8c9d167 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -2,7 +2,7 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { FunctionRuntime } from '../enums/function-runtime'; +import { Runtime } from '../enums/runtime'; import { ProjectKeyScopes } from '../enums/project-key-scopes'; import { FunctionTemplateUseCase } from '../enums/function-template-use-case'; import { UsageRange } from '../enums/usage-range'; @@ -74,6 +74,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -89,7 +90,7 @@ export class Functions { * * @param {string} params.functionId - Function 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.name - Function name. Max length: 128 chars. - * @param {FunctionRuntime} params.runtime - Execution runtime. + * @param {Runtime} params.runtime - Execution runtime. * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. * @param {string} params.schedule - Schedule CRON syntax. @@ -112,13 +113,13 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { functionId: string, name: string, runtime: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * * @param {string} functionId - Function 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} name - Function name. Max length: 128 chars. - * @param {FunctionRuntime} runtime - Execution runtime. + * @param {Runtime} runtime - Execution runtime. * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. * @param {string[]} events - Events list. Maximum of 100 events are allowed. * @param {string} schedule - Schedule CRON syntax. @@ -142,20 +143,20 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(functionId: string, name: string, runtime: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; create( - paramsOrFirst: { functionId: string, name: string, runtime: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (FunctionRuntime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise { - let params: { functionId: string, name: string, runtime: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { functionId: paramsOrFirst as string, name: rest[0] as string, - runtime: rest[1] as FunctionRuntime, + runtime: rest[1] as Runtime, execute: rest[2] as string[], events: rest[3] as string[], schedule: rest[4] as string, @@ -282,6 +283,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -306,6 +308,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -329,6 +332,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -342,7 +346,7 @@ export class Functions { /** * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. * - * @param {FunctionRuntime[]} params.runtimes - List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. + * @param {Runtime[]} params.runtimes - List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. * @param {FunctionTemplateUseCase[]} params.useCases - List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed. * @param {number} params.limit - Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. * @param {number} params.offset - Offset the list of returned templates. Maximum offset is 5000. @@ -350,11 +354,11 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listTemplates(params?: { runtimes?: FunctionRuntime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }): Promise; + listTemplates(params?: { runtimes?: Runtime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }): Promise; /** * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. * - * @param {FunctionRuntime[]} runtimes - List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. + * @param {Runtime[]} runtimes - List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. * @param {FunctionTemplateUseCase[]} useCases - List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed. * @param {number} limit - Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. * @param {number} offset - Offset the list of returned templates. Maximum offset is 5000. @@ -363,18 +367,18 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTemplates(runtimes?: FunctionRuntime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean): Promise; + listTemplates(runtimes?: Runtime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean): Promise; listTemplates( - paramsOrFirst?: { runtimes?: FunctionRuntime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean } | FunctionRuntime[], + paramsOrFirst?: { runtimes?: Runtime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean } | Runtime[], ...rest: [(FunctionTemplateUseCase[])?, (number)?, (number)?, (boolean)?] ): Promise { - let params: { runtimes?: FunctionRuntime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }; + let params: { runtimes?: Runtime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('runtimes' in paramsOrFirst || 'useCases' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst || 'total' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { runtimes?: FunctionRuntime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }; + params = (paramsOrFirst || {}) as { runtimes?: Runtime[], useCases?: FunctionTemplateUseCase[], limit?: number, offset?: number, total?: boolean }; } else { params = { - runtimes: paramsOrFirst as FunctionRuntime[], + runtimes: paramsOrFirst as Runtime[], useCases: rest[0] as FunctionTemplateUseCase[], limit: rest[1] as number, offset: rest[2] as number, @@ -409,6 +413,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -460,6 +465,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -511,6 +517,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -562,6 +569,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -577,7 +585,7 @@ export class Functions { * * @param {string} params.functionId - Function ID. * @param {string} params.name - Function name. Max length: 128 chars. - * @param {FunctionRuntime} params.runtime - Execution runtime. + * @param {Runtime} params.runtime - Execution runtime. * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. * @param {string} params.schedule - Schedule CRON syntax. @@ -600,13 +608,13 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { functionId: string, name: string, runtime?: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; /** * Update function by its unique ID. * * @param {string} functionId - Function ID. * @param {string} name - Function name. Max length: 128 chars. - * @param {FunctionRuntime} runtime - Execution runtime. + * @param {Runtime} runtime - Execution runtime. * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. * @param {string[]} events - Events list. Maximum of 100 events are allowed. * @param {string} schedule - Schedule CRON syntax. @@ -630,20 +638,20 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(functionId: string, name: string, runtime?: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; update( - paramsOrFirst: { functionId: string, name: string, runtime?: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (FunctionRuntime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise { - let params: { functionId: string, name: string, runtime?: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: FunctionRuntime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { functionId: paramsOrFirst as string, name: rest[0] as string, - runtime: rest[1] as FunctionRuntime, + runtime: rest[1] as Runtime, execute: rest[2] as string[], events: rest[3] as string[], schedule: rest[4] as string, @@ -764,6 +772,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -816,6 +825,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -879,6 +889,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -953,6 +964,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1050,6 +1062,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', } @@ -1121,6 +1134,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1235,6 +1249,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1319,6 +1334,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1379,6 +1395,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1438,6 +1455,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1505,6 +1523,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -1565,6 +1584,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1632,6 +1652,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1726,6 +1747,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1786,6 +1808,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1845,6 +1868,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1905,6 +1929,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1971,6 +1996,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2060,6 +2086,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2120,6 +2147,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2200,6 +2228,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2260,6 +2289,7 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/graphql.ts b/src/services/graphql.ts index e995f66e..71f1fd5d 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -54,6 +54,7 @@ export class Graphql { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', } @@ -110,6 +111,7 @@ export class Graphql { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', } diff --git a/src/services/health.ts b/src/services/health.ts index 56ea5d3d..4ba85533 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -24,6 +24,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -47,6 +48,32 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Check the database that backs the audit and activity store. When the connection is reachable the endpoint returns a passing status with its response time. + * + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getAuditsDB(): Promise { + + const apiPath = '/health/audits-db'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -70,6 +97,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -121,6 +149,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -182,6 +211,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -205,6 +235,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -228,6 +259,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -281,6 +313,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -332,6 +365,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -383,6 +417,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -434,6 +469,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -485,6 +521,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -536,6 +573,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -595,6 +633,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -646,6 +685,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -707,6 +747,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -758,6 +799,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -809,6 +851,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -860,6 +903,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -911,6 +955,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -962,6 +1007,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1013,6 +1059,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1064,6 +1111,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1115,6 +1163,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1166,6 +1215,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1217,6 +1267,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1240,6 +1291,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1263,6 +1315,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1286,6 +1339,7 @@ export class Health { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/locale.ts b/src/services/locale.ts index fe85eeb5..813bd8d2 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -25,6 +25,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -48,6 +49,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -71,6 +73,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -94,6 +97,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -117,6 +121,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -140,6 +145,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -163,6 +169,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -186,6 +193,7 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 89c754fd..33ba3687 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -68,6 +68,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -206,6 +207,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -338,6 +340,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -520,6 +523,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -701,6 +705,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -803,6 +808,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -904,6 +910,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1002,6 +1009,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1099,6 +1107,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1153,6 +1162,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1204,6 +1214,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1271,6 +1282,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1337,6 +1349,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1403,6 +1416,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1511,6 +1525,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1619,6 +1634,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1722,6 +1738,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1824,6 +1841,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1905,6 +1923,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1985,6 +2004,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2060,6 +2080,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2134,6 +2155,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2256,6 +2278,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2372,6 +2395,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2466,6 +2490,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2554,6 +2579,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2662,6 +2688,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2764,6 +2791,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2872,6 +2900,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2974,6 +3003,247 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Amazon SES provider. + * + * @param {string} params.providerId - Provider 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.name - Provider name. + * @param {string} params.accessKey - AWS access key ID. + * @param {string} params.secretKey - AWS secret access key. + * @param {string} params.region - AWS region, for example us-east-1. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise} + */ + createSesProvider(params: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + /** + * Create a new Amazon SES provider. + * + * @param {string} providerId - Provider 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} name - Provider name. + * @param {string} accessKey - AWS access key ID. + * @param {string} secretKey - AWS secret access key. + * @param {string} region - AWS region, for example us-east-1. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSesProvider(providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise; + createSesProvider( + paramsOrFirst: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + accessKey: rest[1] as string, + secretKey: rest[2] as string, + region: rest[3] as string, + fromName: rest[4] as string, + fromEmail: rest[5] as string, + replyToName: rest[6] as string, + replyToEmail: rest[7] as string, + enabled: rest[8] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/ses'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof accessKey !== 'undefined') { + payload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof region !== 'undefined') { + payload['region'] = region; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an Amazon SES provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.accessKey - AWS access key ID. + * @param {string} params.secretKey - AWS secret access key. + * @param {string} params.region - AWS region, for example us-east-1. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateSesProvider(params: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + /** + * Update an Amazon SES provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} accessKey - AWS access key ID. + * @param {string} secretKey - AWS secret access key. + * @param {string} region - AWS region, for example us-east-1. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSesProvider(providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise; + updateSesProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + accessKey: rest[2] as string, + secretKey: rest[3] as string, + region: rest[4] as string, + fromName: rest[5] as string, + fromEmail: rest[6] as string, + replyToName: rest[7] as string, + replyToEmail: rest[8] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/ses/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof accessKey !== 'undefined') { + payload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof region !== 'undefined') { + payload['region'] = region; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3128,6 +3398,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3281,6 +3552,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3426,6 +3698,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3570,6 +3843,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3664,6 +3938,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3752,6 +4027,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3846,6 +4122,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3934,6 +4211,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4028,6 +4306,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4116,6 +4395,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4210,6 +4490,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4298,6 +4579,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4352,6 +4634,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4403,6 +4686,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4470,6 +4754,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4536,6 +4821,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4602,6 +4888,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4674,6 +4961,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4728,6 +5016,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4796,6 +5085,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4848,6 +5138,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4915,6 +5206,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4988,6 +5280,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5060,6 +5353,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5122,6 +5416,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5181,6 +5476,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/migrations.ts b/src/services/migrations.ts index 6d872766..4b448733 100644 --- a/src/services/migrations.ts +++ b/src/services/migrations.ts @@ -3,7 +3,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { AppwriteMigrationResource } from '../enums/appwrite-migration-resource'; -import { MigrationOnDuplicate } from '../enums/migration-on-duplicate'; +import { OnDuplicate } from '../enums/on-duplicate'; import { FirebaseMigrationResource } from '../enums/firebase-migration-resource'; import { NHostMigrationResource } from '../enums/n-host-migration-resource'; import { SupabaseMigrationResource } from '../enums/supabase-migration-resource'; @@ -71,6 +71,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -88,11 +89,11 @@ export class Migrations { * @param {string} params.endpoint - Source Appwrite endpoint * @param {string} params.projectId - Source Project ID * @param {string} params.apiKey - Source API Key - * @param {MigrationOnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: MigrationOnDuplicate }): Promise; + createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }): Promise; /** * Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. * @@ -100,27 +101,27 @@ export class Migrations { * @param {string} endpoint - Source Appwrite endpoint * @param {string} projectId - Source Project ID * @param {string} apiKey - Source API Key - * @param {MigrationOnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: MigrationOnDuplicate): Promise; + createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate): Promise; createAppwriteMigration( - paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: MigrationOnDuplicate } | AppwriteMigrationResource[], - ...rest: [(string)?, (string)?, (string)?, (MigrationOnDuplicate)?] + paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate } | AppwriteMigrationResource[], + ...rest: [(string)?, (string)?, (string)?, (OnDuplicate)?] ): Promise { - let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: MigrationOnDuplicate }; + let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectId' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'onDuplicate' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: MigrationOnDuplicate }; + params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }; } else { params = { resources: paramsOrFirst as AppwriteMigrationResource[], endpoint: rest[0] as string, projectId: rest[1] as string, apiKey: rest[2] as string, - onDuplicate: rest[3] as MigrationOnDuplicate + onDuplicate: rest[3] as OnDuplicate }; } @@ -163,6 +164,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -249,6 +251,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -363,6 +366,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -381,11 +385,11 @@ export class Migrations { * @param {string} params.fileId - File ID. * @param {string} params.resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} params.internalFile - Is the file stored in an internal bucket? - * @param {MigrationOnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createCSVImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }): Promise; + createCSVImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }): Promise; /** * Import documents from a CSV file into your Appwrite database. This endpoint allows you to import documents from a CSV file uploaded to Appwrite Storage bucket. * @@ -393,27 +397,27 @@ export class Migrations { * @param {string} fileId - File ID. * @param {string} resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} internalFile - Is the file stored in an internal bucket? - * @param {MigrationOnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createCSVImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate): Promise; + createCSVImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate): Promise; createCSVImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate } | string, - ...rest: [(string)?, (string)?, (boolean)?, (MigrationOnDuplicate)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, + ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, internalFile: rest[2] as boolean, - onDuplicate: rest[3] as MigrationOnDuplicate + onDuplicate: rest[3] as OnDuplicate }; } @@ -453,6 +457,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -519,6 +524,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -585,6 +591,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -673,6 +680,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -692,11 +700,11 @@ export class Migrations { * @param {string} params.fileId - File ID. * @param {string} params.resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} params.internalFile - Is the file stored in an internal bucket? - * @param {MigrationOnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createJSONImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }): Promise; + createJSONImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }): Promise; /** * Import documents from a JSON file into your Appwrite database. This endpoint allows you to import documents from a JSON file uploaded to Appwrite Storage bucket. * @@ -705,27 +713,27 @@ export class Migrations { * @param {string} fileId - File ID. * @param {string} resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} internalFile - Is the file stored in an internal bucket? - * @param {MigrationOnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createJSONImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate): Promise; + createJSONImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate): Promise; createJSONImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate } | string, - ...rest: [(string)?, (string)?, (boolean)?, (MigrationOnDuplicate)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, + ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: MigrationOnDuplicate }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, internalFile: rest[2] as boolean, - onDuplicate: rest[3] as MigrationOnDuplicate + onDuplicate: rest[3] as OnDuplicate }; } @@ -765,6 +773,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -888,6 +897,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1011,6 +1021,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1123,6 +1134,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1236,6 +1248,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1287,6 +1300,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1338,6 +1352,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1390,6 +1405,7 @@ export class Migrations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/organization.ts b/src/services/organization.ts index e3a26e37..34bc940c 100644 --- a/src/services/organization.ts +++ b/src/services/organization.ts @@ -61,6 +61,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -143,6 +144,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -195,6 +197,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -274,6 +277,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -326,6 +330,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -393,6 +398,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -465,6 +471,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -517,6 +524,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -579,6 +587,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -631,6 +640,7 @@ export class Organization { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/organizations.ts b/src/services/organizations.ts index 53b56ddb..ba24d89c 100644 --- a/src/services/organizations.ts +++ b/src/services/organizations.ts @@ -3,7 +3,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { Platform } from '../enums/platform'; -import { OrganizationAddon } from '../enums/organization-addon'; +import { Addon } from '../enums/addon'; export class Organizations { client: Client; @@ -61,6 +61,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -187,6 +188,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -271,6 +273,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -323,6 +326,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -377,6 +381,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -430,6 +435,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -492,6 +498,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -553,6 +560,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -615,6 +623,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -631,34 +640,34 @@ export class Organizations { * * * @param {string} params.organizationId - Organization ID - * @param {OrganizationAddon} params.addon - Addon key identifier (e.g. baa). + * @param {Addon} params.addon - Addon key identifier (e.g. baa). * @throws {AppwriteException} * @returns {Promise} */ - getAddonPrice(params: { organizationId: string, addon: OrganizationAddon }): Promise; + getAddonPrice(params: { organizationId: string, addon: Addon }): Promise; /** * Get the price details for a billing addon for an organization. * * * @param {string} organizationId - Organization ID - * @param {OrganizationAddon} addon - Addon key identifier (e.g. baa). + * @param {Addon} addon - Addon key identifier (e.g. baa). * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getAddonPrice(organizationId: string, addon: OrganizationAddon): Promise; + getAddonPrice(organizationId: string, addon: Addon): Promise; getAddonPrice( - paramsOrFirst: { organizationId: string, addon: OrganizationAddon } | string, - ...rest: [(OrganizationAddon)?] + paramsOrFirst: { organizationId: string, addon: Addon } | string, + ...rest: [(Addon)?] ): Promise { - let params: { organizationId: string, addon: OrganizationAddon }; + let params: { organizationId: string, addon: Addon }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { organizationId: string, addon: OrganizationAddon }; + params = (paramsOrFirst || {}) as { organizationId: string, addon: Addon }; } else { params = { organizationId: paramsOrFirst as string, - addon: rest[0] as OrganizationAddon + addon: rest[0] as Addon }; } @@ -677,6 +686,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -736,6 +746,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -809,6 +820,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -871,6 +883,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -923,6 +936,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -983,6 +997,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1045,6 +1060,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1115,6 +1131,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1177,6 +1194,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1239,6 +1257,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1291,6 +1310,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1350,6 +1370,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1401,6 +1422,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1478,6 +1500,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1573,6 +1596,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1633,6 +1657,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1692,6 +1717,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1751,6 +1777,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1820,6 +1847,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1880,6 +1908,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1940,6 +1969,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2002,6 +2032,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2054,6 +2085,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2119,6 +2151,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2171,6 +2204,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2231,6 +2265,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2282,6 +2317,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2386,6 +2422,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2438,6 +2475,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2517,6 +2555,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2569,6 +2608,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2628,6 +2668,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2690,6 +2731,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2757,6 +2799,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2816,6 +2859,7 @@ export class Organizations { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/presences.ts b/src/services/presences.ts index a04b036f..0b2c35a0 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -69,6 +69,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -122,6 +123,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -175,6 +177,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -260,6 +263,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -350,6 +354,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -404,6 +409,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/project.ts b/src/services/project.ts index 721ebf99..666e6cc7 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -34,6 +34,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -57,6 +58,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -120,6 +122,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -180,6 +183,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -266,6 +270,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -336,6 +341,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -388,6 +394,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -467,6 +474,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -519,6 +527,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -574,6 +583,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -634,6 +644,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -699,6 +710,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -751,6 +763,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -813,6 +826,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -865,6 +879,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -925,6 +940,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -935,6 +951,115 @@ export class Project { ); } + /** + * Update the OAuth2 server (OIDC provider) configuration. + * + * @param {boolean} params.enabled - Enable or disable the OAuth2 server. + * @param {string} params.authorizationUrl - URL to your application with consent screen. + * @param {string[]} params.scopes - List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {number} params.accessTokenDuration - Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. + * @param {number} params.refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. + * @param {number} params.publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. + * @param {number} params.publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + * @param {boolean} params.confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }): Promise; + /** + * Update the OAuth2 server (OIDC provider) configuration. + * + * @param {boolean} enabled - Enable or disable the OAuth2 server. + * @param {string} authorizationUrl - URL to your application with consent screen. + * @param {string[]} scopes - List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {number} accessTokenDuration - Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. + * @param {number} refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. + * @param {number} publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. + * @param {number} publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + * @param {boolean} confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean): Promise; + updateOAuth2Server( + paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean } | boolean, + ...rest: [(string)?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?] + ): Promise { + let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean, + authorizationUrl: rest[0] as string, + scopes: rest[1] as string[], + accessTokenDuration: rest[2] as number, + refreshTokenDuration: rest[3] as number, + publicAccessTokenDuration: rest[4] as number, + publicRefreshTokenDuration: rest[5] as number, + confidentialPkce: rest[6] as boolean + }; + } + + const enabled = params.enabled; + const authorizationUrl = params.authorizationUrl; + const scopes = params.scopes; + const accessTokenDuration = params.accessTokenDuration; + const refreshTokenDuration = params.refreshTokenDuration; + const publicAccessTokenDuration = params.publicAccessTokenDuration; + const publicRefreshTokenDuration = params.publicRefreshTokenDuration; + const confidentialPkce = params.confidentialPkce; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + if (typeof authorizationUrl === 'undefined') { + throw new AppwriteException('Missing required parameter: "authorizationUrl"'); + } + + const apiPath = '/project/oauth2-server'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof authorizationUrl !== 'undefined') { + payload['authorizationUrl'] = authorizationUrl; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof accessTokenDuration !== 'undefined') { + payload['accessTokenDuration'] = accessTokenDuration; + } + if (typeof refreshTokenDuration !== 'undefined') { + payload['refreshTokenDuration'] = refreshTokenDuration; + } + if (typeof publicAccessTokenDuration !== 'undefined') { + payload['publicAccessTokenDuration'] = publicAccessTokenDuration; + } + if (typeof publicRefreshTokenDuration !== 'undefined') { + payload['publicRefreshTokenDuration'] = publicRefreshTokenDuration; + } + if (typeof confidentialPkce !== 'undefined') { + payload['confidentialPkce'] = confidentialPkce; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + /** * Update the project OAuth2 Amazon configuration. * @@ -991,6 +1116,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1072,6 +1198,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1146,6 +1273,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1220,6 +1348,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1287,6 +1416,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1354,6 +1484,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1421,6 +1552,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1488,6 +1620,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1555,6 +1688,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1622,6 +1756,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1689,6 +1824,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1756,6 +1892,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1823,6 +1960,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1890,6 +2028,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1957,6 +2096,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2031,6 +2171,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2098,6 +2239,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2172,6 +2314,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2246,6 +2389,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2327,6 +2471,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2394,6 +2539,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2461,6 +2607,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2535,6 +2682,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2602,6 +2750,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2697,6 +2846,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2778,6 +2928,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2845,6 +2996,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2912,6 +3064,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2979,6 +3132,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3046,6 +3200,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3113,6 +3268,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3180,6 +3336,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3247,6 +3404,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3314,6 +3472,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3381,6 +3540,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3448,6 +3608,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3515,6 +3676,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3582,6 +3744,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3649,6 +3812,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3716,6 +3880,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3783,6 +3948,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3850,6 +4016,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3902,6 +4069,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -3961,6 +4129,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4036,6 +4205,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4109,6 +4279,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4185,6 +4356,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4258,6 +4430,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4334,6 +4507,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4407,6 +4581,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4483,6 +4658,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4556,6 +4732,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4632,6 +4809,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4705,6 +4883,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4757,6 +4936,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4808,6 +4988,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4868,6 +5049,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4922,6 +5104,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4977,6 +5160,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5032,6 +5216,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5113,6 +5298,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5168,6 +5354,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5227,6 +5414,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5282,6 +5470,89 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the password strength requirements for users in the project. + * + * @param {number} params.min - Minimum password length. Value must be between 8 and 256. Default is 8. + * @param {boolean} params.uppercase - Whether passwords must include at least one uppercase letter. + * @param {boolean} params.lowercase - Whether passwords must include at least one lowercase letter. + * @param {boolean} params.number - Whether passwords must include at least one number. + * @param {boolean} params.symbols - Whether passwords must include at least one symbol. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePasswordStrengthPolicy(params?: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }): Promise; + /** + * Update the password strength requirements for users in the project. + * + * @param {number} min - Minimum password length. Value must be between 8 and 256. Default is 8. + * @param {boolean} uppercase - Whether passwords must include at least one uppercase letter. + * @param {boolean} lowercase - Whether passwords must include at least one lowercase letter. + * @param {boolean} number - Whether passwords must include at least one number. + * @param {boolean} symbols - Whether passwords must include at least one symbol. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordStrengthPolicy(min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean): Promise; + updatePasswordStrengthPolicy( + paramsOrFirst?: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean } | number, + ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise { + let params: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }; + } else { + params = { + min: paramsOrFirst as number, + uppercase: rest[0] as boolean, + lowercase: rest[1] as boolean, + number: rest[2] as boolean, + symbols: rest[3] as boolean + }; + } + + const min = params.min; + const uppercase = params.uppercase; + const lowercase = params.lowercase; + const number = params.number; + const symbols = params.symbols; + + + const apiPath = '/project/policies/password-strength'; + const payload: Payload = {}; + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof uppercase !== 'undefined') { + payload['uppercase'] = uppercase; + } + if (typeof lowercase !== 'undefined') { + payload['lowercase'] = lowercase; + } + if (typeof number !== 'undefined') { + payload['number'] = number; + } + if (typeof symbols !== 'undefined') { + payload['symbols'] = symbols; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5337,6 +5608,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5392,6 +5664,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5447,6 +5720,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5502,6 +5776,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5557,6 +5832,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5571,23 +5847,23 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise; + getPolicy(params: { policyId: ProjectPolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicyId): Promise; + getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise { + ): Promise { let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { @@ -5609,6 +5885,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5671,6 +5948,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5734,6 +6012,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5850,6 +6129,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5905,6 +6185,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5965,6 +6246,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6069,6 +6351,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6129,6 +6412,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6201,6 +6485,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6260,6 +6545,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6342,6 +6628,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6394,6 +6681,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6467,6 +6755,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6519,6 +6808,7 @@ export class Project { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/projects.ts b/src/services/projects.ts index 3dfff9d9..c8e0a52c 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -3,7 +3,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { ScheduleResourceType } from '../enums/schedule-resource-type'; -import { ProjectStatus } from '../enums/project-status'; +import { Status } from '../enums/status'; export class Projects { client: Client; @@ -55,6 +55,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -115,6 +116,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -187,6 +189,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -247,6 +250,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -326,6 +330,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -386,6 +391,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -453,6 +459,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -549,6 +556,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -609,6 +617,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -624,34 +633,34 @@ export class Projects { * * * @param {string} params.projectId - Project ID - * @param {ProjectStatus} params.status - New status for the project + * @param {Status} params.status - New status for the project * @throws {AppwriteException} * @returns {Promise<{}>} */ - updateStatus(params: { projectId: string, status: ProjectStatus }): Promise<{}>; + updateStatus(params: { projectId: string, status: Status }): Promise<{}>; /** * Update the status of a project. Can be used to archive/restore projects, and to restore paused projects. When restoring a paused project, the console fingerprint header must be provided and the project must not be blocked for any reason other than inactivity. * * * @param {string} projectId - Project ID - * @param {ProjectStatus} status - New status for the project + * @param {Status} status - New status for the project * @throws {AppwriteException} * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStatus(projectId: string, status: ProjectStatus): Promise<{}>; + updateStatus(projectId: string, status: Status): Promise<{}>; updateStatus( - paramsOrFirst: { projectId: string, status: ProjectStatus } | string, - ...rest: [(ProjectStatus)?] + paramsOrFirst: { projectId: string, status: Status } | string, + ...rest: [(Status)?] ): Promise<{}> { - let params: { projectId: string, status: ProjectStatus }; + let params: { projectId: string, status: Status }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, status: ProjectStatus }; + params = (paramsOrFirst || {}) as { projectId: string, status: Status }; } else { params = { projectId: paramsOrFirst as string, - status: rest[0] as ProjectStatus + status: rest[0] as Status }; } @@ -673,6 +682,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -736,6 +746,7 @@ export class Projects { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 5cfbba5e..080c6605 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -2,7 +2,7 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { RedirectStatusCode } from '../enums/redirect-status-code'; +import { StatusCode } from '../enums/status-code'; import { ProxyResourceType } from '../enums/proxy-resource-type'; export class Proxy { @@ -61,6 +61,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -119,6 +120,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -196,6 +198,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -214,13 +217,13 @@ export class Proxy { * * @param {string} params.domain - Domain name. * @param {string} params.url - Target URL of redirection - * @param {RedirectStatusCode} params.statusCode - Status code of redirection + * @param {StatusCode} params.statusCode - Status code of redirection * @param {string} params.resourceId - ID of parent resource. * @param {ProxyResourceType} params.resourceType - Type of parent resource. * @throws {AppwriteException} * @returns {Promise} */ - createRedirectRule(params: { domain: string, url: string, statusCode: RedirectStatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise; + createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise; /** * Create a new proxy rule for to redirect from custom domain to another domain. * @@ -228,27 +231,27 @@ export class Proxy { * * @param {string} domain - Domain name. * @param {string} url - Target URL of redirection - * @param {RedirectStatusCode} statusCode - Status code of redirection + * @param {StatusCode} statusCode - Status code of redirection * @param {string} resourceId - ID of parent resource. * @param {ProxyResourceType} resourceType - Type of parent resource. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRedirectRule(domain: string, url: string, statusCode: RedirectStatusCode, resourceId: string, resourceType: ProxyResourceType): Promise; + createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise; createRedirectRule( - paramsOrFirst: { domain: string, url: string, statusCode: RedirectStatusCode, resourceId: string, resourceType: ProxyResourceType } | string, - ...rest: [(string)?, (RedirectStatusCode)?, (string)?, (ProxyResourceType)?] + paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, + ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] ): Promise { - let params: { domain: string, url: string, statusCode: RedirectStatusCode, resourceId: string, resourceType: ProxyResourceType }; + let params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: RedirectStatusCode, resourceId: string, resourceType: ProxyResourceType }; + params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; } else { params = { domain: paramsOrFirst as string, url: rest[0] as string, - statusCode: rest[1] as RedirectStatusCode, + statusCode: rest[1] as StatusCode, resourceId: rest[2] as string, resourceType: rest[3] as ProxyResourceType }; @@ -296,6 +299,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -373,6 +377,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -425,6 +430,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -476,6 +482,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -528,6 +535,7 @@ export class Proxy { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/sites.ts b/src/services/sites.ts index fb2853a1..f5af6ff5 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -2,9 +2,9 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { SiteFramework } from '../enums/site-framework'; -import { SiteBuildRuntime } from '../enums/site-build-runtime'; -import { SiteAdapter } from '../enums/site-adapter'; +import { Framework } from '../enums/framework'; +import { BuildRuntime } from '../enums/build-runtime'; +import { Adapter } from '../enums/adapter'; import { SiteTemplateUseCase } from '../enums/site-template-use-case'; import { UsageRange } from '../enums/usage-range'; import { TemplateReferenceType } from '../enums/template-reference-type'; @@ -74,6 +74,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -89,8 +90,8 @@ export class Sites { * * @param {string} params.siteId - Site 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.name - Site name. Max length: 128 chars. - * @param {SiteFramework} params.framework - Sites framework. - * @param {SiteBuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {Framework} params.framework - Sites framework. + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. * @param {number} params.timeout - Maximum request time in seconds. @@ -98,7 +99,7 @@ export class Sites { * @param {string} params.buildCommand - Build Command. * @param {string} params.startCommand - Custom start command. Leave empty to use default. * @param {string} params.outputDirectory - Output Directory for site. - * @param {SiteAdapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} params.fallbackFile - Fallback file for single page application sites. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. @@ -113,14 +114,14 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { siteId: string, name: string, framework: SiteFramework, buildRuntime: SiteBuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: SiteAdapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; /** * Create a new site. * * @param {string} siteId - Site 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} name - Site name. Max length: 128 chars. - * @param {SiteFramework} framework - Sites framework. - * @param {SiteBuildRuntime} buildRuntime - Runtime to use during build step. + * @param {Framework} framework - Sites framework. + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. * @param {number} timeout - Maximum request time in seconds. @@ -128,7 +129,7 @@ export class Sites { * @param {string} buildCommand - Build Command. * @param {string} startCommand - Custom start command. Leave empty to use default. * @param {string} outputDirectory - Output Directory for site. - * @param {SiteAdapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} fallbackFile - Fallback file for single page application sites. * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. @@ -144,21 +145,21 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(siteId: string, name: string, framework: SiteFramework, buildRuntime: SiteBuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: SiteAdapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; + create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; create( - paramsOrFirst: { siteId: string, name: string, framework: SiteFramework, buildRuntime: SiteBuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: SiteAdapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (SiteFramework)?, (SiteBuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (SiteAdapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise { - let params: { siteId: string, name: string, framework: SiteFramework, buildRuntime: SiteBuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: SiteAdapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: SiteFramework, buildRuntime: SiteBuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: SiteAdapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { siteId: paramsOrFirst as string, name: rest[0] as string, - framework: rest[1] as SiteFramework, - buildRuntime: rest[2] as SiteBuildRuntime, + framework: rest[1] as Framework, + buildRuntime: rest[2] as BuildRuntime, enabled: rest[3] as boolean, logging: rest[4] as boolean, timeout: rest[5] as number, @@ -166,7 +167,7 @@ export class Sites { buildCommand: rest[7] as string, startCommand: rest[8] as string, outputDirectory: rest[9] as string, - adapter: rest[10] as SiteAdapter, + adapter: rest[10] as Adapter, installationId: rest[11] as string, fallbackFile: rest[12] as string, providerRepositoryId: rest[13] as string, @@ -292,6 +293,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -316,6 +318,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -339,6 +342,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -352,18 +356,18 @@ export class Sites { /** * List available site templates. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method. * - * @param {SiteFramework[]} params.frameworks - List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed. + * @param {Framework[]} params.frameworks - List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed. * @param {SiteTemplateUseCase[]} params.useCases - List of use cases allowed for filtering site templates. Maximum of 100 use cases are allowed. * @param {number} params.limit - Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. * @param {number} params.offset - Offset the list of returned templates. Maximum offset is 5000. * @throws {AppwriteException} * @returns {Promise} */ - listTemplates(params?: { frameworks?: SiteFramework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }): Promise; + listTemplates(params?: { frameworks?: Framework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }): Promise; /** * List available site templates. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method. * - * @param {SiteFramework[]} frameworks - List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed. + * @param {Framework[]} frameworks - List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed. * @param {SiteTemplateUseCase[]} useCases - List of use cases allowed for filtering site templates. Maximum of 100 use cases are allowed. * @param {number} limit - Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. * @param {number} offset - Offset the list of returned templates. Maximum offset is 5000. @@ -371,18 +375,18 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTemplates(frameworks?: SiteFramework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number): Promise; + listTemplates(frameworks?: Framework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number): Promise; listTemplates( - paramsOrFirst?: { frameworks?: SiteFramework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number } | SiteFramework[], + paramsOrFirst?: { frameworks?: Framework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number } | Framework[], ...rest: [(SiteTemplateUseCase[])?, (number)?, (number)?] ): Promise { - let params: { frameworks?: SiteFramework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }; + let params: { frameworks?: Framework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('frameworks' in paramsOrFirst || 'useCases' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { frameworks?: SiteFramework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }; + params = (paramsOrFirst || {}) as { frameworks?: Framework[], useCases?: SiteTemplateUseCase[], limit?: number, offset?: number }; } else { params = { - frameworks: paramsOrFirst as SiteFramework[], + frameworks: paramsOrFirst as Framework[], useCases: rest[0] as SiteTemplateUseCase[], limit: rest[1] as number, offset: rest[2] as number @@ -412,6 +416,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -463,6 +468,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -514,6 +520,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -565,6 +572,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -580,7 +588,7 @@ export class Sites { * * @param {string} params.siteId - Site ID. * @param {string} params.name - Site name. Max length: 128 chars. - * @param {SiteFramework} params.framework - Sites framework. + * @param {Framework} params.framework - Sites framework. * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. * @param {number} params.timeout - Maximum request time in seconds. @@ -588,8 +596,8 @@ export class Sites { * @param {string} params.buildCommand - Build Command. * @param {string} params.startCommand - Custom start command. Leave empty to use default. * @param {string} params.outputDirectory - Output Directory for site. - * @param {SiteBuildRuntime} params.buildRuntime - Runtime to use during build step. - * @param {SiteAdapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr * @param {string} params.fallbackFile - Fallback file for single page application sites. * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. @@ -604,13 +612,13 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { siteId: string, name: string, framework: SiteFramework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: SiteBuildRuntime, adapter?: SiteAdapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; /** * Update site by its unique ID. * * @param {string} siteId - Site ID. * @param {string} name - Site name. Max length: 128 chars. - * @param {SiteFramework} framework - Sites framework. + * @param {Framework} framework - Sites framework. * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. * @param {number} timeout - Maximum request time in seconds. @@ -618,8 +626,8 @@ export class Sites { * @param {string} buildCommand - Build Command. * @param {string} startCommand - Custom start command. Leave empty to use default. * @param {string} outputDirectory - Output Directory for site. - * @param {SiteBuildRuntime} buildRuntime - Runtime to use during build step. - * @param {SiteAdapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr * @param {string} fallbackFile - Fallback file for single page application sites. * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. @@ -635,20 +643,20 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(siteId: string, name: string, framework: SiteFramework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: SiteBuildRuntime, adapter?: SiteAdapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; + update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; update( - paramsOrFirst: { siteId: string, name: string, framework: SiteFramework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: SiteBuildRuntime, adapter?: SiteAdapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (SiteFramework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (SiteBuildRuntime)?, (SiteAdapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise { - let params: { siteId: string, name: string, framework: SiteFramework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: SiteBuildRuntime, adapter?: SiteAdapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: SiteFramework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: SiteBuildRuntime, adapter?: SiteAdapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { siteId: paramsOrFirst as string, name: rest[0] as string, - framework: rest[1] as SiteFramework, + framework: rest[1] as Framework, enabled: rest[2] as boolean, logging: rest[3] as boolean, timeout: rest[4] as number, @@ -656,8 +664,8 @@ export class Sites { buildCommand: rest[6] as string, startCommand: rest[7] as string, outputDirectory: rest[8] as string, - buildRuntime: rest[9] as SiteBuildRuntime, - adapter: rest[10] as SiteAdapter, + buildRuntime: rest[9] as BuildRuntime, + adapter: rest[10] as Adapter, fallbackFile: rest[11] as string, installationId: rest[12] as string, providerRepositoryId: rest[13] as string, @@ -777,6 +785,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -829,6 +838,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -892,6 +902,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -966,6 +977,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1059,6 +1071,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', } @@ -1123,6 +1136,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1237,6 +1251,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1321,6 +1336,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1381,6 +1397,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1440,6 +1457,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1507,6 +1525,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -1567,6 +1586,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1634,6 +1654,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1693,6 +1714,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1752,6 +1774,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1812,6 +1835,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1878,6 +1902,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1967,6 +1992,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2027,6 +2053,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2107,6 +2134,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2167,6 +2195,7 @@ export class Sites { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/storage.ts b/src/services/storage.ts index 2b400321..58266754 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -70,6 +70,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -198,6 +199,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -250,6 +252,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -375,6 +378,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -427,6 +431,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -501,6 +506,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -597,6 +603,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', } @@ -658,6 +665,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -731,6 +739,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -791,6 +800,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -858,6 +868,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -1002,6 +1013,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -1069,6 +1081,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } payload['project'] = this.client.config.project; @@ -1123,6 +1136,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1184,6 +1198,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index d9a8364b..486b5da5 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -71,6 +71,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -145,6 +146,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -197,6 +199,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -248,6 +251,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -300,6 +304,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -366,6 +371,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -418,6 +424,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -478,6 +485,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -530,6 +538,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -581,6 +590,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -647,6 +657,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -699,6 +710,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -773,6 +785,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -880,6 +893,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -940,6 +954,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1034,6 +1049,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1094,6 +1110,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1168,6 +1185,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1277,6 +1295,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1387,6 +1406,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1483,6 +1503,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1577,6 +1598,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1671,6 +1693,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1765,6 +1788,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1861,6 +1885,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1957,6 +1982,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2061,6 +2087,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2167,6 +2194,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2277,6 +2305,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2387,6 +2416,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2497,6 +2527,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2607,6 +2638,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2703,6 +2735,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2799,6 +2832,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2886,6 +2920,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2977,6 +3012,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3080,6 +3116,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3176,6 +3213,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3279,6 +3317,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3375,6 +3414,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3462,6 +3502,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3553,6 +3594,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3640,6 +3682,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3731,6 +3774,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3841,6 +3885,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3955,6 +4000,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4059,6 +4105,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4162,6 +4209,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4258,6 +4306,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4354,6 +4403,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4450,6 +4500,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4563,6 +4614,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4666,6 +4718,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4733,6 +4786,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -4799,6 +4853,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4882,6 +4937,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -4956,6 +5012,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5061,6 +5118,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5128,6 +5186,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5194,6 +5253,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5261,6 +5321,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5348,6 +5409,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5441,6 +5503,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5518,6 +5581,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5597,6 +5661,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5678,6 +5743,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5752,6 +5818,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5833,6 +5900,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -5920,6 +5988,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6008,6 +6077,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6082,6 +6152,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6156,6 +6227,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6250,6 +6322,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6345,6 +6418,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6412,6 +6486,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -6471,6 +6546,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/teams.ts b/src/services/teams.ts index a03f899c..11e3b4db 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -66,6 +66,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -138,6 +139,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -190,6 +192,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -252,6 +255,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -304,6 +308,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -371,6 +376,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -444,6 +450,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -555,6 +562,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -615,6 +623,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -686,6 +695,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -746,6 +756,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -832,6 +843,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -884,6 +896,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -946,6 +959,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/tokens.ts b/src/services/tokens.ts index daffdae2..36cd10f7 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -73,6 +73,7 @@ export class Tokens { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -139,6 +140,7 @@ export class Tokens { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -191,6 +193,7 @@ export class Tokens { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -250,6 +253,7 @@ export class Tokens { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -302,6 +306,7 @@ export class Tokens { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/usage.ts b/src/services/usage.ts index b174a079..f503bf41 100644 --- a/src/services/usage.ts +++ b/src/services/usage.ts @@ -59,6 +59,7 @@ export class Usage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -118,6 +119,7 @@ export class Usage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/users.ts b/src/services/users.ts index 0d0555d2..b5621600 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -70,6 +70,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -153,6 +154,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -236,6 +238,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -319,6 +322,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -386,6 +390,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -437,6 +442,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -520,6 +526,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -603,6 +610,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -736,6 +744,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -849,6 +858,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -939,6 +949,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -993,6 +1004,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1044,6 +1056,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1095,6 +1108,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1158,6 +1172,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1223,6 +1238,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1290,6 +1306,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1357,6 +1374,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1424,6 +1442,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1497,6 +1516,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1560,6 +1580,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1623,6 +1644,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1684,6 +1706,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1744,6 +1767,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1797,6 +1821,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1848,6 +1873,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1900,6 +1926,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1951,6 +1978,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2003,6 +2031,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2055,6 +2084,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2108,6 +2138,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2160,6 +2191,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2223,6 +2255,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2286,6 +2319,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2349,6 +2383,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2401,6 +2436,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2463,6 +2499,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2523,6 +2560,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2578,6 +2616,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2630,6 +2669,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2690,6 +2730,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2753,6 +2794,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2820,6 +2862,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2916,6 +2959,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2976,6 +3020,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -3056,6 +3101,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3116,6 +3162,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3185,6 +3232,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3248,6 +3296,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -3311,6 +3360,7 @@ export class Users { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/vcs.ts b/src/services/vcs.ts index 22c23c5e..35d6b77c 100644 --- a/src/services/vcs.ts +++ b/src/services/vcs.ts @@ -80,6 +80,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -157,6 +158,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -229,6 +231,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -289,6 +292,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -364,6 +368,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -437,6 +442,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -506,6 +512,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -575,6 +582,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -626,6 +634,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -677,6 +686,7 @@ export class Vcs { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/vectors-db.ts b/src/services/vectors-db.ts index 300aec9c..e3fd854e 100644 --- a/src/services/vectors-db.ts +++ b/src/services/vectors-db.ts @@ -63,6 +63,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -137,6 +138,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -200,6 +202,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -252,6 +255,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -303,6 +307,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -355,6 +360,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -421,6 +427,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -473,6 +480,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -533,6 +541,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -585,6 +594,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -636,6 +646,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -705,6 +716,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -757,6 +769,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -831,6 +844,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -934,6 +948,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -994,6 +1009,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1091,6 +1107,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1151,6 +1168,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1239,6 +1257,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1325,6 +1344,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1395,6 +1415,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1474,6 +1495,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1555,6 +1577,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1629,6 +1652,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1710,6 +1734,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -1797,6 +1822,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1885,6 +1911,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1959,6 +1986,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2033,6 +2061,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2138,6 +2167,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2205,6 +2235,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2271,6 +2302,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2338,6 +2370,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -2397,6 +2430,7 @@ export class VectorsDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index ee3cd84f..25b186b9 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -59,6 +59,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -179,6 +180,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -231,6 +233,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, } return this.client.call( @@ -341,6 +344,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -393,6 +397,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -453,6 +458,7 @@ export class Webhooks { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', }