diff --git a/CHANGELOG.md b/CHANGELOG.md index cea83209..2adc7bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Change Log +## 12.0.0 + +* Breaking: Renamed `AuthMethod` enum to `MethodId` +* Breaking: Replaced `Projects.updateAuthStatus` with `Project.updateAuthMethod` +* Breaking: Replaced `Projects.updateOAuth2` with per-provider methods on `Project` service (e.g. `updateOAuth2Google`, `updateOAuth2GitHub`) +* Breaking: Replaced `Projects.updateMockNumbers` with `listMockPhones`, `createMockPhone`, `getMockPhone`, `updateMockPhone`, `deleteMockPhone` on `Project` service +* Breaking: Replaced `Projects.createJWT` with `Project.createEphemeralKey` +* Breaking: Moved `delete` from `Projects` to `Project` service +* Breaking: Renamed `execution.read`/`execution.write` scopes to `executions.read`/`executions.write` +* Breaking: Renamed `domainId` parameter to `invoiceId` in `domains.updatePurchase` and `domains.updateTransferIn` +* Added: `Manager` service with `createBlock`, `deleteBlock`, `listBlocks` methods +* Added: `listEmailTemplates`, `listOAuth2Providers`, `getOAuth2Provider`, `listPolicies`, `getPolicy` methods on `Project` service +* Added: `createPlanEstimation` method on `Organizations` service +* Added: `listOAuth2Providers` and `listProjectScopes` methods on `Console` service +* Added: `fusionauth`, `keycloak`, `kick` to `OAuthProvider` enum +* Added: `MethodId`, `PolicyId` enums +* Added: `mocks.read`, `mocks.write`, `sessions.read` scopes +* Added: `rust-1.83` runtime +* Added: `backup-policy` to `AppwriteMigrationResource` enum +* Added: Plural `ResourceType` values (`projects`, `functions`, `sites`, `databases`, `buckets`, `providers`, `topics`, `subscribers`, `messages`) +* Added: Models for ephemeral keys, mock numbers, email templates, policies, and per-provider OAuth2 settings +* Updated: `X-Appwrite-Response-Format` header to `1.9.3` + ## 11.0.0 * Breaking: Moved SMTP, email template, and all policy methods from `Projects` to `Project` service diff --git a/README.md b/README.md index a428d98c..61a3c80d 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.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.3-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/console/list-o-auth-2-providers.md b/docs/examples/console/list-o-auth-2-providers.md new file mode 100644 index 00000000..d26800b2 --- /dev/null +++ b/docs/examples/console/list-o-auth-2-providers.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.listOAuth2Providers(); + +console.log(result); +``` diff --git a/docs/examples/console/list-project-scopes.md b/docs/examples/console/list-project-scopes.md new file mode 100644 index 00000000..b1cb8034 --- /dev/null +++ b/docs/examples/console/list-project-scopes.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.listProjectScopes(); + +console.log(result); +``` diff --git a/docs/examples/domains/update-purchase.md b/docs/examples/domains/update-purchase.md index 2f3b6bed..b2165d20 100644 --- a/docs/examples/domains/update-purchase.md +++ b/docs/examples/domains/update-purchase.md @@ -8,7 +8,7 @@ const client = new Client() const domains = new Domains(client); const result = await domains.updatePurchase({ - domainId: '', + invoiceId: '', organizationId: '' }); diff --git a/docs/examples/domains/update-transfer-in.md b/docs/examples/domains/update-transfer-in.md index 9dc3e260..04ea5201 100644 --- a/docs/examples/domains/update-transfer-in.md +++ b/docs/examples/domains/update-transfer-in.md @@ -8,7 +8,7 @@ const client = new Client() const domains = new Domains(client); const result = await domains.updateTransferIn({ - domainId: '', + invoiceId: '', organizationId: '' }); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index b45b0a1b..5cd33258 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -19,7 +19,7 @@ const result = await functions.create({ logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [Scopes.SessionsWrite], // optional + scopes: [Scopes.ProjectRead], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index f6f90ed7..cb77dea1 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -19,7 +19,7 @@ const result = await functions.update({ logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [Scopes.SessionsWrite], // optional + scopes: [Scopes.ProjectRead], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/manager/create-block.md b/docs/examples/manager/create-block.md new file mode 100644 index 00000000..3515e471 --- /dev/null +++ b/docs/examples/manager/create-block.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Manager, ResourceType } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + +const manager = new Manager(client); + +const result = await manager.createBlock({ + projectId: '', + resourceType: ResourceType.Projects, + resourceId: '', // optional + reason: '', // optional + expiredAt: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/manager/delete-block.md b/docs/examples/manager/delete-block.md new file mode 100644 index 00000000..285eee03 --- /dev/null +++ b/docs/examples/manager/delete-block.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Manager, ResourceType } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + +const manager = new Manager(client); + +const result = await manager.deleteBlock({ + projectId: '', + resourceType: ResourceType.Projects, + resourceId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/manager/list-blocks.md b/docs/examples/manager/list-blocks.md new file mode 100644 index 00000000..0bdd5c10 --- /dev/null +++ b/docs/examples/manager/list-blocks.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Manager } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + +const manager = new Manager(client); + +const result = await manager.listBlocks({ + projectId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/manager/update-user-status.md b/docs/examples/manager/update-user-status.md new file mode 100644 index 00000000..34af5753 --- /dev/null +++ b/docs/examples/manager/update-user-status.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Manager } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + +const manager = new Manager(client); + +const result = await manager.updateUserStatus({ + status: false, + userId: '', // optional + email: '', // optional + reason: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/organizations/create-plan-estimation.md b/docs/examples/organizations/create-plan-estimation.md new file mode 100644 index 00000000..ee143ecc --- /dev/null +++ b/docs/examples/organizations/create-plan-estimation.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.createPlanEstimation({ + organizationId: '', + billingPlan: 'tier-0', + invites: [], // optional + couponId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..e1514f60 --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,16 @@ +```javascript +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 project = new Project(client); + +const result = await project.createEphemeralKey({ + scopes: [Scopes.ProjectRead], + duration: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 1e4ba017..362d4ca0 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -10,7 +10,7 @@ const project = new Project(client); const result = await project.createKey({ keyId: '', name: '', - scopes: [Scopes.SessionsWrite], + scopes: [Scopes.ProjectRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); diff --git a/docs/examples/projects/update-mock-numbers.md b/docs/examples/project/create-mock-phone.md similarity index 52% rename from docs/examples/projects/update-mock-numbers.md rename to docs/examples/project/create-mock-phone.md index 80099e15..eaf3dad6 100644 --- a/docs/examples/projects/update-mock-numbers.md +++ b/docs/examples/project/create-mock-phone.md @@ -1,15 +1,15 @@ ```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.updateMockNumbers({ - projectId: '', - numbers: [] +const result = await project.createMockPhone({ + number: '+12065550100', + otp: '' }); console.log(result); diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..598c56aa --- /dev/null +++ b/docs/examples/project/delete-mock-phone.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.deleteMockPhone({ + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..7e38d433 --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,13 @@ +```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.delete(); + +console.log(result); +``` diff --git a/docs/examples/projects/delete.md b/docs/examples/project/get-mock-phone.md similarity index 56% rename from docs/examples/projects/delete.md rename to docs/examples/project/get-mock-phone.md index 10819f63..938b5915 100644 --- a/docs/examples/projects/delete.md +++ b/docs/examples/project/get-mock-phone.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.delete({ - projectId: '' +const result = await project.getMockPhone({ + number: '+12065550100' }); console.log(result); diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..a667c820 --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.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.getOAuth2Provider({ + provider: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..be9b5151 --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project, PolicyId } 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.getPolicy({ + policyId: PolicyId.PasswordDictionary +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..ec206bf3 --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,16 @@ +```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.listEmailTemplates({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..d60a0570 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,16 @@ +```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.listMockPhones({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..f4e6545b --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,13 @@ +```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.listOAuth2Providers(); + +console.log(result); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..d1d84241 --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,16 @@ +```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.listPolicies({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..802d1d2b --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, MethodId } 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.updateAuthMethod({ + methodId: MethodId.EmailPassword, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 59aae489..3d3282d4 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -10,7 +10,7 @@ const project = new Project(client); const result = await project.updateKey({ keyId: '', name: '', - scopes: [Scopes.SessionsWrite], + scopes: [Scopes.ProjectRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..88204665 --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,16 @@ +```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.updateMockPhone({ + number: '+12065550100', + otp: '' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..41505151 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.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.updateOAuth2Amazon({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..088f42fa --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Apple({ + serviceId: '', // optional + keyId: '', // optional + teamId: '', // optional + p8File: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..aae061ce --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,18 @@ +```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.updateOAuth2Auth0({ + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..b59b7ced --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,18 @@ +```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.updateOAuth2Authentik({ + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..675caa2a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.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.updateOAuth2Autodesk({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/projects/update-o-auth-2.md b/docs/examples/project/update-o-auth-2-bitbucket.md similarity index 51% rename from docs/examples/projects/update-o-auth-2.md rename to docs/examples/project/update-o-auth-2-bitbucket.md index 74ba246a..98b39d67 100644 --- a/docs/examples/projects/update-o-auth-2.md +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -1,16 +1,14 @@ ```javascript -import { Client, Projects, OAuthProvider } 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.updateOAuth2({ - projectId: '', - provider: OAuthProvider.Amazon, - appId: '', // optional +const result = await project.updateOAuth2Bitbucket({ + key: '', // optional secret: '', // optional enabled: false // optional }); diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..572d6dcf --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.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.updateOAuth2Bitly({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..a3010c05 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.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.updateOAuth2Box({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..40912058 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.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.updateOAuth2Dailymotion({ + apiKey: '', // optional + apiSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..c289e4b4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.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.updateOAuth2Discord({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..b356ce7f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.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.updateOAuth2Disqus({ + publicKey: '', // optional + secretKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..f088118a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.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.updateOAuth2Dropbox({ + appKey: '', // optional + appSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..469c0a08 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.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.updateOAuth2Etsy({ + keyString: '', // optional + sharedSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..1af18fbd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.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.updateOAuth2Facebook({ + appId: '', // optional + appSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..e1b35875 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.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.updateOAuth2Figma({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..da29e909 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,18 @@ +```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.updateOAuth2FusionAuth({ + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..f1dbb617 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.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.updateOAuth2GitHub({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..5191d013 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,18 @@ +```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.updateOAuth2Gitlab({ + applicationId: '', // optional + secret: '', // optional + endpoint: 'https://example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..a6d2cbf6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.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.updateOAuth2Google({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..7121691d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Keycloak({ + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + realmName: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..1bf99d6b --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.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.updateOAuth2Kick({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..2ba49a51 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.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.updateOAuth2Linkedin({ + clientId: '', // optional + primaryClientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..3e10286a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,18 @@ +```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.updateOAuth2Microsoft({ + applicationId: '', // optional + applicationSecret: '', // optional + tenant: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..7c9c0f09 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.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.updateOAuth2Notion({ + oauthClientId: '', // optional + oauthClientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..29b8536e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,21 @@ +```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.updateOAuth2Oidc({ + clientId: '', // optional + clientSecret: '', // optional + wellKnownURL: 'https://example.com', // optional + authorizationURL: 'https://example.com', // optional + tokenUrl: 'https://example.com', // optional + userInfoUrl: 'https://example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..6621728e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Okta({ + clientId: '', // optional + clientSecret: '', // optional + domain: '', // optional + authorizationServerId: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..d69e3e05 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.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.updateOAuth2PaypalSandbox({ + clientId: '', // optional + secretKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..4e41a324 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.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.updateOAuth2Paypal({ + clientId: '', // optional + secretKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..247b96cc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.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.updateOAuth2Podio({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..8472e309 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.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.updateOAuth2Salesforce({ + customerKey: '', // optional + customerSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..7258f278 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.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.updateOAuth2Slack({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..796fd5cb --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.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.updateOAuth2Spotify({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..6faf6dc1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.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.updateOAuth2Stripe({ + clientId: '', // optional + apiSecretKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..d7eabe6e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.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.updateOAuth2TradeshiftSandbox({ + oauth2ClientId: '', // optional + oauth2ClientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..90a18465 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.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.updateOAuth2Tradeshift({ + oauth2ClientId: '', // optional + oauth2ClientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..0fc86b17 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.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.updateOAuth2Twitch({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..1925bdd2 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.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.updateOAuth2WordPress({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..07af9e12 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.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.updateOAuth2Yahoo({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..b43566b7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.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.updateOAuth2Yandex({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..f0113d05 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.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.updateOAuth2Zoho({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..531a66a6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.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.updateOAuth2Zoom({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..8510e6e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.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.updateOAuth2X({ + customerKey: '', // optional + secretKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/projects/create-jwt.md b/docs/examples/projects/create-jwt.md deleted file mode 100644 index 2c8929c9..00000000 --- a/docs/examples/projects/create-jwt.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Projects, 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 result = await projects.createJWT({ - projectId: '', - scopes: [Scopes.SessionsWrite], - duration: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/projects/update-auth-status.md b/docs/examples/projects/update-auth-status.md deleted file mode 100644 index a36fdc3e..00000000 --- a/docs/examples/projects/update-auth-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Projects, AuthMethod } 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.updateAuthStatus({ - projectId: '', - method: AuthMethod.EmailPassword, - status: false -}); - -console.log(result); -``` diff --git a/package-lock.json b/package-lock.json index f9eb6bcd..a88f3328 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "11.0.0", + "version": "12.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "11.0.0", + "version": "12.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index e2bf0ec0..a03c30b8 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": "11.0.0", + "version": "12.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 3b38e030..b138f109 100644 --- a/src/client.ts +++ b/src/client.ts @@ -388,8 +388,8 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '11.0.0', - 'X-Appwrite-Response-Format': '1.9.2', + 'x-sdk-version': '12.0.0', + 'X-Appwrite-Response-Format': '1.9.3', }; /** diff --git a/src/enums/appwrite-migration-resource.ts b/src/enums/appwrite-migration-resource.ts index bd3a26bc..71acb705 100644 --- a/src/enums/appwrite-migration-resource.ts +++ b/src/enums/appwrite-migration-resource.ts @@ -24,4 +24,5 @@ export enum AppwriteMigrationResource { Site = 'site', Sitedeployment = 'site-deployment', Sitevariable = 'site-variable', + Backuppolicy = 'backup-policy', } \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index 6aea9aa5..1466d635 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -79,6 +79,7 @@ export enum BuildRuntime { Go124 = 'go-1.24', Go125 = 'go-1.25', Go126 = 'go-1.26', + Rust183 = 'rust-1.83', Static1 = 'static-1', Flutter324 = 'flutter-3.24', Flutter327 = 'flutter-3.27', diff --git a/src/enums/auth-method.ts b/src/enums/method-id.ts similarity index 88% rename from src/enums/auth-method.ts rename to src/enums/method-id.ts index d5800ad9..062d0d0e 100644 --- a/src/enums/auth-method.ts +++ b/src/enums/method-id.ts @@ -1,4 +1,4 @@ -export enum AuthMethod { +export enum MethodId { Emailpassword = 'email-password', Magicurl = 'magic-url', Emailotp = 'email-otp', diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index efc44844..cc9e340b 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -14,9 +14,12 @@ export enum OAuthProvider { Etsy = 'etsy', Facebook = 'facebook', Figma = 'figma', + Fusionauth = 'fusionauth', Github = 'github', Gitlab = 'gitlab', Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', Linkedin = 'linkedin', Microsoft = 'microsoft', Notion = 'notion', diff --git a/src/enums/policy-id.ts b/src/enums/policy-id.ts new file mode 100644 index 00000000..ab1c4cd2 --- /dev/null +++ b/src/enums/policy-id.ts @@ -0,0 +1,11 @@ +export enum PolicyId { + Passworddictionary = 'password-dictionary', + Passwordhistory = 'password-history', + Passwordpersonaldata = 'password-personal-data', + Sessionalert = 'session-alert', + Sessionduration = 'session-duration', + Sessioninvalidation = 'session-invalidation', + Sessionlimit = 'session-limit', + Userlimit = 'user-limit', + Membershipprivacy = 'membership-privacy', +} \ No newline at end of file diff --git a/src/enums/resource-type.ts b/src/enums/resource-type.ts index 39ebca7e..b1f8e6d7 100644 --- a/src/enums/resource-type.ts +++ b/src/enums/resource-type.ts @@ -1,4 +1,13 @@ export enum ResourceType { + Projects = 'projects', + Functions = 'functions', + Sites = 'sites', + Databases = 'databases', + Buckets = 'buckets', + Providers = 'providers', + Topics = 'topics', + Subscribers = 'subscribers', + Messages = 'messages', Function = 'function', Execution = 'execution', Message = 'message', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 3a57958b..f4d20688 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -79,6 +79,7 @@ export enum Runtime { Go124 = 'go-1.24', Go125 = 'go-1.25', Go126 = 'go-1.26', + Rust183 = 'rust-1.83', Static1 = 'static-1', Flutter324 = 'flutter-3.24', Flutter327 = 'flutter-3.27', diff --git a/src/enums/runtimes.ts b/src/enums/runtimes.ts index 69451ed7..22ed5856 100644 --- a/src/enums/runtimes.ts +++ b/src/enums/runtimes.ts @@ -79,6 +79,7 @@ export enum Runtimes { Go124 = 'go-1.24', Go125 = 'go-1.25', Go126 = 'go-1.26', + Rust183 = 'rust-1.83', Static1 = 'static-1', Flutter324 = 'flutter-3.24', Flutter327 = 'flutter-3.27', diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 6c73126f..a63d6c94 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -2,73 +2,80 @@ export enum Scopes { Account = 'account', TeamsRead = 'teams.read', TeamsWrite = 'teams.write', - SessionsWrite = 'sessions.write', + ProjectRead = 'project.read', + ProjectWrite = 'project.write', + KeysRead = 'keys.read', + KeysWrite = 'keys.write', + PlatformsRead = 'platforms.read', + PlatformsWrite = 'platforms.write', + MocksRead = 'mocks.read', + MocksWrite = 'mocks.write', + PoliciesRead = 'policies.read', + PoliciesWrite = 'policies.write', + TemplatesRead = 'templates.read', + TemplatesWrite = 'templates.write', + Oauth2Read = 'oauth2.read', + Oauth2Write = 'oauth2.write', UsersRead = 'users.read', UsersWrite = 'users.write', + SessionsRead = 'sessions.read', + SessionsWrite = 'sessions.write', DatabasesRead = 'databases.read', DatabasesWrite = 'databases.write', - CollectionsRead = 'collections.read', - CollectionsWrite = 'collections.write', TablesRead = 'tables.read', TablesWrite = 'tables.write', - AttributesRead = 'attributes.read', - AttributesWrite = 'attributes.write', ColumnsRead = 'columns.read', ColumnsWrite = 'columns.write', IndexesRead = 'indexes.read', IndexesWrite = 'indexes.write', - DocumentsRead = 'documents.read', - DocumentsWrite = 'documents.write', RowsRead = 'rows.read', RowsWrite = 'rows.write', - FilesRead = 'files.read', - FilesWrite = 'files.write', + CollectionsRead = 'collections.read', + CollectionsWrite = 'collections.write', + AttributesRead = 'attributes.read', + AttributesWrite = 'attributes.write', + DocumentsRead = 'documents.read', + DocumentsWrite = 'documents.write', BucketsRead = 'buckets.read', BucketsWrite = 'buckets.write', + FilesRead = 'files.read', + FilesWrite = 'files.write', + TokensRead = 'tokens.read', + TokensWrite = 'tokens.write', FunctionsRead = 'functions.read', FunctionsWrite = 'functions.write', + ExecutionsRead = 'executions.read', + ExecutionsWrite = 'executions.write', + ExecutionRead = 'execution.read', + ExecutionWrite = 'execution.write', SitesRead = 'sites.read', SitesWrite = 'sites.write', LogRead = 'log.read', LogWrite = 'log.write', - ExecutionRead = 'execution.read', - ExecutionWrite = 'execution.write', - LocaleRead = 'locale.read', - AvatarsRead = 'avatars.read', - HealthRead = 'health.read', ProvidersRead = 'providers.read', ProvidersWrite = 'providers.write', - MessagesRead = 'messages.read', - MessagesWrite = 'messages.write', TopicsRead = 'topics.read', TopicsWrite = 'topics.write', SubscribersRead = 'subscribers.read', SubscribersWrite = 'subscribers.write', TargetsRead = 'targets.read', TargetsWrite = 'targets.write', - RulesRead = 'rules.read', - RulesWrite = 'rules.write', - SchedulesRead = 'schedules.read', - SchedulesWrite = 'schedules.write', + MessagesRead = 'messages.read', + MessagesWrite = 'messages.write', + WebhooksRead = 'webhooks.read', + WebhooksWrite = 'webhooks.write', + LocaleRead = 'locale.read', + AvatarsRead = 'avatars.read', + HealthRead = 'health.read', + AssistantRead = 'assistant.read', MigrationsRead = 'migrations.read', MigrationsWrite = 'migrations.write', + SchedulesRead = 'schedules.read', + SchedulesWrite = 'schedules.write', VcsRead = 'vcs.read', VcsWrite = 'vcs.write', - AssistantRead = 'assistant.read', - TokensRead = 'tokens.read', - TokensWrite = 'tokens.write', - WebhooksRead = 'webhooks.read', - WebhooksWrite = 'webhooks.write', - ProjectRead = 'project.read', - ProjectWrite = 'project.write', - KeysRead = 'keys.read', - KeysWrite = 'keys.write', - PlatformsRead = 'platforms.read', - PlatformsWrite = 'platforms.write', - PoliciesWrite = 'policies.write', - TemplatesRead = 'templates.read', - TemplatesWrite = 'templates.write', - PoliciesRead = 'policies.read', + RulesRead = 'rules.read', + RulesWrite = 'rules.write', ArchivesRead = 'archives.read', ArchivesWrite = 'archives.write', RestorationsRead = 'restorations.read', diff --git a/src/index.ts b/src/index.ts index 0edb6c42..5bbf61e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Health } from './services/health'; export { Locale } from './services/locale'; +export { Manager } from './services/manager'; export { Messaging } from './services/messaging'; export { Migrations } from './services/migrations'; export { Organizations } from './services/organizations'; @@ -73,6 +74,7 @@ export { VCSReferenceType } from './enums/vcs-reference-type'; export { DeploymentDownloadType } from './enums/deployment-download-type'; export { ExecutionMethod } from './enums/execution-method'; export { Name } from './enums/name'; +export { ResourceType } from './enums/resource-type'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; export { AppwriteMigrationResource } from './enums/appwrite-migration-resource'; @@ -80,6 +82,8 @@ 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 { MethodId } from './enums/method-id'; +export { PolicyId } from './enums/policy-id'; export { ProtocolId } from './enums/protocol-id'; export { ServiceId } from './enums/service-id'; export { Secure } from './enums/secure'; @@ -87,8 +91,6 @@ export { EmailTemplateType } from './enums/email-template-type'; export { EmailTemplateLocale } from './enums/email-template-locale'; export { ProjectUsageRange } from './enums/project-usage-range'; export { Region } from './enums/region'; -export { AuthMethod } from './enums/auth-method'; -export { ResourceType } from './enums/resource-type'; export { Status } from './enums/status'; export { StatusCode } from './enums/status-code'; export { ProxyResourceType } from './enums/proxy-resource-type'; diff --git a/src/models.ts b/src/models.ts index aa4448cf..cf07e8ed 100644 --- a/src/models.ts +++ b/src/models.ts @@ -564,6 +564,48 @@ export namespace Models { variables: Variable[]; } + /** + * Mock Numbers List + */ + export type MockNumberList = { + /** + * Total number of mockNumbers that matched your query. + */ + total: number; + /** + * List of mockNumbers. + */ + mockNumbers: MockNumber[]; + } + + /** + * Policies List + */ + export type PolicyList = { + /** + * Total number of policies in the given project. + */ + total: number; + /** + * List of policies. + */ + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + } + + /** + * Email Templates List + */ + export type EmailTemplateList = { + /** + * Total number of templates that matched your query. + */ + total: number; + /** + * List of templates. + */ + templates: EmailTemplate[]; + } + /** * Status List */ @@ -5324,9 +5366,9 @@ export namespace Models { } /** - * DevKey + * Ephemeral Key */ - export type DevKey = { + export type EphemeralKey = { /** * Key ID. */ @@ -5347,6 +5389,10 @@ export namespace Models { * Key expiration date in ISO 8601 format. */ expire: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; /** * Secret key. */ @@ -5362,305 +5408,1447 @@ export namespace Models { } /** - * Mock Number + * DevKey */ - export type MockNumber = { + export type DevKey = { /** - * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. + * Key ID. */ - phone: string; + $id: string; /** - * Mock OTP for the number. + * Key creation date in ISO 8601 format. */ - otp: string; - } - - /** - * AuthProvider - */ - export type AuthProvider = { + $createdAt: string; /** - * Auth Provider. + * Key update date in ISO 8601 format. */ - key: string; + $updatedAt: string; /** - * Auth Provider name. + * Key name. */ name: string; /** - * OAuth 2.0 application ID. + * Key expiration date in ISO 8601 format. */ - appId: string; + expire: string; /** - * OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. + * Secret key. */ secret: string; /** - * Auth Provider is active and can be used to create session. + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. */ - enabled: boolean; + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; } /** - * Platform Web + * Mock Number */ - export type PlatformWeb = { + export type MockNumber = { /** - * Platform ID. + * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. */ - $id: string; + number: string; /** - * Platform creation date in ISO 8601 format. + * Mock OTP for the number. + */ + otp: string; + /** + * Attribute creation date in ISO 8601 format. */ $createdAt: string; /** - * Platform update date in ISO 8601 format. + * Attribute update date in ISO 8601 format. */ $updatedAt: string; + } + + /** + * OAuth2GitHub + */ + export type OAuth2Github = { /** - * Platform name. + * OAuth2 provider ID. */ - name: string; + $id: string; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * OAuth2 provider is active and can be used to create sessions. */ - type: PlatformType; + enabled: boolean; /** - * Web app hostname. Empty string for other platforms. + * GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. */ - hostname: string; + clientId: string; + /** + * GitHub OAuth2 client secret. + */ + clientSecret: string; } /** - * Platform Apple + * OAuth2Discord */ - export type PlatformApple = { + export type OAuth2Discord = { /** - * Platform ID. + * OAuth2 provider ID. */ $id: string; /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. + * OAuth2 provider is active and can be used to create sessions. */ - name: string; + enabled: boolean; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Discord OAuth2 client ID. */ - type: PlatformType; + clientId: string; /** - * Apple bundle identifier. + * Discord OAuth2 client secret. */ - bundleIdentifier: string; + clientSecret: string; } /** - * Platform Android + * OAuth2Figma */ - export type PlatformAndroid = { + export type OAuth2Figma = { /** - * Platform ID. + * OAuth2 provider ID. */ $id: string; /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. + * OAuth2 provider is active and can be used to create sessions. */ - name: string; + enabled: boolean; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Figma OAuth2 client ID. */ - type: PlatformType; + clientId: string; /** - * Android application ID. + * Figma OAuth2 client secret. */ - applicationId: string; + clientSecret: string; } /** - * Platform Windows + * OAuth2Dropbox */ - export type PlatformWindows = { + export type OAuth2Dropbox = { /** - * Platform ID. + * OAuth2 provider ID. */ $id: string; /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. + * OAuth2 provider is active and can be used to create sessions. */ - name: string; + enabled: boolean; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Dropbox OAuth2 app key. */ - type: PlatformType; + appKey: string; /** - * Windows package identifier name. + * Dropbox OAuth2 app secret. */ - packageIdentifierName: string; + appSecret: string; } /** - * Platform Linux + * OAuth2Dailymotion */ - export type PlatformLinux = { + export type OAuth2Dailymotion = { /** - * Platform ID. + * OAuth2 provider ID. */ $id: string; /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. + * OAuth2 provider is active and can be used to create sessions. */ - name: string; + enabled: boolean; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Dailymotion OAuth2 API key. */ - type: PlatformType; + apiKey: string; /** - * Linux package name. + * Dailymotion OAuth2 API secret. */ - packageName: string; + apiSecret: string; } /** - * Platforms List + * OAuth2Bitbucket */ - export type PlatformList = { + export type OAuth2Bitbucket = { /** - * Total number of platforms in the given project. + * OAuth2 provider ID. */ - total: number; + $id: string; /** - * List of platforms. + * OAuth2 provider is active and can be used to create sessions. */ - platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; + enabled: boolean; + /** + * Bitbucket OAuth2 key. + */ + key: string; + /** + * Bitbucket OAuth2 secret. + */ + secret: string; } /** - * Variable + * OAuth2Bitly */ - export type Variable = { + export type OAuth2Bitly = { /** - * Variable ID. + * OAuth2 provider ID. */ $id: string; /** - * Variable creation date in ISO 8601 format. + * OAuth2 provider is active and can be used to create sessions. */ - $createdAt: string; + enabled: boolean; /** - * Variable creation date in ISO 8601 format. + * Bitly OAuth2 client ID. */ - $updatedAt: string; + clientId: string; /** - * Variable key. + * Bitly OAuth2 client secret. */ - key: string; + clientSecret: string; + } + + /** + * OAuth2Box + */ + export type OAuth2Box = { /** - * Variable value. + * OAuth2 provider ID. */ - value: string; + $id: string; /** - * Variable secret flag. Secret variables can only be updated or deleted, but never read. + * OAuth2 provider is active and can be used to create sessions. */ - secret: boolean; + enabled: boolean; /** - * Service to which the variable belongs. Possible values are "project", "function" + * Box OAuth2 client ID. */ - resourceType: string; + clientId: string; /** - * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + * Box OAuth2 client secret. */ - resourceId: string; + clientSecret: string; } /** - * Country + * OAuth2Autodesk */ - export type Country = { + export type OAuth2Autodesk = { /** - * Country name. + * OAuth2 provider ID. */ - name: string; + $id: string; /** - * Country two-character ISO 3166-1 alpha code. + * OAuth2 provider is active and can be used to create sessions. */ - code: string; - } - - /** - * Continent - */ - export type Continent = { + enabled: boolean; /** - * Continent name. + * Autodesk OAuth2 client ID. */ - name: string; + clientId: string; /** - * Continent two letter code. + * Autodesk OAuth2 client secret. */ - code: string; + clientSecret: string; } /** - * Language + * OAuth2Google */ - export type Language = { + export type OAuth2Google = { /** - * Language name. + * OAuth2 provider ID. */ - name: string; + $id: string; /** - * Language two-character ISO 639-1 codes. + * OAuth2 provider is active and can be used to create sessions. */ - code: string; + enabled: boolean; /** - * Language native name. + * Google OAuth2 client ID. */ - nativeName: string; + clientId: string; + /** + * Google OAuth2 client secret. + */ + clientSecret: string; } /** - * Currency + * OAuth2Zoom */ - export type Currency = { + export type OAuth2Zoom = { /** - * Currency symbol. + * OAuth2 provider ID. */ - symbol: string; + $id: string; /** - * Currency name. + * OAuth2 provider is active and can be used to create sessions. */ - name: string; + enabled: boolean; + /** + * Zoom OAuth2 client ID. + */ + clientId: string; + /** + * Zoom OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Zoho + */ + export type OAuth2Zoho = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Zoho OAuth2 client ID. + */ + clientId: string; + /** + * Zoho OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Yandex + */ + export type OAuth2Yandex = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yandex OAuth2 client ID. + */ + clientId: string; + /** + * Yandex OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2X + */ + export type OAuth2X = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * X OAuth2 customer key. + */ + customerKey: string; + /** + * X OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2WordPress + */ + export type OAuth2WordPress = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * WordPress OAuth2 client ID. + */ + clientId: string; + /** + * WordPress OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Twitch + */ + export type OAuth2Twitch = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Twitch OAuth2 client ID. + */ + clientId: string; + /** + * Twitch OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Stripe + */ + export type OAuth2Stripe = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Stripe OAuth2 client ID. + */ + clientId: string; + /** + * Stripe OAuth2 API secret key. + */ + apiSecretKey: string; + } + + /** + * OAuth2Spotify + */ + export type OAuth2Spotify = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Spotify OAuth2 client ID. + */ + clientId: string; + /** + * Spotify OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Slack + */ + export type OAuth2Slack = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Slack OAuth2 client ID. + */ + clientId: string; + /** + * Slack OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Podio + */ + export type OAuth2Podio = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Podio OAuth2 client ID. + */ + clientId: string; + /** + * Podio OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Notion + */ + export type OAuth2Notion = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Notion OAuth2 client ID. + */ + oauthClientId: string; + /** + * Notion OAuth2 client secret. + */ + oauthClientSecret: string; + } + + /** + * OAuth2Salesforce + */ + export type OAuth2Salesforce = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Salesforce OAuth2 consumer key. + */ + customerKey: string; + /** + * Salesforce OAuth2 consumer secret. + */ + customerSecret: string; + } + + /** + * OAuth2Yahoo + */ + export type OAuth2Yahoo = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yahoo OAuth2 client ID. + */ + clientId: string; + /** + * Yahoo OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Linkedin + */ + export type OAuth2Linkedin = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * LinkedIn OAuth2 client ID. + */ + clientId: string; + /** + * LinkedIn OAuth2 primary client secret. + */ + primaryClientSecret: string; + } + + /** + * OAuth2Disqus + */ + export type OAuth2Disqus = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Disqus OAuth2 public key. + */ + publicKey: string; + /** + * Disqus OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Amazon + */ + export type OAuth2Amazon = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Amazon OAuth2 client ID. + */ + clientId: string; + /** + * Amazon OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Etsy + */ + export type OAuth2Etsy = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Etsy OAuth2 keystring. + */ + keyString: string; + /** + * Etsy OAuth2 shared secret. + */ + sharedSecret: string; + } + + /** + * OAuth2Facebook + */ + export type OAuth2Facebook = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Facebook OAuth2 app ID. + */ + appId: string; + /** + * Facebook OAuth2 app secret. + */ + appSecret: string; + } + + /** + * OAuth2Tradeshift + */ + export type OAuth2Tradeshift = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Tradeshift OAuth2 client ID. + */ + oauth2ClientId: string; + /** + * Tradeshift OAuth2 client secret. + */ + oauth2ClientSecret: string; + } + + /** + * OAuth2Paypal + */ + export type OAuth2Paypal = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * PayPal OAuth2 client ID. + */ + clientId: string; + /** + * PayPal OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Gitlab + */ + export type OAuth2Gitlab = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * GitLab OAuth2 application ID. + */ + applicationId: string; + /** + * GitLab OAuth2 secret. + */ + secret: string; + /** + * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + */ + endpoint: string; + } + + /** + * OAuth2Authentik + */ + export type OAuth2Authentik = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Authentik OAuth2 client ID. + */ + clientId: string; + /** + * Authentik OAuth2 client secret. + */ + clientSecret: string; + /** + * Authentik OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Auth0 + */ + export type OAuth2Auth0 = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Auth0 OAuth2 client ID. + */ + clientId: string; + /** + * Auth0 OAuth2 client secret. + */ + clientSecret: string; + /** + * Auth0 OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2FusionAuth + */ + export type OAuth2FusionAuth = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * FusionAuth OAuth2 client ID. + */ + clientId: string; + /** + * FusionAuth OAuth2 client secret. + */ + clientSecret: string; + /** + * FusionAuth OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Keycloak + */ + export type OAuth2Keycloak = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Keycloak OAuth2 client ID. + */ + clientId: string; + /** + * Keycloak OAuth2 client secret. + */ + clientSecret: string; + /** + * Keycloak OAuth2 endpoint domain. + */ + endpoint: string; + /** + * Keycloak OAuth2 realm name. + */ + realmName: string; + } + + /** + * OAuth2Oidc + */ + export type OAuth2Oidc = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * OpenID Connect OAuth2 client ID. + */ + clientId: string; + /** + * OpenID Connect OAuth2 client secret. + */ + clientSecret: string; + /** + * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + */ + wellKnownURL: string; + /** + * OpenID Connect authorization endpoint URL. + */ + authorizationURL: string; + /** + * OpenID Connect token endpoint URL. + */ + tokenUrl: string; + /** + * OpenID Connect user info endpoint URL. + */ + userInfoUrl: string; + } + + /** + * OAuth2Okta + */ + export type OAuth2Okta = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Okta OAuth2 client ID. + */ + clientId: string; + /** + * Okta OAuth2 client secret. + */ + clientSecret: string; + /** + * Okta OAuth2 domain. + */ + domain: string; + /** + * Okta OAuth2 authorization server ID. + */ + authorizationServerId: string; + } + + /** + * OAuth2Kick + */ + export type OAuth2Kick = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Kick OAuth2 client ID. + */ + clientId: string; + /** + * Kick OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Apple + */ + export type OAuth2Apple = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Apple OAuth2 service ID. + */ + serviceId: string; + /** + * Apple OAuth2 key ID. + */ + keyId: string; + /** + * Apple OAuth2 team ID. + */ + teamId: string; + /** + * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + */ + p8File: string; + } + + /** + * OAuth2Microsoft + */ + export type OAuth2Microsoft = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Microsoft OAuth2 application ID. + */ + applicationId: string; + /** + * Microsoft OAuth2 application secret. + */ + applicationSecret: string; + /** + * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + */ + tenant: string; + } + + /** + * OAuth2 Providers List + */ + export type OAuth2ProviderList = { + /** + * Total number of OAuth2 providers in the given project. + */ + total: number; + /** + * List of OAuth2 providers. + */ + providers: (Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; + } + + /** + * Policy Password Dictionary + */ + export type PolicyPasswordDictionary = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password dictionary policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Password History + */ + export type PolicyPasswordHistory = { + /** + * Policy ID. + */ + $id: string; + /** + * Password history length. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Password Personal Data + */ + export type PolicyPasswordPersonalData = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password personal data policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Alert + */ + export type PolicySessionAlert = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session alert policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Duration + */ + export type PolicySessionDuration = { + /** + * Policy ID. + */ + $id: string; + /** + * Session duration in seconds. + */ + duration: number; + } + + /** + * Policy Session Invalidation + */ + export type PolicySessionInvalidation = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session invalidation policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Limit + */ + export type PolicySessionLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy User Limit + */ + export type PolicyUserLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Membership Privacy + */ + export type PolicyMembershipPrivacy = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether user ID is visible in memberships. + */ + userId: boolean; + /** + * Whether user email is visible in memberships. + */ + userEmail: boolean; + /** + * Whether user phone is visible in memberships. + */ + userPhone: boolean; + /** + * Whether user name is visible in memberships. + */ + userName: boolean; + /** + * Whether user MFA status is visible in memberships. + */ + userMFA: boolean; + } + + /** + * AuthProvider + */ + export type AuthProvider = { + /** + * Auth Provider. + */ + key: string; + /** + * Auth Provider name. + */ + name: string; + /** + * OAuth 2.0 application ID. + */ + appId: string; + /** + * OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. + */ + secret: string; + /** + * Auth Provider is active and can be used to create session. + */ + enabled: boolean; + } + + /** + * Platform Web + */ + export type PlatformWeb = { + /** + * 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; + /** + * Web app hostname. Empty string for other platforms. + */ + hostname: string; + } + + /** + * Platform Apple + */ + export type PlatformApple = { + /** + * 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; + /** + * 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)[]; + } + + /** + * Variable + */ + export type Variable = { + /** + * Variable ID. + */ + $id: string; + /** + * Variable creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Variable creation date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Variable key. + */ + key: string; + /** + * Variable value. + */ + value: string; + /** + * Variable secret flag. Secret variables can only be updated or deleted, but never read. + */ + secret: boolean; + /** + * Service to which the variable belongs. Possible values are "project", "function" + */ + resourceType: string; + /** + * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + */ + resourceId: string; + } + + /** + * Country + */ + export type Country = { + /** + * Country name. + */ + name: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + code: string; + } + + /** + * Continent + */ + export type Continent = { + /** + * Continent name. + */ + name: string; + /** + * Continent two letter code. + */ + code: string; + } + + /** + * Language + */ + export type Language = { + /** + * Language name. + */ + name: string; + /** + * Language two-character ISO 639-1 codes. + */ + code: string; + /** + * Language native name. + */ + nativeName: string; + } + + /** + * Currency + */ + export type Currency = { + /** + * Currency symbol. + */ + symbol: string; + /** + * Currency name. + */ + name: string; /** * Currency native symbol. */ @@ -7175,6 +8363,92 @@ export namespace Models { _APP_CONSOLE_EMAIL_VERIFICATION: string; } + /** + * Console OAuth2 Provider Parameter + */ + export type ConsoleOAuth2ProviderParameter = { + /** + * Parameter ID. Maps to the request body field used by the project OAuth2 update endpoint (e.g. `clientId`, `appKey`, `tenant`). + */ + $id: string; + /** + * Verbose, user-facing parameter name as shown in the provider's own dashboard. Includes alternate names when the provider exposes more than one. + */ + name: string; + /** + * Example value for this parameter. + */ + example: string; + /** + * Optional hint for this parameter, typically calling out a common wrong value. Empty string when no hint is set. + */ + hint: string; + } + + /** + * Console OAuth2 Provider + */ + export type ConsoleOAuth2Provider = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * List of parameters required to configure this OAuth2 provider. + */ + parameters: ConsoleOAuth2ProviderParameter[]; + } + + /** + * Console OAuth2 Providers List + */ + export type ConsoleOAuth2ProviderList = { + /** + * Total number of OAuth2 providers exposed by the server. + */ + total: number; + /** + * List of OAuth2 providers, each with the parameters required to configure it. + */ + oAuth2Providers: ConsoleOAuth2Provider[]; + } + + /** + * Console Key Scope + */ + export type ConsoleKeyScope = { + /** + * Scope ID. + */ + $id: string; + /** + * Scope description. + */ + description: string; + /** + * Scope category. + */ + category: string; + /** + * Scope is deprecated. + */ + deprecated: boolean; + } + + /** + * Console Key Scopes List + */ + export type ConsoleKeyScopeList = { + /** + * Total number of key scopes exposed by the server. + */ + total: number; + /** + * List of key scopes, each with its ID and description. + */ + scopes: ConsoleKeyScope[]; + } + /** * MFA Challenge */ @@ -8415,6 +9689,40 @@ export namespace Models { * Block expiration date in ISO 8601 format. Can be null if the block does not expire. */ expiredAt?: string; + /** + * Name of the project this block applies to. + */ + projectName: string; + /** + * Region of the project this block applies to. + */ + region: string; + /** + * Name of the organization that owns the project. + */ + organizationName: string; + /** + * ID of the organization that owns the project. + */ + organizationId: string; + /** + * Billing plan of the organization that owns the project. + */ + billingPlan: string; + } + + /** + * BlockDelete + */ + export type BlockDelete = { + /** + * Number of blocks deleted + */ + deleted: number; + /** + * List of deleted blocks + */ + blocks: Block[]; } /** @@ -8751,6 +10059,10 @@ export namespace Models { * Invoice status */ status: string; + /** + * Invoice type. Can be one of `subscription`, `domain_purchase`, `domain_renewal`, `domain_transfer`, or `addon_*`. + */ + type: string; /** * Last payment error associated with the invoice */ @@ -9735,6 +11047,156 @@ export namespace Models { organizationCredits: number; } + /** + * EstimationPlanChange + */ + export type EstimationPlanChange = { + /** + * Current billing plan ID + */ + currentBillingPlanId: string; + /** + * Target billing plan ID + */ + targetBillingPlanId: string; + /** + * Direction of plan change: upgrade, downgrade, or same + */ + direction: string; + /** + * Cost estimation details + */ + estimation: PlanChangeEstimationDetails; + /** + * Plan limits and compliance information + */ + limits: PlanChangeLimits; + } + + /** + * PlanChangeEstimationDetails + */ + export type PlanChangeEstimationDetails = { + /** + * Currency code + */ + currency: string; + /** + * Gross amount after all discounts and credits + */ + grossAmount: number; + /** + * Credits applied from coupon + */ + credits: number; + /** + * Organization's existing credits applied + */ + organizationCredits: number; + /** + * Discount amount from prorated invoices + */ + discount: number; + /** + * Total amount before discounts and credits + */ + amount: number; + /** + * Next invoice date + */ + nextInvoiceDate: string; + /** + * Line items breakdown + */ + items: object; + /** + * Applied discounts breakdown + */ + discounts: object; + } + + /** + * PlanChangeLimits + */ + export type PlanChangeLimits = { + /** + * Total number of projects in the organization + */ + totalProjects: number; + /** + * Number of projects exceeding target plan limits + */ + nonCompliantProjects: number; + /** + * Whether the plan change is allowed + */ + canChangePlan: boolean; + /** + * Project compliance details + */ + projects: PlanChangeProjectCompliance[]; + /** + * Active addon keys that the target plan does not support. When non-empty, `canChangePlan` is false. + */ + unsupportedAddons: string[]; + } + + /** + * PlanChangeProjectCompliance + */ + export type PlanChangeProjectCompliance = { + /** + * Project ID + */ + $id: string; + /** + * Project name + */ + name: string; + /** + * Whether the project complies with target plan limits + */ + isCompliant: boolean; + /** + * Resource compliance details + */ + resources: PlanChangeResourceCompliance[]; + /** + * Failure reason when compliance could not be evaluated. Present only when the project DB or Regions API was unreachable; in that case `isCompliant` is false (fail closed) and `resources` is empty. + */ + error?: string; + } + + /** + * PlanChangeResourceCompliance + */ + export type PlanChangeResourceCompliance = { + /** + * Resource type + */ + type: string; + /** + * Current usage count + */ + currentUsage: number; + /** + * Allowed limit in target plan + */ + limit: number; + /** + * Compliance status + */ + status: string; + /** + * Number of resources exceeding the limit + */ + excess: number; + /** + * Suggestion for resolving the compliance issue + */ + resolutionHint: string; + } + /** * EstimationDeleteOrganization */ @@ -10077,6 +11539,20 @@ export namespace Models { paymentMethods: PaymentMethod[]; } + /** + * Blocks list + */ + export type BlockList = { + /** + * Total number of blocks that matched your query. + */ + total: number; + /** + * List of blocks. + */ + blocks: Block[]; + } + /** * Regions list */ diff --git a/src/services/account.ts b/src/services/account.ts index f9cccb68..e9ef3ae9 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, x, 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, fusionauth, github, gitlab, google, keycloak, kick, 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, x, 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, fusionauth, github, gitlab, google, keycloak, kick, 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, x, 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, fusionauth, github, gitlab, google, keycloak, kick, 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, x, 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, fusionauth, github, gitlab, google, keycloak, kick, 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/console.ts b/src/services/console.ts index 0fc2a968..6648e350 100644 --- a/src/services/console.ts +++ b/src/services/console.ts @@ -114,6 +114,29 @@ export class Console { ); } + /** + * List all OAuth2 providers supported by the Appwrite server, along with the parameters required to configure each provider. The response excludes mock providers but includes sandbox providers. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listOAuth2Providers(): Promise { + + const apiPath = '/console/oauth2-providers'; + 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 + ); + } + /** * Return a list of all available plans. * @@ -407,6 +430,29 @@ export class Console { ); } + /** + * List all scopes available for project API keys, along with a description for each scope. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listProjectScopes(): Promise { + + const apiPath = '/console/scopes/project'; + 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 + ); + } + /** * Create a new source. * diff --git a/src/services/domains.ts b/src/services/domains.ts index 6277582f..d364ca02 100644 --- a/src/services/domains.ts +++ b/src/services/domains.ts @@ -363,48 +363,48 @@ export class Domains { /** * Finalize a domain purchase initiated with Create Purchase. Verifies that any required 3D Secure authentication is complete, registers the domain, captures the payment, and provisions default DNS records. Returns a 402 error if authentication is still pending. * - * @param {string} params.domainId - Domain ID to confirm purchase for. + * @param {string} params.invoiceId - Invoice ID. * @param {string} params.organizationId - Team ID that owns the domain. * @throws {AppwriteException} * @returns {Promise} */ - updatePurchase(params: { domainId: string, organizationId: string }): Promise; + updatePurchase(params: { invoiceId: string, organizationId: string }): Promise; /** * Finalize a domain purchase initiated with Create Purchase. Verifies that any required 3D Secure authentication is complete, registers the domain, captures the payment, and provisions default DNS records. Returns a 402 error if authentication is still pending. * - * @param {string} domainId - Domain ID to confirm purchase for. + * @param {string} invoiceId - Invoice ID. * @param {string} organizationId - Team ID that owns the domain. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePurchase(domainId: string, organizationId: string): Promise; + updatePurchase(invoiceId: string, organizationId: string): Promise; updatePurchase( - paramsOrFirst: { domainId: string, organizationId: string } | string, + paramsOrFirst: { invoiceId: string, organizationId: string } | string, ...rest: [(string)?] ): Promise { - let params: { domainId: string, organizationId: string }; + let params: { invoiceId: string, organizationId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domainId: string, organizationId: string }; + params = (paramsOrFirst || {}) as { invoiceId: string, organizationId: string }; } else { params = { - domainId: paramsOrFirst as string, + invoiceId: paramsOrFirst as string, organizationId: rest[0] as string }; } - const domainId = params.domainId; + const invoiceId = params.invoiceId; const organizationId = params.organizationId; - if (typeof domainId === 'undefined') { - throw new AppwriteException('Missing required parameter: "domainId"'); + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); } if (typeof organizationId === 'undefined') { throw new AppwriteException('Missing required parameter: "organizationId"'); } - const apiPath = '/domains/purchases/{domainId}'.replace('{domainId}', domainId); + const apiPath = '/domains/purchases/{invoiceId}'.replace('{invoiceId}', invoiceId); const payload: Payload = {}; if (typeof organizationId !== 'undefined') { payload['organizationId'] = organizationId; @@ -609,48 +609,48 @@ export class Domains { /** * Finalize a domain transfer-in initiated with Create Transfer In. Verifies that any required 3D Secure authentication is complete, submits the transfer with the authorization code, captures the payment, and sends a confirmation email. Returns a 402 error if authentication is still pending. * - * @param {string} params.domainId - Domain ID to confirm transfer for. + * @param {string} params.invoiceId - Invoice ID. * @param {string} params.organizationId - Team ID that owns the domain. * @throws {AppwriteException} * @returns {Promise} */ - updateTransferIn(params: { domainId: string, organizationId: string }): Promise; + updateTransferIn(params: { invoiceId: string, organizationId: string }): Promise; /** * Finalize a domain transfer-in initiated with Create Transfer In. Verifies that any required 3D Secure authentication is complete, submits the transfer with the authorization code, captures the payment, and sends a confirmation email. Returns a 402 error if authentication is still pending. * - * @param {string} domainId - Domain ID to confirm transfer for. + * @param {string} invoiceId - Invoice ID. * @param {string} organizationId - Team ID that owns the domain. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTransferIn(domainId: string, organizationId: string): Promise; + updateTransferIn(invoiceId: string, organizationId: string): Promise; updateTransferIn( - paramsOrFirst: { domainId: string, organizationId: string } | string, + paramsOrFirst: { invoiceId: string, organizationId: string } | string, ...rest: [(string)?] ): Promise { - let params: { domainId: string, organizationId: string }; + let params: { invoiceId: string, organizationId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domainId: string, organizationId: string }; + params = (paramsOrFirst || {}) as { invoiceId: string, organizationId: string }; } else { params = { - domainId: paramsOrFirst as string, + invoiceId: paramsOrFirst as string, organizationId: rest[0] as string }; } - const domainId = params.domainId; + const invoiceId = params.invoiceId; const organizationId = params.organizationId; - if (typeof domainId === 'undefined') { - throw new AppwriteException('Missing required parameter: "domainId"'); + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); } if (typeof organizationId === 'undefined') { throw new AppwriteException('Missing required parameter: "organizationId"'); } - const apiPath = '/domains/transfers/in/{domainId}'.replace('{domainId}', domainId); + const apiPath = '/domains/transfers/in/{invoiceId}'.replace('{invoiceId}', invoiceId); const payload: Payload = {}; if (typeof organizationId !== 'undefined') { payload['organizationId'] = organizationId; diff --git a/src/services/manager.ts b/src/services/manager.ts new file mode 100644 index 00000000..e4892c0c --- /dev/null +++ b/src/services/manager.ts @@ -0,0 +1,301 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { ResourceType } from '../enums/resource-type'; + +export class Manager { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Creates a new resource block. + * + * @param {string} params.projectId - Project ID + * @param {ResourceType} params.resourceType - Resource type to block (e.g., projects, functions, databases, storage, etc.) + * @param {string} params.resourceId - Optional resource ID (if omitted, all resources of this type will be blocked) + * @param {string} params.reason - Optional reason why the resource is blocked + * @param {string} params.expiredAt - Optional expiration date for the block + * @throws {AppwriteException} + * @returns {Promise} + */ + createBlock(params: { projectId: string, resourceType: ResourceType, resourceId?: string, reason?: string, expiredAt?: string }): Promise; + /** + * Creates a new resource block. + * + * @param {string} projectId - Project ID + * @param {ResourceType} resourceType - Resource type to block (e.g., projects, functions, databases, storage, etc.) + * @param {string} resourceId - Optional resource ID (if omitted, all resources of this type will be blocked) + * @param {string} reason - Optional reason why the resource is blocked + * @param {string} expiredAt - Optional expiration date for the block + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBlock(projectId: string, resourceType: ResourceType, resourceId?: string, reason?: string, expiredAt?: string): Promise; + createBlock( + paramsOrFirst: { projectId: string, resourceType: ResourceType, resourceId?: string, reason?: string, expiredAt?: string } | string, + ...rest: [(ResourceType)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { projectId: string, resourceType: ResourceType, resourceId?: string, reason?: string, expiredAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, resourceType: ResourceType, resourceId?: string, reason?: string, expiredAt?: string }; + } else { + params = { + projectId: paramsOrFirst as string, + resourceType: rest[0] as ResourceType, + resourceId: rest[1] as string, + reason: rest[2] as string, + expiredAt: rest[3] as string + }; + } + + const projectId = params.projectId; + const resourceType = params.resourceType; + const resourceId = params.resourceId; + const reason = params.reason; + const expiredAt = params.expiredAt; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof resourceType === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceType"'); + } + + const apiPath = '/manager/blocks'; + const payload: Payload = {}; + if (typeof projectId !== 'undefined') { + payload['projectId'] = projectId; + } + if (typeof resourceType !== 'undefined') { + payload['resourceType'] = resourceType; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof reason !== 'undefined') { + payload['reason'] = reason; + } + if (typeof expiredAt !== 'undefined') { + payload['expiredAt'] = expiredAt; + } + 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 + ); + } + + /** + * Deletes resource blocks for a project. + * + * @param {string} params.projectId - Project ID + * @param {ResourceType} params.resourceType - Resource type to unblock + * @param {string} params.resourceId - Optional resource ID (if omitted, all blocks of this type will be removed) + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteBlock(params: { projectId: string, resourceType: ResourceType, resourceId?: string }): Promise; + /** + * Deletes resource blocks for a project. + * + * @param {string} projectId - Project ID + * @param {ResourceType} resourceType - Resource type to unblock + * @param {string} resourceId - Optional resource ID (if omitted, all blocks of this type will be removed) + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBlock(projectId: string, resourceType: ResourceType, resourceId?: string): Promise; + deleteBlock( + paramsOrFirst: { projectId: string, resourceType: ResourceType, resourceId?: string } | string, + ...rest: [(ResourceType)?, (string)?] + ): Promise { + let params: { projectId: string, resourceType: ResourceType, resourceId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, resourceType: ResourceType, resourceId?: string }; + } else { + params = { + projectId: paramsOrFirst as string, + resourceType: rest[0] as ResourceType, + resourceId: rest[1] as string + }; + } + + const projectId = params.projectId; + const resourceType = params.resourceType; + const resourceId = params.resourceId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof resourceType === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceType"'); + } + + const apiPath = '/manager/blocks'; + const payload: Payload = {}; + if (typeof projectId !== 'undefined') { + payload['projectId'] = projectId; + } + if (typeof resourceType !== 'undefined') { + payload['resourceType'] = resourceType; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Lists all resource blocks for a project. + * + * @param {string} params.projectId - Project ID + * @throws {AppwriteException} + * @returns {Promise} + */ + listBlocks(params: { projectId: string }): Promise; + /** + * Lists all resource blocks for a project. + * + * @param {string} projectId - Project ID + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBlocks(projectId: string): Promise; + listBlocks( + paramsOrFirst: { projectId: string } | string + ): Promise { + let params: { projectId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string }; + } else { + params = { + projectId: paramsOrFirst as string + }; + } + + const projectId = params.projectId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + const apiPath = '/manager/blocks/{projectId}'.replace('{projectId}', projectId); + 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 + ); + } + + /** + * Updates a console user status using a user ID or email address. + * + * @param {boolean} params.status - User status. Set to `false` to block and `true` to unblock. + * @param {string} params.userId - User ID. + * @param {string} params.email - User email address. + * @param {string} params.reason - Optional reason when blocking a user. Accepted for parity with the CLI task but not persisted. + * @throws {AppwriteException} + * @returns {Promise>} + */ + updateUserStatus(params: { status: boolean, userId?: string, email?: string, reason?: string }): Promise>; + /** + * Updates a console user status using a user ID or email address. + * + * @param {boolean} status - User status. Set to `false` to block and `true` to unblock. + * @param {string} userId - User ID. + * @param {string} email - User email address. + * @param {string} reason - Optional reason when blocking a user. Accepted for parity with the CLI task but not persisted. + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUserStatus(status: boolean, userId?: string, email?: string, reason?: string): Promise>; + updateUserStatus( + paramsOrFirst: { status: boolean, userId?: string, email?: string, reason?: string } | boolean, + ...rest: [(string)?, (string)?, (string)?] + ): Promise> { + let params: { status: boolean, userId?: string, email?: string, reason?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { status: boolean, userId?: string, email?: string, reason?: string }; + } else { + params = { + status: paramsOrFirst as boolean, + userId: rest[0] as string, + email: rest[1] as string, + reason: rest[2] as string + }; + } + + const status = params.status; + const userId = params.userId; + const email = params.email; + const reason = params.reason; + + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/manager/users/status'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof reason !== 'undefined') { + payload['reason'] = reason; + } + 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 + ); + } +} diff --git a/src/services/organizations.ts b/src/services/organizations.ts index 561bb679..9ed1d233 100644 --- a/src/services/organizations.ts +++ b/src/services/organizations.ts @@ -2795,6 +2795,85 @@ export class Organizations { ); } + /** + * Create a billing plan estimation for upgrading or downgrading an organization plan. + * + * + * @param {string} params.organizationId - Organization ID + * @param {string} params.billingPlan - Target billing plan + * @param {string[]} params.invites - Additional member invites + * @param {string} params.couponId - Coupon id + * @throws {AppwriteException} + * @returns {Promise} + */ + createPlanEstimation(params: { organizationId: string, billingPlan: string, invites?: string[], couponId?: string }): Promise; + /** + * Create a billing plan estimation for upgrading or downgrading an organization plan. + * + * + * @param {string} organizationId - Organization ID + * @param {string} billingPlan - Target billing plan + * @param {string[]} invites - Additional member invites + * @param {string} couponId - Coupon id + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPlanEstimation(organizationId: string, billingPlan: string, invites?: string[], couponId?: string): Promise; + createPlanEstimation( + paramsOrFirst: { organizationId: string, billingPlan: string, invites?: string[], couponId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?] + ): Promise { + let params: { organizationId: string, billingPlan: string, invites?: string[], couponId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { organizationId: string, billingPlan: string, invites?: string[], couponId?: string }; + } else { + params = { + organizationId: paramsOrFirst as string, + billingPlan: rest[0] as string, + invites: rest[1] as string[], + couponId: rest[2] as string + }; + } + + const organizationId = params.organizationId; + const billingPlan = params.billingPlan; + const invites = params.invites; + const couponId = params.couponId; + + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof billingPlan === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingPlan"'); + } + + const apiPath = '/organizations/{organizationId}/plan/estimations'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof billingPlan !== 'undefined') { + payload['billingPlan'] = billingPlan; + } + if (typeof invites !== 'undefined') { + payload['invites'] = invites; + } + if (typeof couponId !== 'undefined') { + payload['couponId'] = couponId; + } + 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 all available regions for an organization. * diff --git a/src/services/project.ts b/src/services/project.ts index 18fa936a..114c0cd0 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,7 +2,9 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { MethodId } from '../enums/method-id'; import { Scopes } from '../enums/scopes'; +import { PolicyId } from '../enums/policy-id'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; import { Secure } from '../enums/secure'; @@ -17,6 +19,93 @@ export class Project { this.client = client; } + /** + * Delete a project. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(): Promise<{}> { + + const apiPath = '/project'; + 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 properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * + * @param {MethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {boolean} params.enabled - Auth method status. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateAuthMethod(params: { methodId: MethodId, enabled: boolean }): Promise; + /** + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * + * @param {MethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {boolean} enabled - Auth method status. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAuthMethod(methodId: MethodId, enabled: boolean): Promise; + updateAuthMethod( + paramsOrFirst: { methodId: MethodId, enabled: boolean } | MethodId, + ...rest: [(boolean)?] + ): Promise { + let params: { methodId: MethodId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { methodId: MethodId, enabled: boolean }; + } else { + params = { + methodId: paramsOrFirst as MethodId, + enabled: rest[0] as boolean + }; + } + + const methodId = params.methodId; + const enabled = params.enabled; + + if (typeof methodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "methodId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); + 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 canonical emails (alias subaddresses and emails with suffixes) are allowed during new users sign-ups in this project. * @@ -243,6 +332,8 @@ export class Project { /** * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key instead. * * @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. @@ -254,6 +345,8 @@ export class Project { 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. + * + * You can also create an ephemeral API key if you need a short-lived key instead. * * @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. @@ -324,6 +417,76 @@ export class Project { ); } + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise} + */ + createEphemeralKey(params: { scopes: Scopes[], duration: number }): Promise; + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEphemeralKey(scopes: Scopes[], duration: number): Promise; + createEphemeralKey( + paramsOrFirst: { scopes: Scopes[], duration: number } | Scopes[], + ...rest: [(number)?] + ): Promise { + let params: { scopes: Scopes[], duration: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { scopes: Scopes[], duration: number }; + } else { + params = { + scopes: paramsOrFirst as Scopes[], + duration: rest[0] as number + }; + } + + const scopes = params.scopes; + const duration = params.duration; + + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + if (typeof duration === 'undefined') { + throw new AppwriteException('Missing required parameter: "duration"'); + } + + const apiPath = '/project/keys/ephemeral'; + const payload: Payload = {}; + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + 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. * @@ -340,35 +503,3321 @@ export class Project { * @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 }; + 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 mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listMockPhones(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @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). Only supported methods are limit and offset + * @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. + */ + listMockPhones(queries?: string[], total?: boolean): Promise; + listMockPhones( + 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/mock-phones'; + 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 mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} params.number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMockPhone(params: { number: string, otp: string }): Promise; + /** + * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMockPhone(number: string, otp: string): Promise; + createMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones'; + const payload: Payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + 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 mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise} + */ + getMockPhone(params: { number: string }): Promise; + /** + * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMockPhone(number: string): Promise; + getMockPhone( + paramsOrFirst: { number: string } | string + ): Promise { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + 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 mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMockPhone(params: { number: string, otp: string }): Promise; + /** + * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMockPhone(number: string, otp: string): Promise; + updateMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + 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 mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMockPhone(params: { number: string }): Promise<{}>; + /** + * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMockPhone(number: string): Promise<{}>; + deleteMockPhone( + paramsOrFirst: { number: string } | string + ): Promise<{}> { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + 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 + ); + } + + /** + * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listOAuth2Providers(): Promise { + + const apiPath = '/project/oauth2'; + 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 the project OAuth2 Amazon configuration. + * + * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Amazon configuration. + * + * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Amazon( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/amazon'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Apple configuration. + * + * @param {string} params.serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} params.keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} params.teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} params.p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Apple configuration. + * + * @param {string} serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise; + updateOAuth2Apple( + paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + } else { + params = { + serviceId: paramsOrFirst as string, + keyId: rest[0] as string, + teamId: rest[1] as string, + p8File: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const serviceId = params.serviceId; + const keyId = params.keyId; + const teamId = params.teamId; + const p8File = params.p8File; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/apple'; + const payload: Payload = {}; + if (typeof serviceId !== 'undefined') { + payload['serviceId'] = serviceId; + } + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof p8File !== 'undefined') { + payload['p8File'] = p8File; + } + 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 project OAuth2 Auth0 configuration. + * + * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; + updateOAuth2Auth0( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/auth0'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + 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 project OAuth2 Authentik configuration. + * + * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Authentik configuration. + * + * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; + updateOAuth2Authentik( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/authentik'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + 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 project OAuth2 Autodesk configuration. + * + * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Autodesk( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/autodesk'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Bitbucket configuration. + * + * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise; + updateOAuth2Bitbucket( + paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { key?: string, secret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; + } else { + params = { + key: paramsOrFirst as string, + secret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const key = params.key; + const secret = params.secret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitbucket'; + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + 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 + ); + } + + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Bitly( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitly'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Box configuration. + * + * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Box configuration. + * + * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Box( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/box'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Dailymotion configuration. + * + * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise; + updateOAuth2Dailymotion( + paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; + } else { + params = { + apiKey: paramsOrFirst as string, + apiSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dailymotion'; + const payload: Payload = {}; + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + 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 project OAuth2 Discord configuration. + * + * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Discord configuration. + * + * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Discord( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/discord'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Disqus configuration. + * + * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Disqus configuration. + * + * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise; + updateOAuth2Disqus( + paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + publicKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const publicKey = params.publicKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/disqus'; + const payload: Payload = {}; + if (typeof publicKey !== 'undefined') { + payload['publicKey'] = publicKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + 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 project OAuth2 Dropbox configuration. + * + * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise; + updateOAuth2Dropbox( + paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { appKey?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appKey: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appKey = params.appKey; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dropbox'; + const payload: Payload = {}; + if (typeof appKey !== 'undefined') { + payload['appKey'] = appKey; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + 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 project OAuth2 Etsy configuration. + * + * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Etsy configuration. + * + * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise; + updateOAuth2Etsy( + paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; + } else { + params = { + keyString: paramsOrFirst as string, + sharedSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const keyString = params.keyString; + const sharedSecret = params.sharedSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/etsy'; + const payload: Payload = {}; + if (typeof keyString !== 'undefined') { + payload['keyString'] = keyString; + } + if (typeof sharedSecret !== 'undefined') { + payload['sharedSecret'] = sharedSecret; + } + 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 project OAuth2 Facebook configuration. + * + * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Facebook configuration. + * + * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise; + updateOAuth2Facebook( + paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { appId?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appId = params.appId; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/facebook'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + 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 project OAuth2 Figma configuration. + * + * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Figma configuration. + * + * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Figma( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/figma'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 FusionAuth configuration. + * + * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; + updateOAuth2FusionAuth( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/fusionauth'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + 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 project OAuth2 GitHub configuration. + * + * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 GitHub configuration. + * + * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2GitHub( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/github'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Gitlab configuration. + * + * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise; + updateOAuth2Gitlab( + paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise { + let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + secret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const secret = params.secret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/gitlab'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + 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 project OAuth2 Google configuration. + * + * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Google configuration. + * + * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Google(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Google( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/google'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Keycloak configuration. + * + * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise; + updateOAuth2Keycloak( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + realmName: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const realmName = params.realmName; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/keycloak'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof realmName !== 'undefined') { + payload['realmName'] = realmName; + } + 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 project OAuth2 Kick configuration. + * + * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Kick configuration. + * + * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Kick( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/kick'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Linkedin configuration. + * + * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Linkedin( + paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + primaryClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const primaryClientSecret = params.primaryClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/linkedin'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof primaryClientSecret !== 'undefined') { + payload['primaryClientSecret'] = primaryClientSecret; + } + 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 project OAuth2 Microsoft configuration. + * + * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise; + updateOAuth2Microsoft( + paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise { + let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + applicationSecret: rest[0] as string, + tenant: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const applicationSecret = params.applicationSecret; + const tenant = params.tenant; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/microsoft'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof applicationSecret !== 'undefined') { + payload['applicationSecret'] = applicationSecret; + } + if (typeof tenant !== 'undefined') { + payload['tenant'] = tenant; + } + 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 project OAuth2 Notion configuration. + * + * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Notion configuration. + * + * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Notion( + paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauthClientId: paramsOrFirst as string, + oauthClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauthClientId = params.oauthClientId; + const oauthClientSecret = params.oauthClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/notion'; + const payload: Payload = {}; + if (typeof oauthClientId !== 'undefined') { + payload['oauthClientId'] = oauthClientId; + } + if (typeof oauthClientSecret !== 'undefined') { + payload['oauthClientSecret'] = oauthClientSecret; + } + 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 project OAuth2 Oidc configuration. + * + * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} params.tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} params.userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Oidc configuration. + * + * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean): Promise; + updateOAuth2Oidc( + paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + wellKnownURL: rest[1] as string, + authorizationURL: rest[2] as string, + tokenUrl: rest[3] as string, + userInfoUrl: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const wellKnownURL = params.wellKnownURL; + const authorizationURL = params.authorizationURL; + const tokenUrl = params.tokenUrl; + const userInfoUrl = params.userInfoUrl; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/oidc'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof wellKnownURL !== 'undefined') { + payload['wellKnownURL'] = wellKnownURL; + } + if (typeof authorizationURL !== 'undefined') { + payload['authorizationURL'] = authorizationURL; + } + if (typeof tokenUrl !== 'undefined') { + payload['tokenUrl'] = tokenUrl; + } + if (typeof userInfoUrl !== 'undefined') { + payload['userInfoUrl'] = userInfoUrl; + } + 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 project OAuth2 Okta configuration. + * + * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Okta configuration. + * + * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise; + updateOAuth2Okta( + paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + domain: rest[1] as string, + authorizationServerId: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const domain = params.domain; + const authorizationServerId = params.authorizationServerId; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/okta'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof authorizationServerId !== 'undefined') { + payload['authorizationServerId'] = authorizationServerId; + } + 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 project OAuth2 Paypal configuration. + * + * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Paypal configuration. + * + * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise; + updateOAuth2Paypal( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypal'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + 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 project OAuth2 PaypalSandbox configuration. + * + * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise; + updateOAuth2PaypalSandbox( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypalSandbox'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + 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 project OAuth2 Podio configuration. + * + * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Podio configuration. + * + * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Podio( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/podio'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Salesforce configuration. + * + * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise; + updateOAuth2Salesforce( + paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + customerSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const customerSecret = params.customerSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/salesforce'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof customerSecret !== 'undefined') { + payload['customerSecret'] = customerSecret; + } + 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 project OAuth2 Slack configuration. + * + * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Slack configuration. + * + * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Slack( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/slack'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Spotify configuration. + * + * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Spotify configuration. + * + * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Spotify( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/spotify'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Stripe configuration. + * + * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Stripe configuration. + * + * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise; + updateOAuth2Stripe( + paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + apiSecretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const apiSecretKey = params.apiSecretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/stripe'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof apiSecretKey !== 'undefined') { + payload['apiSecretKey'] = apiSecretKey; + } + 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 project OAuth2 Tradeshift configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Tradeshift( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshift'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + 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 project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise; + updateOAuth2TradeshiftSandbox( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshiftBox'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + 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 project OAuth2 Twitch configuration. + * + * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Twitch configuration. + * + * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Twitch( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/twitch'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 WordPress configuration. + * + * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 WordPress configuration. + * + * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2WordPress( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/wordpress'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 X configuration. + * + * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 X configuration. + * + * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise; + updateOAuth2X( + paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/x'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + 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 project OAuth2 Yahoo configuration. + * + * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Yahoo( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/yahoo'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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 project OAuth2 Yandex configuration. + * + * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Yandex configuration. + * + * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Yandex( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; } else { params = { - keyId: paramsOrFirst as string + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean }; } - const keyId = params.keyId; + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/project/oauth2/yandex'; const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + 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( - 'get', + 'patch', uri, apiHeaders, payload @@ -376,70 +3825,57 @@ export class Project { } /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * Update the project OAuth2 Zoho configuration. * - * @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. + * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise; + updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * Update the project OAuth2 Zoho configuration. * - * @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. + * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} - * @returns {Promise} + * @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 }; + updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Zoho( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; } else { params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as Scopes[], - expire: rest[2] as string + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean }; } - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; - 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 apiPath = '/project/oauth2/zoho'; const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -448,7 +3884,7 @@ export class Project { } return this.client.call( - 'put', + 'patch', uri, apiHeaders, payload @@ -456,43 +3892,58 @@ export class Project { } /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * Update the project OAuth2 Zoom configuration. * - * @param {string} params.keyId - Key ID. + * @param {string} params.clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise} */ - deleteKey(params: { keyId: string }): Promise<{}>; + updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * Update the project OAuth2 Zoom configuration. * - * @param {string} keyId - Key ID. + * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @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 }; + updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Zoom( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; } else { params = { - keyId: paramsOrFirst as string + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean }; } - const keyId = params.keyId; + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/project/oauth2/zoom'; const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -500,7 +3951,7 @@ export class Project { } return this.client.call( - 'delete', + 'patch', uri, apiHeaders, payload @@ -508,54 +3959,50 @@ export class Project { } /** - * Update the project labels. Labels can be used to easily filter projects in an organization. + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @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. + * @param {string} params.provider - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - updateLabels(params: { labels: string[] }): Promise; + getOAuth2Provider(params: { provider: string }): Promise; /** - * Update the project labels. Labels can be used to easily filter projects in an organization. + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @param {string} provider - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise} + * @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[] }; + getOAuth2Provider(provider: string): Promise; + getOAuth2Provider( + paramsOrFirst: { provider: string } | string + ): Promise { + let params: { provider: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { labels: string[] }; + params = (paramsOrFirst || {}) as { provider: string }; } else { params = { - labels: paramsOrFirst as string[] + provider: paramsOrFirst as string }; } - const labels = params.labels; + const provider = params.provider; - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); } - const apiPath = '/project/labels'; + const apiPath = '/project/oauth2/{provider}'.replace('{provider}', provider); 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', + 'get', uri, apiHeaders, payload @@ -1469,6 +4916,65 @@ export class Project { ); } + /** + * Get a list of all project policies and their current configuration. + * + * @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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listPolicies(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all project policies and their current configuration. + * + * @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). Only supported methods are limit and offset + * @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. + */ + listPolicies(queries?: string[], total?: boolean): Promise; + listPolicies( + 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/policies'; + 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 + ); + } + /** * Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. * @@ -1994,6 +5500,57 @@ export class Project { ); } + /** + * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. + * + * @param {PolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPolicy(params: { policyId: PolicyId }): Promise; + /** + * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. + * + * @param {PolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPolicy(policyId: PolicyId): Promise; + getPolicy( + paramsOrFirst: { policyId: PolicyId } | PolicyId + ): Promise { + let params: { policyId: PolicyId }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: PolicyId }; + } else { + params = { + policyId: paramsOrFirst as PolicyId + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. * @@ -2291,6 +5848,65 @@ export class Project { ); } + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @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). Only supported methods are limit and offset + * @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. + */ + listEmailTemplates(queries?: string[], total?: boolean): Promise; + listEmailTemplates( + 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/templates/email'; + 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 + ); + } + /** * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. * diff --git a/src/services/projects.ts b/src/services/projects.ts index c61e42d0..e5721313 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -3,9 +3,6 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { Region } from '../enums/region'; -import { AuthMethod } from '../enums/auth-method'; -import { Scopes } from '../enums/scopes'; -import { OAuthProvider } from '../enums/o-auth-provider'; import { ResourceType } from '../enums/resource-type'; import { Status } from '../enums/status'; @@ -405,191 +402,6 @@ export class Projects { ); } - /** - * Delete a project by its unique ID. - * - * @param {string} params.projectId - Project unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { projectId: string }): Promise<{}>; - /** - * Delete a project by its unique ID. - * - * @param {string} projectId - Project unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(projectId: string): Promise<{}>; - delete( - paramsOrFirst: { projectId: string } | string - ): Promise<{}> { - let params: { projectId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string }; - } else { - params = { - projectId: paramsOrFirst as string - }; - } - - const projectId = params.projectId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - - const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId); - 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 list of mock phone numbers for testing. Use these numbers to bypass SMS verification in development. - * - * @param {string} params.projectId - Project unique ID. - * @param {object[]} params.numbers - An array of mock numbers and their corresponding verification codes (OTPs). Each number should be a valid E.164 formatted phone number. Maximum of 10 numbers are allowed. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateMockNumbers(params: { projectId: string, numbers: object[] }): Promise; - /** - * Update the list of mock phone numbers for testing. Use these numbers to bypass SMS verification in development. - * - * @param {string} projectId - Project unique ID. - * @param {object[]} numbers - An array of mock numbers and their corresponding verification codes (OTPs). Each number should be a valid E.164 formatted phone number. Maximum of 10 numbers are allowed. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMockNumbers(projectId: string, numbers: object[]): Promise; - updateMockNumbers( - paramsOrFirst: { projectId: string, numbers: object[] } | string, - ...rest: [(object[])?] - ): Promise { - let params: { projectId: string, numbers: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, numbers: object[] }; - } else { - params = { - projectId: paramsOrFirst as string, - numbers: rest[0] as object[] - }; - } - - const projectId = params.projectId; - const numbers = params.numbers; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof numbers === 'undefined') { - throw new AppwriteException('Missing required parameter: "numbers"'); - } - - const apiPath = '/projects/{projectId}/auth/mock-numbers'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof numbers !== 'undefined') { - payload['numbers'] = numbers; - } - 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 authentication method. Use this endpoint to enable or disable different authentication methods such as email, magic urls or sms in your project. - * - * @param {string} params.projectId - Project unique ID. - * @param {AuthMethod} params.method - Auth Method. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone - * @param {boolean} params.status - Set the status of this auth method. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateAuthStatus(params: { projectId: string, method: AuthMethod, status: boolean }): Promise; - /** - * Update the status of a specific authentication method. Use this endpoint to enable or disable different authentication methods such as email, magic urls or sms in your project. - * - * @param {string} projectId - Project unique ID. - * @param {AuthMethod} method - Auth Method. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone - * @param {boolean} status - Set the status of this auth method. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAuthStatus(projectId: string, method: AuthMethod, status: boolean): Promise; - updateAuthStatus( - paramsOrFirst: { projectId: string, method: AuthMethod, status: boolean } | string, - ...rest: [(AuthMethod)?, (boolean)?] - ): Promise { - let params: { projectId: string, method: AuthMethod, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, method: AuthMethod, status: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - method: rest[0] as AuthMethod, - status: rest[1] as boolean - }; - } - - const projectId = params.projectId; - const method = params.method; - const status = params.status; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof method === 'undefined') { - throw new AppwriteException('Missing required parameter: "method"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method); - 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 - ); - } - /** * Record console access to a project. This endpoint updates the last accessed timestamp for the project to track console activity. * @@ -975,160 +787,6 @@ export class Projects { ); } - /** - * Create a new JWT token. This token can be used to authenticate users with custom scopes and expiration time. - * - * @param {string} params.projectId - Project unique ID. - * @param {Scopes[]} params.scopes - List of scopes allowed for JWT key. Maximum of 100 scopes are allowed. - * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise} - */ - createJWT(params: { projectId: string, scopes: Scopes[], duration?: number }): Promise; - /** - * Create a new JWT token. This token can be used to authenticate users with custom scopes and expiration time. - * - * @param {string} projectId - Project unique ID. - * @param {Scopes[]} scopes - List of scopes allowed for JWT key. Maximum of 100 scopes are allowed. - * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createJWT(projectId: string, scopes: Scopes[], duration?: number): Promise; - createJWT( - paramsOrFirst: { projectId: string, scopes: Scopes[], duration?: number } | string, - ...rest: [(Scopes[])?, (number)?] - ): Promise { - let params: { projectId: string, scopes: Scopes[], duration?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, scopes: Scopes[], duration?: number }; - } else { - params = { - projectId: paramsOrFirst as string, - scopes: rest[0] as Scopes[], - duration: rest[1] as number - }; - } - - const projectId = params.projectId; - const scopes = params.scopes; - const duration = params.duration; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/projects/{projectId}/jwts'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - 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 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 the project's schedules. You can use the query params to filter your results. *