diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d729556..46410c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Change Log +## 9.0.0 + +* Breaking: Moved `keys`, `labels`, and `platforms` methods from `Projects` to `Project` service +* Breaking: Replaced generic `Platform` model and `PlatformType` enum with typed models: `PlatformWeb`, `PlatformApple`, `PlatformAndroid`, `PlatformWindows`, `PlatformLinux` +* Breaking: Replaced generic `createPlatform`/`updatePlatform` with platform-specific methods: `createAndroidPlatform`, `createApplePlatform`, `createLinuxPlatform`, `createWebPlatform`, `createWindowsPlatform` (and corresponding update variants). The `key` parameter was renamed to platform-specific terminology, such as `bundleIdentifier` or `packageName` +* Breaking: Removed `PlatformList` model from `Projects` service (now returned by `Project` service) +* Breaking: Removed `updateApiStatus`, `updateApiStatusAll`, `updateAPIStatus`, `updateAPIStatusAll` methods and `Api`, `ApiService` enums from `Projects` service +* Breaking: Renamed webhook parameters `security` to `tls`, `httpUser` to `authUsername`, `httpPass` to `authPassword`, `signatureKey` to `secret` +* Breaking: Renamed `updateSignature` to `updateSecret` in `Webhooks` service +* Added `updateCanonicalEmails`, `updateDisposableEmails`, `updateFreeEmails` methods to `Project` service +* Added `updateProtocolStatus`, `updateServiceStatus` methods to `Project` service with new `ProtocolId` and `ServiceId` enums +* Added `purge` parameter to `databases.updateCollection` and `tablesDb.updateTable` +* Added `x` (Twitter/X) to `OAuthProvider` enum +* Added `keys.read`, `keys.write`, `platforms.read`, `platforms.write` to `Scopes` enum +* Added `userType` field to audit log model +* Added service and protocol status fields to `Project` model +* Added `supportsDisposableEmailValidation`, `supportsCanonicalEmailValidation`, `supportsFreeEmailValidation` fields to plan model +* Updated `ttl` parameter description for `databases.listDocuments` and `tablesDb.listRows` with detailed caching behaviour + ## 8.3.0 * Added addon management methods to Organizations service: `listAddons`, `createBaaAddon`, `getAddon`, `deleteAddon`, `confirmAddonPayment`, `getAddonPrice` diff --git a/README.md b/README.md index e9fabc62..76926fb5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Console SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.1-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) @@ -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/databases/update-collection.md b/docs/examples/databases/update-collection.md index a630f751..f39c0ded 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -13,7 +13,8 @@ const result = await databases.updateCollection({ name: '', // optional permissions: [Permission.read(Role.any())], // optional documentSecurity: false, // optional - enabled: false // optional + enabled: false, // optional + purge: false // optional }); console.log(result); diff --git a/docs/examples/organizations/create-key.md b/docs/examples/organizations/create-key.md index 6880a839..a21479a7 100644 --- a/docs/examples/organizations/create-key.md +++ b/docs/examples/organizations/create-key.md @@ -10,7 +10,7 @@ const organizations = new Organizations(client); const result = await organizations.createKey({ organizationId: '', name: '', - scopes: [Scopes.PlatformsRead], + scopes: [Scopes.ProjectsRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); diff --git a/docs/examples/organizations/update-key.md b/docs/examples/organizations/update-key.md index d997a182..f8e731cd 100644 --- a/docs/examples/organizations/update-key.md +++ b/docs/examples/organizations/update-key.md @@ -11,7 +11,7 @@ const result = await organizations.updateKey({ organizationId: '', keyId: '', name: '', - scopes: [Scopes.PlatformsRead], + scopes: [Scopes.ProjectsRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md new file mode 100644 index 00000000..7a553d5d --- /dev/null +++ b/docs/examples/project/create-android-platform.md @@ -0,0 +1,17 @@ +```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.createAndroidPlatform({ + platformId: '', + name: '', + applicationId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md new file mode 100644 index 00000000..313f7705 --- /dev/null +++ b/docs/examples/project/create-apple-platform.md @@ -0,0 +1,17 @@ +```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.createApplePlatform({ + platformId: '', + name: '', + bundleIdentifier: '' +}); + +console.log(result); +``` diff --git a/docs/examples/projects/create-key.md b/docs/examples/project/create-key.md similarity index 60% rename from docs/examples/projects/create-key.md rename to docs/examples/project/create-key.md index eab34819..1e4ba017 100644 --- a/docs/examples/projects/create-key.md +++ b/docs/examples/project/create-key.md @@ -1,17 +1,16 @@ ```javascript -import { Client, Projects, Scopes } from "@appwrite.io/console"; +import { Client, Project, Scopes } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const projects = new Projects(client); +const project = new Project(client); -const result = await projects.createKey({ - projectId: '', +const result = await project.createKey({ + keyId: '', name: '', scopes: [Scopes.SessionsWrite], - keyId: '', // optional expire: '2020-10-15T06:38:00.000+00:00' // optional }); diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md new file mode 100644 index 00000000..f7c54062 --- /dev/null +++ b/docs/examples/project/create-linux-platform.md @@ -0,0 +1,17 @@ +```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.createLinuxPlatform({ + platformId: '', + name: '', + packageName: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md new file mode 100644 index 00000000..1349d26d --- /dev/null +++ b/docs/examples/project/create-web-platform.md @@ -0,0 +1,17 @@ +```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.createWebPlatform({ + platformId: '', + name: '', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md new file mode 100644 index 00000000..a099d910 --- /dev/null +++ b/docs/examples/project/create-windows-platform.md @@ -0,0 +1,17 @@ +```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.createWindowsPlatform({ + platformId: '', + name: '', + packageIdentifierName: '' +}); + +console.log(result); +``` diff --git a/docs/examples/projects/delete-key.md b/docs/examples/project/delete-key.md similarity index 57% rename from docs/examples/projects/delete-key.md rename to docs/examples/project/delete-key.md index c844ad05..b97331d0 100644 --- a/docs/examples/projects/delete-key.md +++ b/docs/examples/project/delete-key.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.deleteKey({ - projectId: '', +const result = await project.deleteKey({ keyId: '' }); diff --git a/docs/examples/projects/delete-platform.md b/docs/examples/project/delete-platform.md similarity index 58% rename from docs/examples/projects/delete-platform.md rename to docs/examples/project/delete-platform.md index b5026663..54092d78 100644 --- a/docs/examples/projects/delete-platform.md +++ b/docs/examples/project/delete-platform.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.deletePlatform({ - projectId: '', +const result = await project.deletePlatform({ platformId: '' }); diff --git a/docs/examples/projects/get-key.md b/docs/examples/project/get-key.md similarity index 58% rename from docs/examples/projects/get-key.md rename to docs/examples/project/get-key.md index 7acbcbac..f2454e21 100644 --- a/docs/examples/projects/get-key.md +++ b/docs/examples/project/get-key.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.getKey({ - projectId: '', +const result = await project.getKey({ keyId: '' }); diff --git a/docs/examples/projects/get-platform.md b/docs/examples/project/get-platform.md similarity index 58% rename from docs/examples/projects/get-platform.md rename to docs/examples/project/get-platform.md index 43de17d8..1ae14878 100644 --- a/docs/examples/projects/get-platform.md +++ b/docs/examples/project/get-platform.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.getPlatform({ - projectId: '', +const result = await project.getPlatform({ platformId: '' }); diff --git a/docs/examples/projects/list-keys.md b/docs/examples/project/list-keys.md similarity index 61% rename from docs/examples/projects/list-keys.md rename to docs/examples/project/list-keys.md index 32bfbc3e..c91def36 100644 --- a/docs/examples/projects/list-keys.md +++ b/docs/examples/project/list-keys.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.listKeys({ - projectId: '', +const result = await project.listKeys({ queries: [], // optional total: false // optional }); diff --git a/docs/examples/projects/list-platforms.md b/docs/examples/project/list-platforms.md similarity index 58% rename from docs/examples/projects/list-platforms.md rename to docs/examples/project/list-platforms.md index 5d7e7bf0..fe3bb74c 100644 --- a/docs/examples/projects/list-platforms.md +++ b/docs/examples/project/list-platforms.md @@ -1,14 +1,14 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.listPlatforms({ - projectId: '', +const result = await project.listPlatforms({ + queries: [], // optional total: false // optional }); diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md new file mode 100644 index 00000000..7842a6d6 --- /dev/null +++ b/docs/examples/project/update-android-platform.md @@ -0,0 +1,17 @@ +```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.updateAndroidPlatform({ + platformId: '', + name: '', + applicationId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md new file mode 100644 index 00000000..3788edfc --- /dev/null +++ b/docs/examples/project/update-apple-platform.md @@ -0,0 +1,17 @@ +```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.updateApplePlatform({ + platformId: '', + name: '', + bundleIdentifier: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-canonical-emails.md b/docs/examples/project/update-canonical-emails.md new file mode 100644 index 00000000..62f040f4 --- /dev/null +++ b/docs/examples/project/update-canonical-emails.md @@ -0,0 +1,15 @@ +```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.updateCanonicalEmails({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-disposable-emails.md b/docs/examples/project/update-disposable-emails.md new file mode 100644 index 00000000..8d8d9eda --- /dev/null +++ b/docs/examples/project/update-disposable-emails.md @@ -0,0 +1,15 @@ +```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.updateDisposableEmails({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-free-emails.md b/docs/examples/project/update-free-emails.md new file mode 100644 index 00000000..5059ad50 --- /dev/null +++ b/docs/examples/project/update-free-emails.md @@ -0,0 +1,15 @@ +```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.updateFreeEmails({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/projects/update-key.md b/docs/examples/project/update-key.md similarity index 66% rename from docs/examples/projects/update-key.md rename to docs/examples/project/update-key.md index 86e4755b..59aae489 100644 --- a/docs/examples/projects/update-key.md +++ b/docs/examples/project/update-key.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects, Scopes } from "@appwrite.io/console"; +import { Client, Project, Scopes } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const projects = new Projects(client); +const project = new Project(client); -const result = await projects.updateKey({ - projectId: '', +const result = await project.updateKey({ keyId: '', name: '', scopes: [Scopes.SessionsWrite], diff --git a/docs/examples/projects/update-labels.md b/docs/examples/project/update-labels.md similarity index 56% rename from docs/examples/projects/update-labels.md rename to docs/examples/project/update-labels.md index f1ba8ee6..acf873ad 100644 --- a/docs/examples/projects/update-labels.md +++ b/docs/examples/project/update-labels.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +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 projects = new Projects(client); +const project = new Project(client); -const result = await projects.updateLabels({ - projectId: '', +const result = await project.updateLabels({ labels: [] }); diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md new file mode 100644 index 00000000..9e1d680c --- /dev/null +++ b/docs/examples/project/update-linux-platform.md @@ -0,0 +1,17 @@ +```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.updateLinuxPlatform({ + platformId: '', + name: '', + packageName: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-protocol-status.md b/docs/examples/project/update-protocol-status.md new file mode 100644 index 00000000..0ea32e3e --- /dev/null +++ b/docs/examples/project/update-protocol-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProtocolId } 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.updateProtocolStatus({ + protocolId: ProtocolId.Rest, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-service-status.md b/docs/examples/project/update-service-status.md new file mode 100644 index 00000000..4d16defd --- /dev/null +++ b/docs/examples/project/update-service-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ServiceId } 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.updateServiceStatus({ + serviceId: ServiceId.Account, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md new file mode 100644 index 00000000..13ece6e7 --- /dev/null +++ b/docs/examples/project/update-web-platform.md @@ -0,0 +1,17 @@ +```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.updateWebPlatform({ + platformId: '', + name: '', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md new file mode 100644 index 00000000..c49a4284 --- /dev/null +++ b/docs/examples/project/update-windows-platform.md @@ -0,0 +1,17 @@ +```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.updateWindowsPlatform({ + platformId: '', + name: '', + packageIdentifierName: '' +}); + +console.log(result); +``` diff --git a/docs/examples/projects/create-platform.md b/docs/examples/projects/create-platform.md deleted file mode 100644 index c50df193..00000000 --- a/docs/examples/projects/create-platform.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Projects, PlatformType } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.createPlatform({ - projectId: '', - type: PlatformType.Web, - name: '', - key: '', // optional - store: '', // optional - hostname: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-api-status-all.md b/docs/examples/projects/update-api-status-all.md deleted file mode 100644 index 260797b1..00000000 --- a/docs/examples/projects/update-api-status-all.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateAPIStatusAll({ - projectId: '', - status: false -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-api-status.md b/docs/examples/projects/update-api-status.md deleted file mode 100644 index 2745e85b..00000000 --- a/docs/examples/projects/update-api-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Projects, Api } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateAPIStatus({ - projectId: '', - api: Api.Rest, - status: false -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-platform.md b/docs/examples/projects/update-platform.md deleted file mode 100644 index afc6fad1..00000000 --- a/docs/examples/projects/update-platform.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updatePlatform({ - projectId: '', - platformId: '', - name: '', - key: '', // optional - store: '', // optional - hostname: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-service-status-all.md b/docs/examples/projects/update-service-status-all.md deleted file mode 100644 index 4e33ff32..00000000 --- a/docs/examples/projects/update-service-status-all.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateServiceStatusAll({ - projectId: '', - status: false -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-service-status.md b/docs/examples/projects/update-service-status.md deleted file mode 100644 index b6a589cb..00000000 --- a/docs/examples/projects/update-service-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Projects, ApiService } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateServiceStatus({ - projectId: '', - service: ApiService.Account, - status: false -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 4691895c..943657d6 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -13,7 +13,8 @@ const result = await tablesDB.updateTable({ name: '', // optional permissions: [Permission.read(Role.any())], // optional rowSecurity: false, // optional - enabled: false // optional + enabled: false, // optional + purge: false // optional }); console.log(result); diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index c4ad5f3a..9d2c2548 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -13,9 +13,9 @@ const result = await webhooks.create({ name: '', events: [], enabled: false, // optional - security: false, // optional - httpUser: '', // optional - httpPass: '' // optional + tls: false, // optional + authUsername: '', // optional + authPassword: '' // optional }); console.log(result); diff --git a/docs/examples/webhooks/update-signature.md b/docs/examples/webhooks/update-secret.md similarity index 87% rename from docs/examples/webhooks/update-signature.md rename to docs/examples/webhooks/update-secret.md index a472c3b8..4c8ecc9b 100644 --- a/docs/examples/webhooks/update-signature.md +++ b/docs/examples/webhooks/update-secret.md @@ -7,7 +7,7 @@ const client = new Client() const webhooks = new Webhooks(client); -const result = await webhooks.updateSignature({ +const result = await webhooks.updateSecret({ webhookId: '' }); diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 52cb3553..fb1b70b6 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -13,9 +13,9 @@ const result = await webhooks.update({ url: '', events: [], enabled: false, // optional - security: false, // optional - httpUser: '', // optional - httpPass: '' // optional + tls: false, // optional + authUsername: '', // optional + authPassword: '' // optional }); console.log(result); diff --git a/package-lock.json b/package-lock.json index 1ab631fe..97b6d19a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "8.3.0", + "version": "9.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "8.3.0", + "version": "9.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 701486ce..8c451ae4 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": "8.3.0", + "version": "9.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index c64f7fd6..43dc4a93 100644 --- a/src/client.ts +++ b/src/client.ts @@ -406,8 +406,8 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '8.3.0', - 'X-Appwrite-Response-Format': '1.9.0', + 'x-sdk-version': '9.0.0', + 'X-Appwrite-Response-Format': '1.9.1', }; /** diff --git a/src/enums/api.ts b/src/enums/api.ts deleted file mode 100644 index 8db75946..00000000 --- a/src/enums/api.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum Api { - Rest = 'rest', - Graphql = 'graphql', - Realtime = 'realtime', -} \ No newline at end of file diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index 3382e3bf..efc44844 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -33,6 +33,7 @@ export enum OAuthProvider { TradeshiftBox = 'tradeshiftBox', Twitch = 'twitch', Wordpress = 'wordpress', + X = 'x', Yahoo = 'yahoo', Yammer = 'yammer', Yandex = 'yandex', diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts index e7c72fdd..bde1d30f 100644 --- a/src/enums/platform-type.ts +++ b/src/enums/platform-type.ts @@ -1,17 +1,7 @@ export enum PlatformType { - Web = 'web', - Flutterweb = 'flutter-web', - Flutterios = 'flutter-ios', - Flutterandroid = 'flutter-android', - Flutterlinux = 'flutter-linux', - Fluttermacos = 'flutter-macos', - Flutterwindows = 'flutter-windows', - Appleios = 'apple-ios', - Applemacos = 'apple-macos', - Applewatchos = 'apple-watchos', - Appletvos = 'apple-tvos', + Windows = 'windows', + Apple = 'apple', Android = 'android', - Unity = 'unity', - Reactnativeios = 'react-native-ios', - Reactnativeandroid = 'react-native-android', + Linux = 'linux', + Web = 'web', } \ No newline at end of file diff --git a/src/enums/protocol-id.ts b/src/enums/protocol-id.ts new file mode 100644 index 00000000..94d9095f --- /dev/null +++ b/src/enums/protocol-id.ts @@ -0,0 +1,5 @@ +export enum ProtocolId { + Rest = 'rest', + Graphql = 'graphql', + Websocket = 'websocket', +} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 8287d582..d30eb164 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -61,6 +61,10 @@ export enum Scopes { WebhooksWrite = 'webhooks.write', ProjectRead = 'project.read', ProjectWrite = 'project.write', + KeysRead = 'keys.read', + KeysWrite = 'keys.write', + PlatformsRead = 'platforms.read', + PlatformsWrite = 'platforms.write', PoliciesWrite = 'policies.write', PoliciesRead = 'policies.read', ArchivesRead = 'archives.read', @@ -70,12 +74,8 @@ export enum Scopes { DomainsRead = 'domains.read', DomainsWrite = 'domains.write', EventsRead = 'events.read', - PlatformsRead = 'platforms.read', - PlatformsWrite = 'platforms.write', ProjectsRead = 'projects.read', ProjectsWrite = 'projects.write', - KeysRead = 'keys.read', - KeysWrite = 'keys.write', DevKeysRead = 'devKeys.read', DevKeysWrite = 'devKeys.write', } \ No newline at end of file diff --git a/src/enums/api-service.ts b/src/enums/service-id.ts similarity index 73% rename from src/enums/api-service.ts rename to src/enums/service-id.ts index 2230207f..29281124 100644 --- a/src/enums/api-service.ts +++ b/src/enums/service-id.ts @@ -1,15 +1,19 @@ -export enum ApiService { +export enum ServiceId { Account = 'account', Avatars = 'avatars', Databases = 'databases', Tablesdb = 'tablesdb', Locale = 'locale', Health = 'health', + Project = 'project', Storage = 'storage', Teams = 'teams', Users = 'users', + Vcs = 'vcs', Sites = 'sites', Functions = 'functions', + Proxy = 'proxy', Graphql = 'graphql', + Migrations = 'migrations', Messaging = 'messaging', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 21551500..2232a1c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,13 +77,12 @@ export { FirebaseMigrationResource } from './enums/firebase-migration-resource'; export { NHostMigrationResource } from './enums/n-host-migration-resource'; export { SupabaseMigrationResource } from './enums/supabase-migration-resource'; export { Addon } from './enums/addon'; +export { ProtocolId } from './enums/protocol-id'; +export { ServiceId } from './enums/service-id'; export { ProjectUsageRange } from './enums/project-usage-range'; export { Region } from './enums/region'; -export { Api } from './enums/api'; export { AuthMethod } from './enums/auth-method'; -export { PlatformType } from './enums/platform-type'; export { ResourceType } from './enums/resource-type'; -export { ApiService } from './enums/api-service'; export { SMTPSecure } from './enums/smtp-secure'; export { Status } from './enums/status'; export { EmailTemplateType } from './enums/email-template-type'; @@ -109,6 +108,7 @@ export { IndexStatus } from './enums/index-status'; export { DeploymentStatus } from './enums/deployment-status'; export { ExecutionTrigger } from './enums/execution-trigger'; export { ExecutionStatus } from './enums/execution-status'; +export { PlatformType } from './enums/platform-type'; export { HealthAntivirusStatus } from './enums/health-antivirus-status'; export { HealthCheckStatus } from './enums/health-check-status'; export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; diff --git a/src/models.ts b/src/models.ts index cc7600bd..14456792 100644 --- a/src/models.ts +++ b/src/models.ts @@ -470,20 +470,6 @@ export namespace Models { devKeys: DevKey[]; } - /** - * Platforms List - */ - export type PlatformList = { - /** - * Total number of platforms that matched your query. - */ - total: number; - /** - * List of platforms. - */ - platforms: Platform[]; - } - /** * Countries List */ @@ -2722,6 +2708,10 @@ export namespace Models { * API mode when event triggered. */ mode: string; + /** + * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + */ + userType: string; /** * IP session in use when the session was created. */ @@ -4662,7 +4652,7 @@ export namespace Models { /** * List of Platforms. */ - platforms: Platform[]; + platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; /** * List of Webhooks. */ @@ -4779,6 +4769,10 @@ export namespace Models { * Health service status */ serviceStatusForHealth: boolean; + /** + * Project service status + */ + serviceStatusForProject: boolean; /** * Storage service status */ @@ -4791,6 +4785,10 @@ export namespace Models { * Users service status */ serviceStatusForUsers: boolean; + /** + * VCS service status + */ + serviceStatusForVcs: boolean; /** * Sites service status */ @@ -4799,14 +4797,34 @@ export namespace Models { * Functions service status */ serviceStatusForFunctions: boolean; + /** + * Proxy service status + */ + serviceStatusForProxy: boolean; /** * GraphQL service status */ serviceStatusForGraphql: boolean; + /** + * Migrations service status + */ + serviceStatusForMigrations: boolean; /** * Messaging service status */ serviceStatusForMessaging: boolean; + /** + * REST protocol status + */ + protocolStatusForRest: boolean; + /** + * GraphQL protocol status + */ + protocolStatusForGraphql: boolean; + /** + * Websocket protocol status + */ + protocolStatusForWebsocket: boolean; /** * Project region */ @@ -4854,21 +4872,21 @@ export namespace Models { */ events: string[]; /** - * Indicated if SSL / TLS Certificate verification is enabled. + * Indicates if SSL / TLS certificate verification is enabled. */ - security: boolean; + tls: boolean; /** * HTTP basic authentication username. */ - httpUser: string; + authUsername: string; /** * HTTP basic authentication password. */ - httpPass: string; + authPassword: string; /** - * Signature key which can be used to validated incoming + * Signature key which can be used to validate incoming webhook payloads. */ - signatureKey: string; + secret: string; /** * Indicates if this webhook is enabled. */ @@ -5004,9 +5022,9 @@ export namespace Models { } /** - * Platform + * Platform Web */ - export type Platform = { + export type PlatformWeb = { /** * Platform ID. */ @@ -5024,29 +5042,147 @@ export namespace Models { */ name: string; /** - * Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android. + * Platform type. Possible values are: windows, apple, android, linux, web. */ type: PlatformType; /** - * Platform Key. iOS bundle ID or Android package name. Empty string for other platforms. + * Web app hostname. Empty string for other platforms. */ - key: string; + hostname: string; + } + + /** + * Platform Apple + */ + export type PlatformApple = { /** - * App store or Google Play store ID. + * Platform ID. */ - store: string; + $id: string; /** - * Web app hostname. Empty string for other platforms. + * Platform creation date in ISO 8601 format. */ - hostname: string; + $createdAt: string; /** - * HTTP basic authentication username. + * Platform update date in ISO 8601 format. */ - httpUser: string; + $updatedAt: string; /** - * HTTP basic authentication password. + * Platform name. */ - httpPass: string; + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Apple bundle identifier. + */ + bundleIdentifier: string; + } + + /** + * Platform Android + */ + export type PlatformAndroid = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Android application ID. + */ + applicationId: string; + } + + /** + * Platform Windows + */ + export type PlatformWindows = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Windows package identifier name. + */ + packageIdentifierName: string; + } + + /** + * Platform Linux + */ + export type PlatformLinux = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Linux package name. + */ + packageName: string; + } + + /** + * Platforms List + */ + export type PlatformList = { + /** + * Total number of platforms in the given project. + */ + total: number; + /** + * List of platforms. + */ + platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; } /** @@ -6434,7 +6570,7 @@ export namespace Models { /** * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". */ - deploymentResourceType: ProxyRuleDeploymentResourceType; + deploymentResourceType?: ProxyRuleDeploymentResourceType; /** * ID deployment's resource. Used if type is "deployment" */ @@ -7721,6 +7857,18 @@ export namespace Models { * Does plan support credit */ supportsCredits: boolean; + /** + * Does plan support blocking disposable email addresses. + */ + supportsDisposableEmailValidation: boolean; + /** + * Does plan support requiring canonical email addresses. + */ + supportsCanonicalEmailValidation: boolean; + /** + * Does plan support blocking free email addresses. + */ + supportsFreeEmailValidation: boolean; /** * Does plan support backup policies. */ diff --git a/src/services/account.ts b/src/services/account.ts index 0d467617..f9cccb68 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -3042,7 +3042,7 @@ export class Account { * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -3058,7 +3058,7 @@ export class Account { * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -3795,7 +3795,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -3810,7 +3810,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. diff --git a/src/services/databases.ts b/src/services/databases.ts index ce8902e3..6cc264a5 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -968,11 +968,12 @@ export class Databases { * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. */ - updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }): Promise; + updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise; /** * Update a collection by its unique ID. * @@ -982,19 +983,20 @@ export class Databases { * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise; + updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise; updateCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; + let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -1002,7 +1004,8 @@ export class Databases { name: rest[1] as string, permissions: rest[2] as string[], documentSecurity: rest[3] as boolean, - enabled: rest[4] as boolean + enabled: rest[4] as boolean, + purge: rest[5] as boolean }; } @@ -1012,6 +1015,7 @@ export class Databases { const permissions = params.permissions; const documentSecurity = params.documentSecurity; const enabled = params.enabled; + const purge = params.purge; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1034,6 +1038,9 @@ export class Databases { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4714,7 +4721,7 @@ export class Databases { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. @@ -4728,7 +4735,7 @@ export class Databases { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/project.ts b/src/services/project.ts index d9fe9435..8792d5f5 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,6 +2,9 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { Scopes } from '../enums/scopes'; +import { ProtocolId } from '../enums/protocol-id'; +import { ServiceId } from '../enums/service-id'; import { ProjectUsageRange } from '../enums/project-usage-range'; export class Project { @@ -11,6 +14,1584 @@ export class Project { this.client = client; } + /** + * Configure if canonical emails (alias subaddresses and emails with suffixes) are allowed during new users sign-ups in this project. + * + * @param {boolean} params.enabled - Set whether or not to require canonical email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCanonicalEmails(params: { enabled: boolean }): Promise; + /** + * Configure if canonical emails (alias subaddresses and emails with suffixes) are allowed during new users sign-ups in this project. + * + * @param {boolean} enabled - Set whether or not to require canonical email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCanonicalEmails(enabled: boolean): Promise; + updateCanonicalEmails( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth/canonical-emails'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Configure if disposable emails (emails of known temporary domains) are allowed during new users sign-ups in this project. + * + * @param {boolean} params.enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDisposableEmails(params: { enabled: boolean }): Promise; + /** + * Configure if disposable emails (emails of known temporary domains) are allowed during new users sign-ups in this project. + * + * @param {boolean} enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDisposableEmails(enabled: boolean): Promise; + updateDisposableEmails( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth/disposable-emails'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Configure if free emails (non-commercial and not a custom domain) are allowed during new users sign-ups in this project. + * + * @param {boolean} params.enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateFreeEmails(params: { enabled: boolean }): Promise; + /** + * Configure if free emails (non-commercial and not a custom domain) are allowed during new users sign-ups in this project. + * + * @param {boolean} enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFreeEmails(enabled: boolean): Promise; + updateFreeEmails( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth/free-emails'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all API keys from the current project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listKeys(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all API keys from the current project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes + * @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. + */ + listKeys(queries?: string[], total?: boolean): Promise; + listKeys( + 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 = '/project/keys'; + 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 } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * @param {string} params.keyId - Key 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 - Key name. Max length: 128 chars. + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise} + */ + createKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise; + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * @param {string} keyId - Key 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 - Key name. Max length: 128 chars. + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise; + createKey( + paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, + ...rest: [(string)?, (Scopes[])?, (string)?] + ): Promise { + let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as Scopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys'; + const payload: Payload = {}; + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a key by its unique ID. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getKey(params: { keyId: string }): Promise; + /** + * Get a key by its unique ID. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getKey(keyId: string): Promise; + getKey( + paramsOrFirst: { keyId: string } | string + ): Promise { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} params.keyId - Key ID. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise; + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} keyId - Key ID. + * @param {string} name - Key name. Max length: 128 chars. + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise; + updateKey( + paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, + ...rest: [(string)?, (Scopes[])?, (string)?] + ): Promise { + let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as Scopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteKey(params: { keyId: string }): Promise<{}>; + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteKey(keyId: string): Promise<{}>; + deleteKey( + paramsOrFirst: { keyId: string } | string + ): Promise<{}> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateLabels(params: { labels: string[] }): Promise; + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels(labels: string[]): Promise; + updateLabels( + paramsOrFirst: { labels: string[] } | string[] + ): Promise { + let params: { labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { labels: string[] }; + } else { + params = { + labels: paramsOrFirst as string[] + }; + } + + const labels = params.labels; + + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/project/labels'; + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @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, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listPlatforms(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @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, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @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. + */ + listPlatforms(queries?: string[], total?: boolean): Promise; + listPlatforms( + 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 = '/project/platforms'; + 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 } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise; + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise; + createAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise; + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise; + updateAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise; + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise; + createApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise; + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise; + updateApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise; + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLinuxPlatform(platformId: string, name: string, packageName: string): Promise; + createLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise; + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise; + updateLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise; + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWebPlatform(platformId: string, name: string, hostname: string): Promise; + createWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise; + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWebPlatform(platformId: string, name: string, hostname: string): Promise; + updateWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise; + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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 - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise; + createWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise; + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise; + updateWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPlatform(params: { platformId: string }): Promise; + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPlatform(platformId: string): Promise; + getPlatform( + paramsOrFirst: { platformId: string } | string + ): Promise { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePlatform(params: { platformId: string }): Promise<{}>; + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePlatform(platformId: string): Promise<{}>; + deletePlatform( + paramsOrFirst: { platformId: string } | string + ): Promise<{}> { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the status of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * + * @param {ProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {boolean} params.enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateProtocolStatus(params: { protocolId: ProtocolId, enabled: boolean }): Promise; + /** + * Update the status of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * + * @param {ProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {boolean} enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateProtocolStatus(protocolId: ProtocolId, enabled: boolean): Promise; + updateProtocolStatus( + paramsOrFirst: { protocolId: ProtocolId, enabled: boolean } | ProtocolId, + ...rest: [(boolean)?] + ): Promise { + let params: { protocolId: ProtocolId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { protocolId: ProtocolId, enabled: boolean }; + } else { + params = { + protocolId: paramsOrFirst as ProtocolId, + enabled: rest[0] as boolean + }; + } + + const protocolId = params.protocolId; + const enabled = params.enabled; + + if (typeof protocolId === 'undefined') { + throw new AppwriteException('Missing required parameter: "protocolId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/protocols/{protocolId}/status'.replace('{protocolId}', protocolId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the status of a specific service. Use this endpoint to enable or disable a service in your project. + * + * @param {ServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging + * @param {boolean} params.enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateServiceStatus(params: { serviceId: ServiceId, enabled: boolean }): Promise; + /** + * Update the status of a specific service. Use this endpoint to enable or disable a service in your project. + * + * @param {ServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging + * @param {boolean} enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateServiceStatus(serviceId: ServiceId, enabled: boolean): Promise; + updateServiceStatus( + paramsOrFirst: { serviceId: ServiceId, enabled: boolean } | ServiceId, + ...rest: [(boolean)?] + ): Promise { + let params: { serviceId: ServiceId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId: ServiceId, enabled: boolean }; + } else { + params = { + serviceId: paramsOrFirst as ServiceId, + enabled: rest[0] as boolean + }; + } + + const serviceId = params.serviceId; + const enabled = params.enabled; + + if (typeof serviceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "serviceId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/services/{serviceId}/status'.replace('{serviceId}', serviceId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** * Get comprehensive usage statistics for your project. View metrics including network requests, bandwidth, storage, function executions, database usage, and user activity. Specify a time range with startDate and endDate, and optionally set the data granularity with period (1h or 1d). The response includes both total counts and detailed breakdowns by resource, along with historical data over the specified period. * diff --git a/src/services/projects.ts b/src/services/projects.ts index 6998bbab..67122745 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -3,13 +3,10 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { Region } from '../enums/region'; -import { Api } from '../enums/api'; import { AuthMethod } from '../enums/auth-method'; import { Scopes } from '../enums/scopes'; import { OAuthProvider } from '../enums/o-auth-provider'; -import { PlatformType } from '../enums/platform-type'; import { ResourceType } from '../enums/resource-type'; -import { ApiService } from '../enums/api-service'; import { SMTPSecure } from '../enums/smtp-secure'; import { Status } from '../enums/status'; import { EmailTemplateType } from '../enums/email-template-type'; @@ -465,280 +462,6 @@ export class Projects { ); } - /** - * Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime. - * - * @param {string} params.projectId - Project unique ID. - * @param {Api} params.api - API name. - * @param {boolean} params.status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Projects.updateAPIStatus` instead. - */ - updateApiStatus(params: { projectId: string, api: Api, status: boolean }): Promise; - /** - * Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime. - * - * @param {string} projectId - Project unique ID. - * @param {Api} api - API name. - * @param {boolean} status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApiStatus(projectId: string, api: Api, status: boolean): Promise; - updateApiStatus( - paramsOrFirst: { projectId: string, api: Api, status: boolean } | string, - ...rest: [(Api)?, (boolean)?] - ): Promise { - let params: { projectId: string, api: Api, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, api: Api, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - api: rest[0] as Api, - status: rest[1] as boolean - }; - } - - const projectId = params.projectId; - const api = params.api; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof api === 'undefined') { - throw new AppwriteException('Missing required parameter: "api"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/api'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof api !== 'undefined') { - payload['api'] = api; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime. - * - * @param {string} params.projectId - Project unique ID. - * @param {Api} params.api - API name. - * @param {boolean} params.status - API status. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateAPIStatus(params: { projectId: string, api: Api, status: boolean }): Promise; - /** - * Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime. - * - * @param {string} projectId - Project unique ID. - * @param {Api} api - API name. - * @param {boolean} status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAPIStatus(projectId: string, api: Api, status: boolean): Promise; - updateAPIStatus( - paramsOrFirst: { projectId: string, api: Api, status: boolean } | string, - ...rest: [(Api)?, (boolean)?] - ): Promise { - let params: { projectId: string, api: Api, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, api: Api, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - api: rest[0] as Api, - status: rest[1] as boolean - }; - } - - const projectId = params.projectId; - const api = params.api; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof api === 'undefined') { - throw new AppwriteException('Missing required parameter: "api"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/api'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof api !== 'undefined') { - payload['api'] = api; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once. - * - * @param {string} params.projectId - Project unique ID. - * @param {boolean} params.status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `Projects.updateAPIStatusAll` instead. - */ - updateApiStatusAll(params: { projectId: string, status: boolean }): Promise; - /** - * Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once. - * - * @param {string} projectId - Project unique ID. - * @param {boolean} status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApiStatusAll(projectId: string, status: boolean): Promise; - updateApiStatusAll( - paramsOrFirst: { projectId: string, status: boolean } | string, - ...rest: [(boolean)?] - ): Promise { - let params: { projectId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - status: rest[0] as boolean - }; - } - - const projectId = params.projectId; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/api/all'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once. - * - * @param {string} params.projectId - Project unique ID. - * @param {boolean} params.status - API status. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateAPIStatusAll(params: { projectId: string, status: boolean }): Promise; - /** - * Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once. - * - * @param {string} projectId - Project unique ID. - * @param {boolean} status - API status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAPIStatusAll(projectId: string, status: boolean): Promise; - updateAPIStatusAll( - paramsOrFirst: { projectId: string, status: boolean } | string, - ...rest: [(boolean)?] - ): Promise { - let params: { projectId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - status: rest[0] as boolean - }; - } - - const projectId = params.projectId; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/api/all'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - /** * Update how long sessions created within a project should stay active for. * @@ -1915,860 +1638,75 @@ export class Projects { } /** - * Get a list of all API keys from the current project. + * Update the OAuth2 provider configurations. Use this endpoint to set up or update the OAuth2 provider credentials or enable/disable providers. * * @param {string} params.projectId - Project 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. You may filter on the following attributes: expire, accessedAt, name, scopes - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {OAuthProvider} params.provider - Provider Name + * @param {string} params.appId - Provider app ID. Max length: 256 chars. + * @param {string} params.secret - Provider secret key. Max length: 512 chars. + * @param {boolean} params.enabled - Provider status. Set to 'false' to disable new session creation. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - listKeys(params: { projectId: string, queries?: string[], total?: boolean }): Promise; + updateOAuth2(params: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }): Promise; /** - * Get a list of all API keys from the current project. + * Update the OAuth2 provider configurations. Use this endpoint to set up or update the OAuth2 provider credentials or enable/disable providers. * * @param {string} projectId - Project 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. You may filter on the following attributes: expire, accessedAt, name, scopes - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {OAuthProvider} provider - Provider Name + * @param {string} appId - Provider app ID. Max length: 256 chars. + * @param {string} secret - Provider secret key. Max length: 512 chars. + * @param {boolean} enabled - Provider status. Set to 'false' to disable new session creation. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listKeys(projectId: string, queries?: string[], total?: boolean): Promise; - listKeys( - paramsOrFirst: { projectId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - let params: { projectId: string, queries?: string[], total?: boolean }; + updateOAuth2(projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean): Promise; + updateOAuth2( + paramsOrFirst: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean } | string, + ...rest: [(OAuthProvider)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, queries?: string[], total?: boolean }; + params = (paramsOrFirst || {}) as { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }; } else { params = { projectId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean + provider: rest[0] as OAuthProvider, + appId: rest[1] as string, + secret: rest[2] as string, + enabled: rest[3] as boolean }; } const projectId = params.projectId; - const queries = params.queries; - const total = params.total; + const provider = params.provider; + const appId = params.appId; + const secret = params.secret; + const enabled = params.enabled; if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); + } - const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId); + const apiPath = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId); const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; + if (typeof provider !== 'undefined') { + payload['provider'] = provider; } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} params.keyId - Key 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.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - */ - createKey(params: { projectId: string, name: string, scopes?: Scopes[], keyId?: string, expire?: string }): Promise; - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * @param {string} projectId - Project unique ID. - * @param {string} name - Key name. Max length: 128 chars. - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} keyId - Key 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} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createKey(projectId: string, name: string, scopes?: Scopes[], keyId?: string, expire?: string): Promise; - createKey( - paramsOrFirst: { projectId: string, name: string, scopes?: Scopes[], keyId?: string, expire?: string } | string, - ...rest: [(string)?, (Scopes[])?, (string)?, (string)?] - ): Promise { - let params: { projectId: string, name: string, scopes?: Scopes[], keyId?: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, name: string, scopes?: Scopes[], keyId?: string, expire?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as Scopes[], - keyId: rest[2] as string, - expire: rest[3] as string - }; - } - - const projectId = params.projectId; - const name = params.name; - const scopes = params.scopes; - const keyId = params.keyId; - const expire = params.expire; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a key by its unique ID. This endpoint returns details about a specific API key in your project including it's scopes. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.keyId - Key unique ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getKey(params: { projectId: string, keyId: string }): Promise; - /** - * Get a key by its unique ID. This endpoint returns details about a specific API key in your project including it's scopes. - * - * @param {string} projectId - Project unique ID. - * @param {string} keyId - Key unique ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getKey(projectId: string, keyId: string): Promise; - getKey( - paramsOrFirst: { projectId: string, keyId: string } | string, - ...rest: [(string)?] - ): Promise { - let params: { projectId: string, keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, keyId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - keyId: rest[0] as string - }; - } - - const projectId = params.projectId; - const keyId = params.keyId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.keyId - Key unique ID. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 events are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateKey(params: { projectId: string, keyId: string, name: string, scopes?: Scopes[], expire?: string }): Promise; - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} projectId - Project unique ID. - * @param {string} keyId - Key unique ID. - * @param {string} name - Key name. Max length: 128 chars. - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 events are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateKey(projectId: string, keyId: string, name: string, scopes?: Scopes[], expire?: string): Promise; - updateKey( - paramsOrFirst: { projectId: string, keyId: string, name: string, scopes?: Scopes[], expire?: string } | string, - ...rest: [(string)?, (string)?, (Scopes[])?, (string)?] - ): Promise { - let params: { projectId: string, keyId: string, name: string, scopes?: Scopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, keyId: string, name: string, scopes?: Scopes[], expire?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - keyId: rest[0] as string, - name: rest[1] as string, - scopes: rest[2] as Scopes[], - expire: rest[3] as string - }; - } - - const projectId = params.projectId; - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.keyId - Key unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteKey(params: { projectId: string, keyId: string }): Promise<{}>; - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} projectId - Project unique ID. - * @param {string} keyId - Key unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteKey(projectId: string, keyId: string): Promise<{}>; - deleteKey( - paramsOrFirst: { projectId: string, keyId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { projectId: string, keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, keyId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - keyId: rest[0] as string - }; - } - - const projectId = params.projectId; - const keyId = params.keyId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization. - * - * @param {string} params.projectId - Project unique ID. - * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateLabels(params: { projectId: string, labels: string[] }): Promise; - /** - * Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization. - * - * @param {string} projectId - Project unique ID. - * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLabels(projectId: string, labels: string[]): Promise; - updateLabels( - paramsOrFirst: { projectId: string, labels: string[] } | string, - ...rest: [(string[])?] - ): Promise { - let params: { projectId: string, labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, labels: string[] }; - } else { - params = { - projectId: paramsOrFirst as string, - labels: rest[0] as string[] - }; - } - - const projectId = params.projectId; - const labels = params.labels; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); - } - - const apiPath = '/projects/{projectId}/labels'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof labels !== 'undefined') { - payload['labels'] = labels; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the OAuth2 provider configurations. Use this endpoint to set up or update the OAuth2 provider credentials or enable/disable providers. - * - * @param {string} params.projectId - Project unique ID. - * @param {OAuthProvider} params.provider - Provider Name - * @param {string} params.appId - Provider app ID. Max length: 256 chars. - * @param {string} params.secret - Provider secret key. Max length: 512 chars. - * @param {boolean} params.enabled - Provider status. Set to 'false' to disable new session creation. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateOAuth2(params: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }): Promise; - /** - * Update the OAuth2 provider configurations. Use this endpoint to set up or update the OAuth2 provider credentials or enable/disable providers. - * - * @param {string} projectId - Project unique ID. - * @param {OAuthProvider} provider - Provider Name - * @param {string} appId - Provider app ID. Max length: 256 chars. - * @param {string} secret - Provider secret key. Max length: 512 chars. - * @param {boolean} enabled - Provider status. Set to 'false' to disable new session creation. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2(projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean): Promise; - updateOAuth2( - paramsOrFirst: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean } | string, - ...rest: [(OAuthProvider)?, (string)?, (string)?, (boolean)?] - ): Promise { - let params: { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - provider: rest[0] as OAuthProvider, - appId: rest[1] as string, - secret: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const projectId = params.projectId; - const provider = params.provider; - const appId = params.appId; - const secret = params.secret; - const enabled = params.enabled; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - - const apiPath = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof provider !== 'undefined') { - payload['provider'] = provider; - } - if (typeof appId !== 'undefined') { - payload['appId'] = appId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @param {string} params.projectId - Project unique ID. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listPlatforms(params: { projectId: string, total?: boolean }): Promise; - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @param {string} projectId - Project unique ID. - * @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. - */ - listPlatforms(projectId: string, total?: boolean): Promise; - listPlatforms( - paramsOrFirst: { projectId: string, total?: boolean } | string, - ...rest: [(boolean)?] - ): Promise { - let params: { projectId: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, total?: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - total: rest[0] as boolean - }; - } - - const projectId = params.projectId; - const total = params.total; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - - const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.projectId - Project unique ID. - * @param {PlatformType} params.type - Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.key - Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars. - * @param {string} params.store - App store or Google Play store ID. Max length: 256 chars. - * @param {string} params.hostname - Platform client hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - createPlatform(params: { projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string }): Promise; - /** - * Create a new platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} projectId - Project unique ID. - * @param {PlatformType} type - Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} key - Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars. - * @param {string} store - App store or Google Play store ID. Max length: 256 chars. - * @param {string} hostname - Platform client hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPlatform(projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string): Promise; - createPlatform( - paramsOrFirst: { projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string } | string, - ...rest: [(PlatformType)?, (string)?, (string)?, (string)?, (string)?] - ): Promise { - let params: { projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - type: rest[0] as PlatformType, - name: rest[1] as string, - key: rest[2] as string, - store: rest[3] as string, - hostname: rest[4] as string - }; - } - - const projectId = params.projectId; - const type = params.type; - const name = params.name; - const key = params.key; - const store = params.store; - const hostname = params.hostname; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof store !== 'undefined') { - payload['store'] = store; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.platformId - Platform unique ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getPlatform(params: { projectId: string, platformId: string }): Promise; - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} projectId - Project unique ID. - * @param {string} platformId - Platform unique ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPlatform(projectId: string, platformId: string): Promise; - getPlatform( - paramsOrFirst: { projectId: string, platformId: string } | string, - ...rest: [(string)?] - ): Promise { - let params: { projectId: string, platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, platformId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - platformId: rest[0] as string - }; - } - - const projectId = params.projectId; - const platformId = params.platformId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - - const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a platform by its unique ID. Use this endpoint to update the platform's name, key, platform store ID, or hostname. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.platformId - Platform unique ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.key - Package name for android or bundle ID for iOS. Max length: 256 chars. - * @param {string} params.store - App store or Google Play store ID. Max length: 256 chars. - * @param {string} params.hostname - Platform client URL. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePlatform(params: { projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string }): Promise; - /** - * Update a platform by its unique ID. Use this endpoint to update the platform's name, key, platform store ID, or hostname. - * - * @param {string} projectId - Project unique ID. - * @param {string} platformId - Platform unique ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} key - Package name for android or bundle ID for iOS. Max length: 256 chars. - * @param {string} store - App store or Google Play store ID. Max length: 256 chars. - * @param {string} hostname - Platform client URL. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePlatform(projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string): Promise; - updatePlatform( - paramsOrFirst: { projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise { - let params: { projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - platformId: rest[0] as string, - name: rest[1] as string, - key: rest[2] as string, - store: rest[3] as string, - hostname: rest[4] as string - }; - } - - const projectId = params.projectId; - const platformId = params.platformId; - const name = params.name; - const key = params.key; - const store = params.store; - const hostname = params.hostname; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof store !== 'undefined') { - payload['store'] = store; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.platformId - Platform unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePlatform(params: { projectId: string, platformId: string }): Promise<{}>; - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} projectId - Project unique ID. - * @param {string} platformId - Platform unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePlatform(projectId: string, platformId: string): Promise<{}>; - deletePlatform( - paramsOrFirst: { projectId: string, platformId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { projectId: string, platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, platformId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - platformId: rest[0] as string - }; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; } - - const projectId = params.projectId; - const platformId = params.platformId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); + if (typeof secret !== 'undefined') { + payload['secret'] = secret; } - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; } - - const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2776,7 +1714,7 @@ export class Projects { } return this.client.call( - 'delete', + 'patch', uri, apiHeaders, payload @@ -3005,142 +1943,6 @@ export class Projects { ); } - /** - * Update the status of a specific service. Use this endpoint to enable or disable a service in your project. - * - * @param {string} params.projectId - Project unique ID. - * @param {ApiService} params.service - Service name. - * @param {boolean} params.status - Service status. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateServiceStatus(params: { projectId: string, service: ApiService, status: boolean }): Promise; - /** - * Update the status of a specific service. Use this endpoint to enable or disable a service in your project. - * - * @param {string} projectId - Project unique ID. - * @param {ApiService} service - Service name. - * @param {boolean} status - Service status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateServiceStatus(projectId: string, service: ApiService, status: boolean): Promise; - updateServiceStatus( - paramsOrFirst: { projectId: string, service: ApiService, status: boolean } | string, - ...rest: [(ApiService)?, (boolean)?] - ): Promise { - let params: { projectId: string, service: ApiService, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, service: ApiService, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - service: rest[0] as ApiService, - status: rest[1] as boolean - }; - } - - const projectId = params.projectId; - const service = params.service; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof service === 'undefined') { - throw new AppwriteException('Missing required parameter: "service"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/service'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof service !== 'undefined') { - payload['service'] = service; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the status of all services. Use this endpoint to enable or disable all optional services at once. - * - * @param {string} params.projectId - Project unique ID. - * @param {boolean} params.status - Service status. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateServiceStatusAll(params: { projectId: string, status: boolean }): Promise; - /** - * Update the status of all services. Use this endpoint to enable or disable all optional services at once. - * - * @param {string} projectId - Project unique ID. - * @param {boolean} status - Service status. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateServiceStatusAll(projectId: string, status: boolean): Promise; - updateServiceStatusAll( - paramsOrFirst: { projectId: string, status: boolean } | string, - ...rest: [(boolean)?] - ): Promise { - let params: { projectId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - status: rest[0] as boolean - }; - } - - const projectId = params.projectId; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/service/all'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - /** * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. * diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index add71230..83667c47 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -959,10 +959,11 @@ export class TablesDB { * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. * @throws {AppwriteException} * @returns {Promise} */ - updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }): Promise; + updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise; /** * Update a table by its unique ID. * @@ -972,19 +973,20 @@ export class TablesDB { * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean): Promise; + updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise; updateTable( - paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; + let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -992,7 +994,8 @@ export class TablesDB { name: rest[1] as string, permissions: rest[2] as string[], rowSecurity: rest[3] as boolean, - enabled: rest[4] as boolean + enabled: rest[4] as boolean, + purge: rest[5] as boolean }; } @@ -1002,6 +1005,7 @@ export class TablesDB { const permissions = params.permissions; const rowSecurity = params.rowSecurity; const enabled = params.enabled; + const purge = params.purge; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1024,6 +1028,9 @@ export class TablesDB { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -5052,7 +5059,7 @@ export class TablesDB { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} */ @@ -5065,7 +5072,7 @@ export class TablesDB { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index ea62d2ca..d0d3fe87 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -13,7 +13,7 @@ export class Webhooks { /** * Get a list of all webhooks belonging to the project. 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: name, url, httpUser, security, events, enabled, logs, attempts + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} @@ -22,7 +22,7 @@ export class Webhooks { /** * Get a list of all webhooks belonging to the project. 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: name, url, httpUser, security, events, enabled, logs, attempts + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} @@ -77,13 +77,13 @@ export class Webhooks { * @param {string} params.name - Webhook name. Max length: 128 chars. * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. - * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise} */ - create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }): Promise; + create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise; /** * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. * @@ -92,22 +92,22 @@ export class Webhooks { * @param {string} name - Webhook name. Max length: 128 chars. * @param {string[]} events - Events list. Maximum of 100 events are allowed. * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} security - Certificate verification, false for disabled or true for enabled. - * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string): Promise; + create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise; create( - paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string } | string, + paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] ): Promise { - let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; } else { params = { webhookId: paramsOrFirst as string, @@ -115,9 +115,9 @@ export class Webhooks { name: rest[1] as string, events: rest[2] as string[], enabled: rest[3] as boolean, - security: rest[4] as boolean, - httpUser: rest[5] as string, - httpPass: rest[6] as string + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string }; } @@ -126,9 +126,9 @@ export class Webhooks { const name = params.name; const events = params.events; const enabled = params.enabled; - const security = params.security; - const httpUser = params.httpUser; - const httpPass = params.httpPass; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); @@ -160,14 +160,14 @@ export class Webhooks { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } - if (typeof security !== 'undefined') { - payload['security'] = security; + if (typeof tls !== 'undefined') { + payload['tls'] = tls; } - if (typeof httpUser !== 'undefined') { - payload['httpUser'] = httpUser; + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; } - if (typeof httpPass !== 'undefined') { - payload['httpPass'] = httpPass; + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -242,13 +242,13 @@ export class Webhooks { * @param {string} params.url - Webhook URL. * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. - * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise} */ - update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }): Promise; + update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise; /** * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. * @@ -257,22 +257,22 @@ export class Webhooks { * @param {string} url - Webhook URL. * @param {string[]} events - Events list. Maximum of 100 events are allowed. * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} security - Certificate verification, false for disabled or true for enabled. - * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string): Promise; + update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise; update( - paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string } | string, + paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] ): Promise { - let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; } else { params = { webhookId: paramsOrFirst as string, @@ -280,9 +280,9 @@ export class Webhooks { url: rest[1] as string, events: rest[2] as string[], enabled: rest[3] as boolean, - security: rest[4] as boolean, - httpUser: rest[5] as string, - httpPass: rest[6] as string + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string }; } @@ -291,9 +291,9 @@ export class Webhooks { const url = params.url; const events = params.events; const enabled = params.enabled; - const security = params.security; - const httpUser = params.httpUser; - const httpPass = params.httpPass; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); @@ -322,14 +322,14 @@ export class Webhooks { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } - if (typeof security !== 'undefined') { - payload['security'] = security; + if (typeof tls !== 'undefined') { + payload['tls'] = tls; } - if (typeof httpUser !== 'undefined') { - payload['httpUser'] = httpUser; + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; } - if (typeof httpPass !== 'undefined') { - payload['httpPass'] = httpPass; + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -398,23 +398,23 @@ export class Webhooks { } /** - * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. * * @param {string} params.webhookId - Webhook ID. * @throws {AppwriteException} * @returns {Promise} */ - updateSignature(params: { webhookId: string }): Promise; + updateSecret(params: { webhookId: string }): Promise; /** - * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. * * @param {string} webhookId - Webhook ID. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSignature(webhookId: string): Promise; - updateSignature( + updateSecret(webhookId: string): Promise; + updateSecret( paramsOrFirst: { webhookId: string } | string ): Promise { let params: { webhookId: string }; @@ -433,7 +433,7 @@ export class Webhooks { throw new AppwriteException('Missing required parameter: "webhookId"'); } - const apiPath = '/webhooks/{webhookId}/signature'.replace('{webhookId}', webhookId); + const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath);