diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e6ea266..ee63d52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: '24.14.1' registry-url: 'https://registry.npmjs.org' diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7253a5c --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +min-release-age=7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 078bc7b..475cf10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## 25.0.0 + +* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId` +* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale` +* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId` +* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints +* Breaking: Removed `updateDenyCanonicalEmailPolicy`; replaced with `updateDenyAliasedEmailPolicy`, `updateDenyDisposableEmailPolicy`, and `updateDenyFreeEmailPolicy` +* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead +* Added: `Project.get` method to fetch current project details +* Added: `Advisor`, `Presences`, and `Usage` services +* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants +* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models +* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums +* Updated: `Project`, `Database`, and `OAuth2Google` model schemas +* Updated: `X-Appwrite-Response-Format` header to `1.9.5` + ## 24.1.0 * Added: Introduced `bigint` create/update APIs for legacy Databases attributes diff --git a/README.md b/README.md index b3be479..62fd49f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Node.js SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.5-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) diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 0000000..8169db0 --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.deleteReport({ + reportId: '' +}); +``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 0000000..abec35e --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const advisor = new sdk.Advisor(client); + +const result = await advisor.getInsight({ + reportId: '', + insightId: '' +}); +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 0000000..06bc109 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const advisor = new sdk.Advisor(client); + +const result = await advisor.getReport({ + reportId: '' +}); +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 0000000..c754b65 --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const advisor = new sdk.Advisor(client); + +const result = await advisor.listInsights({ + reportId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 0000000..4227d53 --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const advisor = new sdk.Advisor(client); + +const result = await advisor.listReports({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 0000000..4c1cfc2 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.delete({ + presenceId: '' +}); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 0000000..1e8a332 --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.get({ + presenceId: '' +}); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 0000000..fbb18d4 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.list({ + queries: [], // optional + total: false, // optional + ttl: 0 // optional +}); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 0000000..ffb1272 --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.updatePresence({ + presenceId: '', + userId: '', + status: '', // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + purge: false // optional +}); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 0000000..63b9267 --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.upsert({ + presenceId: '', + userId: '', + status: '', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {} // optional +}); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index 31d2101..e368a60 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.createEphemeralKey({ - scopes: [sdk.Scopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.ProjectRead], duration: 600 }); ``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 03ba627..362821b 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -11,7 +11,7 @@ const project = new sdk.Project(client); const result = await project.createKey({ keyId: '', name: '', - scopes: [sdk.Scopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.ProjectRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); ``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md index 06b062f..d4683e5 100644 --- a/docs/examples/project/get-email-template.md +++ b/docs/examples/project/get-email-template.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getEmailTemplate({ - templateId: sdk.EmailTemplateType.Verification, - locale: sdk.EmailTemplateLocale.Af // optional + templateId: sdk.ProjectEmailTemplateId.Verification, + locale: sdk.ProjectEmailTemplateLocale.Af // optional }); ``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index ce59ec6..7c1d85c 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getOAuth2Provider({ - providerId: sdk.OAuthProvider.Amazon + providerId: sdk.ProjectOAuthProviderId.Amazon }); ``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index 5387dfe..e55cb85 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getPolicy({ - policyId: sdk.ProjectPolicy.PasswordDictionary + policyId: sdk.ProjectPolicyId.PasswordDictionary }); ``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md new file mode 100644 index 0000000..5ee86b8 --- /dev/null +++ b/docs/examples/project/get.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.get(); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index ca8b298..8e2e4bb 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateAuthMethod({ - methodId: sdk.AuthMethod.EmailPassword, + methodId: sdk.ProjectAuthMethodId.EmailPassword, enabled: false }); ``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md new file mode 100644 index 0000000..92b7e64 --- /dev/null +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyAliasedEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md new file mode 100644 index 0000000..e2b2531 --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyDisposableEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md new file mode 100644 index 0000000..85799e8 --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyFreeEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md index 67e0fac..ddf6ca6 100644 --- a/docs/examples/project/update-email-template.md +++ b/docs/examples/project/update-email-template.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateEmailTemplate({ - templateId: sdk.EmailTemplateType.Verification, - locale: sdk.EmailTemplateLocale.Af, // optional + templateId: sdk.ProjectEmailTemplateId.Verification, + locale: sdk.ProjectEmailTemplateLocale.Af, // optional subject: '', // optional message: '', // optional senderName: '', // optional diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 488fae1..39be329 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -11,7 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateKey({ keyId: '', name: '', - scopes: [sdk.Scopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.ProjectRead], expire: '2020-10-15T06:38:00.000+00:00' // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index dce02e9..726d605 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Google({ clientId: '', // optional clientSecret: '', // optional + prompt: [sdk.ProjectOAuth2GooglePrompt.None], // optional enabled: false // optional }); ``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md index 0633194..373e917 100644 --- a/docs/examples/project/update-protocol.md +++ b/docs/examples/project/update-protocol.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateProtocol({ - protocolId: sdk.ProtocolId.Rest, + protocolId: sdk.ProjectProtocolId.Rest, enabled: false }); ``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md index 45cc56d..ded8eb7 100644 --- a/docs/examples/project/update-service.md +++ b/docs/examples/project/update-service.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateService({ - serviceId: sdk.ServiceId.Account, + serviceId: sdk.ProjectServiceId.Account, enabled: false }); ``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index ac00195..fe7258a 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -17,7 +17,7 @@ const result = await project.updateSMTP({ senderName: '', // optional replyToEmail: 'email@example.com', // optional replyToName: '', // optional - secure: sdk.Secure.Tls, // optional + secure: sdk.ProjectSMTPSecure.Tls, // optional enabled: false // optional }); ``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md new file mode 100644 index 0000000..887f98f --- /dev/null +++ b/docs/examples/usage/list-events.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const usage = new sdk.Usage(client); + +const result = await usage.listEvents({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md new file mode 100644 index 0000000..aa5ba1d --- /dev/null +++ b/docs/examples/usage/list-gauges.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const usage = new sdk.Usage(client); + +const result = await usage.listGauges({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/package-lock.json b/package-lock.json index 69c1e71..0c31b05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "24.1.0", + "version": "25.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "24.1.0", + "version": "25.0.0", "dependencies": { "json-bigint": "1.0.0", "node-fetch-native-with-agent": "1.7.2" diff --git a/package.json b/package.json index 24e2e0c..b79ffc5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "24.1.0", + "version": "25.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 84774c0..46b481f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -74,7 +74,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/24.1.0'; + let ua = 'AppwriteNodeJSSDK/25.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -128,9 +128,9 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '24.1.0', + 'x-sdk-version': '25.0.0', 'user-agent' : getUserAgent(), - 'X-Appwrite-Response-Format': '1.9.4', + 'X-Appwrite-Response-Format': '1.9.5', }; /** diff --git a/src/enums/o-auth-2-google-prompt.ts b/src/enums/o-auth-2-google-prompt.ts new file mode 100644 index 0000000..f8e98e1 --- /dev/null +++ b/src/enums/o-auth-2-google-prompt.ts @@ -0,0 +1,5 @@ +export enum OAuth2GooglePrompt { + None = 'none', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index 0618963..cc9e340 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -42,6 +42,4 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', } \ No newline at end of file diff --git a/src/enums/auth-method.ts b/src/enums/project-auth-method-id.ts similarity index 84% rename from src/enums/auth-method.ts rename to src/enums/project-auth-method-id.ts index d5800ad..a05c217 100644 --- a/src/enums/auth-method.ts +++ b/src/enums/project-auth-method-id.ts @@ -1,4 +1,4 @@ -export enum AuthMethod { +export enum ProjectAuthMethodId { Emailpassword = 'email-password', Magicurl = 'magic-url', Emailotp = 'email-otp', diff --git a/src/enums/email-template-type.ts b/src/enums/project-email-template-id.ts similarity index 86% rename from src/enums/email-template-type.ts rename to src/enums/project-email-template-id.ts index 2a561bf..b5aba1a 100644 --- a/src/enums/email-template-type.ts +++ b/src/enums/project-email-template-id.ts @@ -1,4 +1,4 @@ -export enum EmailTemplateType { +export enum ProjectEmailTemplateId { Verification = 'verification', MagicSession = 'magicSession', Recovery = 'recovery', diff --git a/src/enums/email-template-locale.ts b/src/enums/project-email-template-locale.ts similarity index 98% rename from src/enums/email-template-locale.ts rename to src/enums/project-email-template-locale.ts index 82656b8..b5bb7cf 100644 --- a/src/enums/email-template-locale.ts +++ b/src/enums/project-email-template-locale.ts @@ -1,4 +1,4 @@ -export enum EmailTemplateLocale { +export enum ProjectEmailTemplateLocale { Af = 'af', Arae = 'ar-ae', Arbh = 'ar-bh', diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts new file mode 100644 index 0000000..fe01996 --- /dev/null +++ b/src/enums/project-key-scopes.ts @@ -0,0 +1,96 @@ +export enum ProjectKeyScopes { + 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', + ProjectPoliciesRead = 'project.policies.read', + ProjectPoliciesWrite = 'project.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', + TeamsRead = 'teams.read', + TeamsWrite = 'teams.write', + DatabasesRead = 'databases.read', + DatabasesWrite = 'databases.write', + TablesRead = 'tables.read', + TablesWrite = 'tables.write', + ColumnsRead = 'columns.read', + ColumnsWrite = 'columns.write', + IndexesRead = 'indexes.read', + IndexesWrite = 'indexes.write', + RowsRead = 'rows.read', + RowsWrite = 'rows.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', + ProvidersRead = 'providers.read', + ProvidersWrite = 'providers.write', + TopicsRead = 'topics.read', + TopicsWrite = 'topics.write', + SubscribersRead = 'subscribers.read', + SubscribersWrite = 'subscribers.write', + TargetsRead = 'targets.read', + TargetsWrite = 'targets.write', + MessagesRead = 'messages.read', + MessagesWrite = 'messages.write', + RulesRead = 'rules.read', + RulesWrite = 'rules.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', + InsightsRead = 'insights.read', + InsightsWrite = 'insights.write', + ReportsRead = 'reports.read', + ReportsWrite = 'reports.write', + PresencesRead = 'presences.read', + PresencesWrite = 'presences.write', + BackupsPoliciesRead = 'backups.policies.read', + BackupsPoliciesWrite = 'backups.policies.write', + ArchivesRead = 'archives.read', + ArchivesWrite = 'archives.write', + RestorationsRead = 'restorations.read', + RestorationsWrite = 'restorations.write', + DomainsRead = 'domains.read', + DomainsWrite = 'domains.write', + EventsRead = 'events.read', + UsageRead = 'usage.read', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-2-google-prompt.ts b/src/enums/project-o-auth-2-google-prompt.ts new file mode 100644 index 0000000..75db98e --- /dev/null +++ b/src/enums/project-o-auth-2-google-prompt.ts @@ -0,0 +1,5 @@ +export enum ProjectOAuth2GooglePrompt { + None = 'none', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts new file mode 100644 index 0000000..e35d6ef --- /dev/null +++ b/src/enums/project-o-auth-provider-id.ts @@ -0,0 +1,47 @@ +export enum ProjectOAuthProviderId { + Amazon = 'amazon', + Apple = 'apple', + Auth0 = 'auth0', + Authentik = 'authentik', + Autodesk = 'autodesk', + Bitbucket = 'bitbucket', + Bitly = 'bitly', + Box = 'box', + Dailymotion = 'dailymotion', + Discord = 'discord', + Disqus = 'disqus', + Dropbox = 'dropbox', + Etsy = 'etsy', + Facebook = 'facebook', + Figma = 'figma', + Fusionauth = 'fusionauth', + Github = 'github', + Gitlab = 'gitlab', + Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', + Linkedin = 'linkedin', + Microsoft = 'microsoft', + Notion = 'notion', + Oidc = 'oidc', + Okta = 'okta', + Paypal = 'paypal', + PaypalSandbox = 'paypalSandbox', + Podio = 'podio', + Salesforce = 'salesforce', + Slack = 'slack', + Spotify = 'spotify', + Stripe = 'stripe', + Tradeshift = 'tradeshift', + TradeshiftBox = 'tradeshiftBox', + Twitch = 'twitch', + Wordpress = 'wordpress', + X = 'x', + Yahoo = 'yahoo', + Yammer = 'yammer', + Yandex = 'yandex', + Zoho = 'zoho', + Zoom = 'zoom', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', +} \ No newline at end of file diff --git a/src/enums/project-policy.ts b/src/enums/project-policy-id.ts similarity index 92% rename from src/enums/project-policy.ts rename to src/enums/project-policy-id.ts index d52bf99..2031ce9 100644 --- a/src/enums/project-policy.ts +++ b/src/enums/project-policy-id.ts @@ -1,4 +1,4 @@ -export enum ProjectPolicy { +export enum ProjectPolicyId { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', Passwordpersonaldata = 'password-personal-data', diff --git a/src/enums/protocol-id.ts b/src/enums/project-protocol-id.ts similarity index 69% rename from src/enums/protocol-id.ts rename to src/enums/project-protocol-id.ts index 94d9095..10a89c2 100644 --- a/src/enums/protocol-id.ts +++ b/src/enums/project-protocol-id.ts @@ -1,4 +1,4 @@ -export enum ProtocolId { +export enum ProjectProtocolId { Rest = 'rest', Graphql = 'graphql', Websocket = 'websocket', diff --git a/src/enums/service-id.ts b/src/enums/project-service-id.ts similarity index 88% rename from src/enums/service-id.ts rename to src/enums/project-service-id.ts index 2928112..01f844a 100644 --- a/src/enums/service-id.ts +++ b/src/enums/project-service-id.ts @@ -1,4 +1,4 @@ -export enum ServiceId { +export enum ProjectServiceId { Account = 'account', Avatars = 'avatars', Databases = 'databases', @@ -16,4 +16,5 @@ export enum ServiceId { Graphql = 'graphql', Migrations = 'migrations', Messaging = 'messaging', + Advisor = 'advisor', } \ No newline at end of file diff --git a/src/enums/secure.ts b/src/enums/project-smtp-secure.ts similarity index 52% rename from src/enums/secure.ts rename to src/enums/project-smtp-secure.ts index 0ab54cf..d3d3768 100644 --- a/src/enums/secure.ts +++ b/src/enums/project-smtp-secure.ts @@ -1,4 +1,4 @@ -export enum Secure { +export enum ProjectSMTPSecure { Tls = 'tls', Ssl = 'ssl', } \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 5c81210..54e9cb3 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -77,6 +77,12 @@ export enum Scopes { SchedulesWrite = 'schedules.write', VcsRead = 'vcs.read', VcsWrite = 'vcs.write', + InsightsRead = 'insights.read', + InsightsWrite = 'insights.write', + ReportsRead = 'reports.read', + ReportsWrite = 'reports.write', + PresencesRead = 'presences.read', + PresencesWrite = 'presences.write', BackupsPoliciesRead = 'backups.policies.read', BackupsPoliciesWrite = 'backups.policies.write', ArchivesRead = 'archives.read', @@ -86,4 +92,5 @@ export enum Scopes { DomainsRead = 'domains.read', DomainsWrite = 'domains.write', EventsRead = 'events.read', + UsageRead = 'usage.read', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 60e8093..1932e75 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,13 +9,16 @@ export { Graphql } from './services/graphql'; export { Health } from './services/health'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; +export { Presences } from './services/presences'; export { Project } from './services/project'; export { Proxy } from './services/proxy'; +export { Advisor } from './services/advisor'; export { Sites } from './services/sites'; export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; export { Teams } from './services/teams'; export { Tokens } from './services/tokens'; +export { Usage } from './services/usage'; export { Users } from './services/users'; export { Webhooks } from './services/webhooks'; export type { Models, Payload, UploadProgress } from './client'; @@ -48,13 +51,16 @@ export { ExecutionMethod } from './enums/execution-method'; export { Name } from './enums/name'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; -export { AuthMethod } from './enums/auth-method'; -export { ProjectPolicy } from './enums/project-policy'; -export { ProtocolId } from './enums/protocol-id'; -export { ServiceId } from './enums/service-id'; -export { Secure } from './enums/secure'; -export { EmailTemplateType } from './enums/email-template-type'; -export { EmailTemplateLocale } from './enums/email-template-locale'; +export { ProjectAuthMethodId } from './enums/project-auth-method-id'; +export { ProjectKeyScopes } from './enums/project-key-scopes'; +export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; +export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; +export { ProjectPolicyId } from './enums/project-policy-id'; +export { ProjectProtocolId } from './enums/project-protocol-id'; +export { ProjectServiceId } from './enums/project-service-id'; +export { ProjectSMTPSecure } from './enums/project-smtp-secure'; +export { ProjectEmailTemplateId } from './enums/project-email-template-id'; +export { ProjectEmailTemplateLocale } from './enums/project-email-template-locale'; export { StatusCode } from './enums/status-code'; export { ProxyResourceType } from './enums/proxy-resource-type'; export { Framework } from './enums/framework'; @@ -72,6 +78,7 @@ export { IndexStatus } from './enums/index-status'; export { DeploymentStatus } from './enums/deployment-status'; export { ExecutionTrigger } from './enums/execution-trigger'; export { ExecutionStatus } from './enums/execution-status'; +export { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; export { PlatformType } from './enums/platform-type'; export { HealthAntivirusStatus } from './enums/health-antivirus-status'; export { HealthCheckStatus } from './enums/health-check-status'; diff --git a/src/models.ts b/src/models.ts index a16714b..6b0d05c 100644 --- a/src/models.ts +++ b/src/models.ts @@ -5,6 +5,10 @@ import { IndexStatus } from "./enums/index-status" import { DeploymentStatus } from "./enums/deployment-status" import { ExecutionTrigger } from "./enums/execution-trigger" import { ExecutionStatus } from "./enums/execution-status" +import { ProjectAuthMethodId } from "./enums/project-auth-method-id" +import { ProjectServiceId } from "./enums/project-service-id" +import { ProjectProtocolId } from "./enums/project-protocol-id" +import { OAuth2GooglePrompt } from "./enums/o-auth-2-google-prompt" import { PlatformType } from "./enums/platform-type" import { HealthAntivirusStatus } from "./enums/health-antivirus-status" import { HealthCheckStatus } from "./enums/health-check-status" @@ -47,6 +51,20 @@ export namespace Models { documents: Document[]; } + /** + * Presences List + */ + export type PresenceList = { + /** + * Total number of presences that matched your query. + */ + total: number; + /** + * List of presences. + */ + presences: Presence[]; + } + /** * Tables List */ @@ -621,6 +639,34 @@ export namespace Models { specifications: Specification[]; } + /** + * Insights List + */ + export type InsightList = { + /** + * Total number of insights that matched your query. + */ + total: number; + /** + * List of insights. + */ + insights: Insight[]; + } + + /** + * Reports List + */ + export type ReportList = { + /** + * Total number of reports that matched your query. + */ + total: number; + /** + * List of reports. + */ + reports: Report[]; + } + /** * Database */ @@ -652,11 +698,11 @@ export namespace Models { /** * Database backup policies. */ - policies: Index[]; + policies: BackupPolicy[]; /** * Database backup archives. */ - archives: Collection[]; + archives: BackupArchive[]; } /** @@ -2669,6 +2715,49 @@ export namespace Models { [__default]: true; }; + /** + * Presence + */ + export type Presence = { + /** + * Presence ID. + */ + $id: string; + /** + * Presence creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Presence update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * User ID. + */ + userId: string; + /** + * Presence status. + */ + status?: string; + /** + * Presence source. + */ + source: string; + /** + * Presence expiry date in ISO 8601 format. + */ + expiresAt?: string; + } + + export type DefaultPresence = Presence & { + [key: string]: any; + [__default]: true; + }; + /** * Log */ @@ -4038,132 +4127,12 @@ export namespace Models { * Project name. */ name: string; - /** - * Project description. - */ - description: string; /** * Project team ID. */ teamId: string; /** - * Project logo file ID. - */ - logo: string; - /** - * Project website URL. - */ - url: string; - /** - * Company legal name. - */ - legalName: string; - /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. - */ - legalCountry: string; - /** - * State name. - */ - legalState: string; - /** - * City name. - */ - legalCity: string; - /** - * Company Address. - */ - legalAddress: string; - /** - * Company Tax ID. - */ - legalTaxId: string; - /** - * Session duration in seconds. - */ - authDuration: number; - /** - * Max users allowed. 0 is unlimited. - */ - authLimit: number; - /** - * Max sessions allowed per user. 100 maximum. - */ - authSessionsLimit: number; - /** - * Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history. - */ - authPasswordHistory: number; - /** - * Whether or not to check user's password against most commonly used passwords. - */ - authPasswordDictionary: boolean; - /** - * Whether or not to check the user password for similarity with their personal data. - */ - authPersonalDataCheck: boolean; - /** - * Whether or not to disallow disposable email addresses during signup and email updates. - */ - authDisposableEmails: boolean; - /** - * Whether or not to require canonical email addresses during signup and email updates. - */ - authCanonicalEmails: boolean; - /** - * Whether or not to disallow free email addresses during signup and email updates. - */ - authFreeEmails: boolean; - /** - * An array of mock numbers and their corresponding verification codes (OTPs). - */ - authMockNumbers: MockNumber[]; - /** - * Whether or not to send session alert emails to users. - */ - authSessionAlerts: boolean; - /** - * Whether or not to show user names in the teams membership response. - */ - authMembershipsUserName: boolean; - /** - * Whether or not to show user emails in the teams membership response. - */ - authMembershipsUserEmail: boolean; - /** - * Whether or not to show user MFA status in the teams membership response. - */ - authMembershipsMfa: boolean; - /** - * Whether or not to show user IDs in the teams membership response. - */ - authMembershipsUserId: boolean; - /** - * Whether or not to show user phone numbers in the teams membership response. - */ - authMembershipsUserPhone: boolean; - /** - * Whether or not all existing sessions should be invalidated on password change - */ - authInvalidateSessions: boolean; - /** - * List of Auth Providers. - */ - oAuthProviders: AuthProvider[]; - /** - * List of Platforms. - */ - platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; - /** - * List of Webhooks. - */ - webhooks: Webhook[]; - /** - * List of API Keys. - */ - keys: Key[]; - /** - * List of dev keys. + * Deprecated since 1.9.5: List of dev keys. */ devKeys: DevKey[]; /** @@ -4223,129 +4192,75 @@ export namespace Models { */ status: string; /** - * Email/Password auth method status - */ - authEmailPassword: boolean; - /** - * Magic URL auth method status - */ - authUsersAuthMagicURL: boolean; - /** - * Email (OTP) auth method status - */ - authEmailOtp: boolean; - /** - * Anonymous auth method status - */ - authAnonymous: boolean; - /** - * Invites auth method status - */ - authInvites: boolean; - /** - * JWT auth method status - */ - authJWT: boolean; - /** - * Phone auth method status + * List of auth methods. */ - authPhone: boolean; + authMethods: ProjectAuthMethod[]; /** - * Account service status + * List of services. */ - serviceStatusForAccount: boolean; + services: ProjectService[]; /** - * Avatars service status + * List of protocols. */ - serviceStatusForAvatars: boolean; + protocols: ProjectProtocol[]; /** - * Databases (legacy) service status - */ - serviceStatusForDatabases: boolean; - /** - * TablesDB service status - */ - serviceStatusForTablesdb: boolean; - /** - * Locale service status - */ - serviceStatusForLocale: boolean; - /** - * Health service status - */ - serviceStatusForHealth: boolean; - /** - * Project service status - */ - serviceStatusForProject: boolean; - /** - * Storage service status - */ - serviceStatusForStorage: boolean; - /** - * Teams service status - */ - serviceStatusForTeams: boolean; - /** - * Users service status - */ - serviceStatusForUsers: boolean; - /** - * VCS service status - */ - serviceStatusForVcs: boolean; - /** - * Sites service status - */ - serviceStatusForSites: boolean; - /** - * Functions service status - */ - serviceStatusForFunctions: boolean; - /** - * Proxy service status - */ - serviceStatusForProxy: boolean; - /** - * GraphQL service status + * Project region */ - serviceStatusForGraphql: boolean; + region: string; /** - * Migrations service status + * Billing limits reached */ - serviceStatusForMigrations: boolean; + billingLimits: BillingLimits; /** - * Messaging service status + * Project blocks information */ - serviceStatusForMessaging: boolean; + blocks: Block[]; /** - * REST protocol status + * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. */ - protocolStatusForRest: boolean; + consoleAccessedAt: string; + } + + /** + * ProjectAuthMethod + */ + export type ProjectAuthMethod = { /** - * GraphQL protocol status + * Auth method ID. */ - protocolStatusForGraphql: boolean; + $id: ProjectAuthMethodId; /** - * Websocket protocol status + * Auth method status. */ - protocolStatusForWebsocket: boolean; + enabled: boolean; + } + + /** + * ProjectService + */ + export type ProjectService = { /** - * Project region + * Service ID. */ - region: string; + $id: ProjectServiceId; /** - * Billing limits reached + * Service status. */ - billingLimits: BillingLimits; + enabled: boolean; + } + + /** + * ProjectProtocol + */ + export type ProjectProtocol = { /** - * Project blocks information + * Protocol ID. */ - blocks: Block[]; + $id: ProjectProtocolId; /** - * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + * Protocol status. */ - consoleAccessedAt: string; + enabled: boolean; } /** @@ -4768,6 +4683,10 @@ export namespace Models { * Google OAuth2 client secret. */ clientSecret: string; + /** + * Google OAuth2 prompt values. + */ + prompt: OAuth2GooglePrompt[]; } /** @@ -5646,32 +5565,6 @@ export namespace Models { 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 */ @@ -6522,6 +6415,156 @@ export namespace Models { expired: boolean; } + /** + * Insight + */ + export type Insight = { + /** + * Insight ID. + */ + $id: string; + /** + * Insight creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Insight update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Parent report ID. Insights always belong to a report. + */ + reportId: string; + /** + * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). + */ + type: string; + /** + * Insight severity. One of info, warning, critical. + */ + severity: string; + /** + * Insight status. One of active, dismissed. + */ + status: string; + /** + * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. + */ + resourceType: string; + /** + * ID of the resource the insight is about. + */ + resourceId: string; + /** + * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. + */ + parentResourceType: string; + /** + * ID of the parent resource. Empty when the resource has no parent. + */ + parentResourceId: string; + /** + * Insight title. + */ + title: string; + /** + * Short markdown summary describing the insight. + */ + summary: string; + /** + * List of call-to-action buttons attached to this insight. + */ + ctas: InsightCTA[]; + /** + * Time the insight was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + /** + * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. + */ + dismissedAt?: string; + /** + * User ID that dismissed the insight. Empty when not dismissed. + */ + dismissedBy?: string; + } + + /** + * InsightCTA + */ + export type InsightCTA = { + /** + * Human-readable label for the CTA, used in UI. + */ + label: string; + /** + * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. + */ + service: string; + /** + * Public API method on the chosen service the client should invoke when this CTA is triggered. + */ + method: string; + /** + * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). + */ + params: object; + } + + /** + * Report + */ + export type Report = { + /** + * Report ID. + */ + $id: string; + /** + * Report creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Report update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the third-party app that submitted the report. + */ + appId: string; + /** + * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. + */ + type: string; + /** + * Short, human-readable title for the report. + */ + title: string; + /** + * Markdown summary describing the report. + */ + summary: string; + /** + * Plural noun describing what the report analyzes, e.g. databases, sites, urls. + */ + targetType: string; + /** + * Free-form target identifier (URL for lighthouse, resource ID for db). + */ + target: string; + /** + * Categories covered by the report, e.g. performance, accessibility. + */ + categories: string[]; + /** + * Insights nested under this report. + */ + insights: Insight[]; + /** + * Time the report was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + } + /** * ActivityEvent */ @@ -6894,6 +6937,98 @@ export namespace Models { options: string; } + /** + * usageEvent + */ + export type UsageEvent = { + /** + * The metric key. + */ + metric: string; + /** + * The metric value. + */ + value: number; + /** + * The event timestamp. + */ + time: string; + /** + * The API endpoint path. + */ + path: string; + /** + * The HTTP method. + */ + method: string; + /** + * HTTP status code. Stored as string to preserve unset state (empty string = not available). + */ + status: string; + /** + * The resource type. + */ + resourceType: string; + /** + * The resource ID. + */ + resourceId: string; + /** + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + */ + countryCode: string; + /** + * The user agent string. + */ + userAgent: string; + } + + /** + * Usage events list + */ + export type UsageEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: UsageEvent[]; + } + + /** + * usageGauge + */ + export type UsageGauge = { + /** + * The metric key. + */ + metric: string; + /** + * The current snapshot value. + */ + value: number; + /** + * The snapshot timestamp. + */ + time: string; + } + + /** + * Usage gauges list + */ + export type UsageGaugeList = { + /** + * Total number of gauges that matched your query. + */ + total: number; + /** + * List of gauges. + */ + gauges: UsageGauge[]; + } + /** * Activity event list */ diff --git a/src/services/advisor.ts b/src/services/advisor.ts new file mode 100644 index 0000000..02587b9 --- /dev/null +++ b/src/services/advisor.ts @@ -0,0 +1,309 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Advisor { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listReports(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listReports(queries?: string[], total?: boolean): Promise; + listReports( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/reports'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReport(params: { reportId: string }): Promise; + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReport(reportId: string): Promise; + getReport( + paramsOrFirst: { reportId: string } | string + ): Promise { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteReport(params: { reportId: string }): Promise<{}>; + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteReport(reportId: string): Promise<{}>; + deleteReport( + paramsOrFirst: { reportId: string } | string + ): Promise<{}> { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} params.reportId - Parent report ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise; + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} reportId - Parent report ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInsights(reportId: string, queries?: string[], total?: boolean): Promise; + listInsights( + paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { reportId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; + } else { + params = { + reportId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const reportId = params.reportId; + const queries = params.queries; + const total = params.total; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} params.reportId - Parent report ID. + * @param {string} params.insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getInsight(params: { reportId: string, insightId: string }): Promise; + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} reportId - Parent report ID. + * @param {string} insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInsight(reportId: string, insightId: string): Promise; + getInsight( + paramsOrFirst: { reportId: string, insightId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { reportId: string, insightId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; + } else { + params = { + reportId: paramsOrFirst as string, + insightId: rest[0] as string + }; + } + + const reportId = params.reportId; + const insightId = params.insightId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + if (typeof insightId === 'undefined') { + throw new AppwriteException('Missing required parameter: "insightId"'); + } + + const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/presences.ts b/src/services/presences.ts new file mode 100644 index 0000000..80cfb5b --- /dev/null +++ b/src/services/presences.ts @@ -0,0 +1,383 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Presences { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List presence logs. Expired entries are filtered out automatically. + * + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + */ + list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise>; + /** + * List presence logs. Expired entries are filtered out automatically. + * + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean, ttl?: number): Promise>; + list( + paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], + ...rest: [(boolean)?, (number)?] + ): Promise> { + let params: { queries?: string[], total?: boolean, ttl?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean, + ttl: rest[1] as number + }; + } + + const queries = params.queries; + const total = params.total; + const ttl = params.ttl; + + + const apiPath = '/presences'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { presenceId: string }): Promise; + /** + * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. + * + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(presenceId: string): Promise; + get( + paramsOrFirst: { presenceId: string } | string + ): Promise { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + 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 or update a presence log by its user ID. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise} + */ + upsert(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; + /** + * Create or update a presence log by its user ID. + * + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsert(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; + upsert( + paramsOrFirst: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] + ): Promise { + let params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + permissions: rest[2] as string[], + expiresAt: rest[3] as string, + metadata: rest[4] as object + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const permissions = params.permissions; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePresence(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; + /** + * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePresence(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; + updatePresence( + paramsOrFirst: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise { + let params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + expiresAt: rest[2] as string, + metadata: rest[3] as object, + permissions: rest[4] as string[], + purge: rest[5] as boolean + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + const permissions = params.permissions; + const purge = params.purge; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a presence log by its unique ID. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { presenceId: string }): Promise<{}>; + /** + * Delete a presence log by its unique ID. + * + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(presenceId: string): Promise<{}>; + delete( + paramsOrFirst: { presenceId: string } | string + ): Promise<{}> { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + 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, + ); + } +} diff --git a/src/services/project.ts b/src/services/project.ts index b818870..898b697 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,15 +2,16 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; -import { AuthMethod } from '../enums/auth-method'; -import { Scopes } from '../enums/scopes'; -import { OAuthProvider } from '../enums/o-auth-provider'; -import { ProjectPolicy } from '../enums/project-policy'; -import { ProtocolId } from '../enums/protocol-id'; -import { ServiceId } from '../enums/service-id'; -import { Secure } from '../enums/secure'; -import { EmailTemplateType } from '../enums/email-template-type'; -import { EmailTemplateLocale } from '../enums/email-template-locale'; +import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; +import { ProjectKeyScopes } from '../enums/project-key-scopes'; +import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; +import { ProjectOAuthProviderId } from '../enums/project-o-auth-provider-id'; +import { ProjectPolicyId } from '../enums/project-policy-id'; +import { ProjectProtocolId } from '../enums/project-protocol-id'; +import { ProjectServiceId } from '../enums/project-service-id'; +import { ProjectSMTPSecure } from '../enums/project-smtp-secure'; +import { ProjectEmailTemplateId } from '../enums/project-email-template-id'; +import { ProjectEmailTemplateLocale } from '../enums/project-email-template-locale'; export class Project { client: Client; @@ -19,6 +20,29 @@ export class Project { this.client = client; } + /** + * Get a project. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + get(): Promise { + + const apiPath = '/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, + ); + } + /** * Delete a project. * @@ -46,33 +70,33 @@ export class Project { /** * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * - * @param {AuthMethod} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {ProjectAuthMethodId} 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: AuthMethod, enabled: boolean }): Promise; + updateAuthMethod(params: { methodId: ProjectAuthMethodId, enabled: boolean }): Promise; /** * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * - * @param {AuthMethod} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {ProjectAuthMethodId} 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: AuthMethod, enabled: boolean): Promise; + updateAuthMethod(methodId: ProjectAuthMethodId, enabled: boolean): Promise; updateAuthMethod( - paramsOrFirst: { methodId: AuthMethod, enabled: boolean } | AuthMethod, + paramsOrFirst: { methodId: ProjectAuthMethodId, enabled: boolean } | ProjectAuthMethodId, ...rest: [(boolean)?] ): Promise { - let params: { methodId: AuthMethod, enabled: boolean }; + let params: { methodId: ProjectAuthMethodId, enabled: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: AuthMethod, enabled: boolean }; + params = (paramsOrFirst || {}) as { methodId: ProjectAuthMethodId, enabled: boolean }; } else { params = { - methodId: paramsOrFirst as AuthMethod, + methodId: paramsOrFirst as ProjectAuthMethodId, enabled: rest[0] as boolean }; } @@ -172,12 +196,12 @@ export class Project { * * @param {string} params.keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.name - Key name. Max length: 128 chars. - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. * @throws {AppwriteException} * @returns {Promise} */ - createKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise; + createKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], 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. * @@ -185,26 +209,26 @@ export class Project { * * @param {string} keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} name - Key name. Max length: 128 chars. - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise; + createKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise; createKey( - paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, - ...rest: [(string)?, (Scopes[])?, (string)?] + paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] ): Promise { - let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; } else { params = { keyId: paramsOrFirst as string, name: rest[0] as string, - scopes: rest[1] as Scopes[], + scopes: rest[1] as ProjectKeyScopes[], expire: rest[2] as string }; } @@ -257,35 +281,35 @@ export class 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 {ProjectKeyScopes[]} 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; + createEphemeralKey(params: { scopes: ProjectKeyScopes[], 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 {ProjectKeyScopes[]} 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(scopes: ProjectKeyScopes[], duration: number): Promise; createEphemeralKey( - paramsOrFirst: { scopes: Scopes[], duration: number } | Scopes[], + paramsOrFirst: { scopes: ProjectKeyScopes[], duration: number } | ProjectKeyScopes[], ...rest: [(number)?] ): Promise { - let params: { scopes: Scopes[], duration: number }; + let params: { scopes: ProjectKeyScopes[], duration: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { scopes: Scopes[], duration: number }; + params = (paramsOrFirst || {}) as { scopes: ProjectKeyScopes[], duration: number }; } else { params = { - scopes: paramsOrFirst as Scopes[], + scopes: paramsOrFirst as ProjectKeyScopes[], duration: rest[0] as number }; } @@ -378,37 +402,37 @@ export class Project { * * @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 {ProjectKeyScopes[]} 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; + updateKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], 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 {ProjectKeyScopes[]} 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(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise; updateKey( - paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, - ...rest: [(string)?, (Scopes[])?, (string)?] + paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] ): Promise { - let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; } else { params = { keyId: paramsOrFirst as string, name: rest[0] as string, - scopes: rest[1] as Scopes[], + scopes: rest[1] as ProjectKeyScopes[], expire: rest[2] as string }; } @@ -914,7 +938,7 @@ export class Project { * 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: + * @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} @@ -924,7 +948,7 @@ export class Project { * 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: + * @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} @@ -1062,7 +1086,7 @@ export class Project { * 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: + * @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} @@ -1073,7 +1097,7 @@ export class Project { * 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: + * @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} @@ -1136,7 +1160,7 @@ export class Project { * 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: + * @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} @@ -1147,7 +1171,7 @@ export class Project { * 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: + * @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} @@ -1210,7 +1234,7 @@ export class Project { * 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: + * @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} @@ -1220,7 +1244,7 @@ export class Project { * 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: + * @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} @@ -1277,7 +1301,7 @@ export class Project { * 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: + * @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} @@ -1287,7 +1311,7 @@ export class Project { * 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: + * @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} @@ -1344,7 +1368,7 @@ export class Project { * 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: + * @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} @@ -1354,7 +1378,7 @@ export class Project { * 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: + * @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} @@ -1411,7 +1435,7 @@ export class Project { * 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: + * @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} @@ -1421,7 +1445,7 @@ export class Project { * 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: + * @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} @@ -1478,7 +1502,7 @@ export class Project { * 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: + * @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} @@ -1488,7 +1512,7 @@ export class Project { * 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: + * @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} @@ -1545,7 +1569,7 @@ export class Project { * 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: + * @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} @@ -1555,7 +1579,7 @@ export class Project { * 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: + * @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} @@ -1612,7 +1636,7 @@ export class Project { * 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: + * @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} @@ -1622,7 +1646,7 @@ export class Project { * 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: + * @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} @@ -1679,7 +1703,7 @@ export class Project { * 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: + * @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} @@ -1689,7 +1713,7 @@ export class Project { * 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: + * @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} @@ -1746,7 +1770,7 @@ export class Project { * 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: + * @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} @@ -1756,7 +1780,7 @@ export class Project { * 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: + * @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} @@ -1813,7 +1837,7 @@ export class Project { * 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: + * @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} @@ -1823,7 +1847,7 @@ export class Project { * 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: + * @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} @@ -1880,7 +1904,7 @@ export class Project { * 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: + * @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} @@ -1890,7 +1914,7 @@ export class Project { * 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: + * @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} @@ -1947,7 +1971,7 @@ export class Project { * 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: + * @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} @@ -1958,7 +1982,7 @@ export class Project { * 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: + * @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} @@ -2021,7 +2045,7 @@ export class Project { * 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: + * @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} @@ -2031,7 +2055,7 @@ export class Project { * 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: + * @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} @@ -2088,7 +2112,7 @@ export class Project { * 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: + * @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} @@ -2099,7 +2123,7 @@ export class Project { * 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: + * @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} @@ -2162,41 +2186,45 @@ export class Project { * 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: + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {ProjectOAuth2GooglePrompt[]} params.prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. * @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; + updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], 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: + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {ProjectOAuth2GooglePrompt[]} prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. * @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(clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean): Promise; updateOAuth2Google( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean } | string, + ...rest: [(string)?, (ProjectOAuth2GooglePrompt[])?, (boolean)?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + let params: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, - enabled: rest[1] as boolean + prompt: rest[1] as ProjectOAuth2GooglePrompt[], + enabled: rest[2] as boolean }; } const clientId = params.clientId; const clientSecret = params.clientSecret; + const prompt = params.prompt; const enabled = params.enabled; @@ -2208,6 +2236,9 @@ export class Project { if (typeof clientSecret !== 'undefined') { payload['clientSecret'] = clientSecret; } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } @@ -2229,7 +2260,7 @@ export class Project { * 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: + * @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. @@ -2241,7 +2272,7 @@ export class Project { * 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: + * @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. @@ -2310,7 +2341,7 @@ export class Project { * 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: + * @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} @@ -2320,7 +2351,7 @@ export class Project { * 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: + * @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} @@ -2377,7 +2408,7 @@ export class Project { * 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: + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret * @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} @@ -2387,7 +2418,7 @@ export class Project { * 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: + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret * @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} @@ -2444,7 +2475,7 @@ export class Project { * 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: + * @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} @@ -2455,7 +2486,7 @@ export class Project { * 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: + * @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} @@ -2518,7 +2549,7 @@ export class Project { * 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: + * @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} @@ -2528,7 +2559,7 @@ export class Project { * 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: + * @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} @@ -2585,7 +2616,7 @@ export class Project { * 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: + * @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 @@ -2599,7 +2630,7 @@ export class Project { * 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: + * @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 @@ -2680,7 +2711,7 @@ export class Project { * 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: + * @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. @@ -2692,7 +2723,7 @@ export class Project { * 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: + * @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. @@ -2761,7 +2792,7 @@ export class Project { * 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: + * @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} @@ -2771,7 +2802,7 @@ export class Project { * 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: + * @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} @@ -2828,7 +2859,7 @@ export class Project { * 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: + * @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} @@ -2838,7 +2869,7 @@ export class Project { * 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: + * @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} @@ -2895,7 +2926,7 @@ export class Project { * 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: + * @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} @@ -2905,7 +2936,7 @@ export class Project { * 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: + * @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} @@ -2962,7 +2993,7 @@ export class Project { * 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: + * @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} @@ -2972,7 +3003,7 @@ export class Project { * 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: + * @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} @@ -3029,7 +3060,7 @@ export class Project { * 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: + * @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} @@ -3039,7 +3070,7 @@ export class Project { * 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: + * @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} @@ -3096,7 +3127,7 @@ export class Project { * 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: + * @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} @@ -3106,7 +3137,7 @@ export class Project { * 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: + * @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} @@ -3163,7 +3194,7 @@ export class Project { * 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: + * @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} @@ -3173,7 +3204,7 @@ export class Project { * 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: + * @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} @@ -3230,7 +3261,7 @@ export class Project { * 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: + * @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} @@ -3240,7 +3271,7 @@ export class Project { * 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: + * @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} @@ -3297,7 +3328,7 @@ export class Project { * 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: + * @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} @@ -3307,7 +3338,7 @@ export class Project { * 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: + * @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} @@ -3364,7 +3395,7 @@ export class Project { * 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: + * @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} @@ -3374,7 +3405,7 @@ export class Project { * 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: + * @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} @@ -3431,7 +3462,7 @@ export class Project { * 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: + * @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} @@ -3441,7 +3472,7 @@ export class Project { * 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: + * @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} @@ -3498,7 +3529,7 @@ export class Project { * 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: + * @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} @@ -3508,7 +3539,7 @@ export class Project { * 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: + * @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} @@ -3565,7 +3596,7 @@ export class Project { * 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: + * @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} @@ -3575,7 +3606,7 @@ export class Project { * 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: + * @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} @@ -3632,7 +3663,7 @@ export class Project { * 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: + * @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} @@ -3642,7 +3673,7 @@ export class Project { * 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: + * @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} @@ -3699,7 +3730,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @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: + * @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} @@ -3709,7 +3740,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: + * @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} @@ -3766,7 +3797,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @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: + * @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} @@ -3776,7 +3807,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: + * @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} @@ -3832,30 +3863,30 @@ export class Project { /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {OAuthProvider} params.providerId - OAuth2 provider key. For example: github, google, apple. + * @param {ProjectOAuthProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} */ - getOAuth2Provider(params: { providerId: OAuthProvider }): Promise; + getOAuth2Provider(params: { providerId: ProjectOAuthProviderId }): Promise; /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {OAuthProvider} providerId - OAuth2 provider key. For example: github, google, apple. + * @param {ProjectOAuthProviderId} providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getOAuth2Provider(providerId: OAuthProvider): Promise; + getOAuth2Provider(providerId: ProjectOAuthProviderId): Promise; getOAuth2Provider( - paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider + paramsOrFirst: { providerId: ProjectOAuthProviderId } | ProjectOAuthProviderId ): Promise { - let params: { providerId: OAuthProvider }; + let params: { providerId: ProjectOAuthProviderId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; + params = (paramsOrFirst || {}) as { providerId: ProjectOAuthProviderId }; } else { params = { - providerId: paramsOrFirst as OAuthProvider + providerId: paramsOrFirst as ProjectOAuthProviderId }; } @@ -4846,6 +4877,171 @@ export class Project { ); } + /** + * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block aliased emails during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDenyAliasedEmailPolicy(params: { enabled: boolean }): Promise; + /** + * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block aliased emails during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyAliasedEmailPolicy(enabled: boolean): Promise; + updateDenyAliasedEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-aliased-email'; + 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, + ); + } + + /** + * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise; + /** + * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyDisposableEmailPolicy(enabled: boolean): Promise; + updateDenyDisposableEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-disposable-email'; + 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, + ); + } + + /** + * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise; + /** + * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyFreeEmailPolicy(enabled: boolean): Promise; + updateDenyFreeEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-free-email'; + 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, + ); + } + /** * 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.. * @@ -5374,30 +5570,30 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicy} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicy }): Promise; + getPolicy(params: { policyId: ProjectPolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicy} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-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: ProjectPolicy): Promise; + getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( - paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy + paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId ): Promise { - let params: { policyId: ProjectPolicy }; + let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; + params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; } else { params = { - policyId: paramsOrFirst as ProjectPolicy + policyId: paramsOrFirst as ProjectPolicyId }; } @@ -5425,33 +5621,33 @@ export class Project { /** * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. * - * @param {ProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {ProjectProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket * @param {boolean} params.enabled - Protocol status. * @throws {AppwriteException} * @returns {Promise} */ - updateProtocol(params: { protocolId: ProtocolId, enabled: boolean }): Promise; + updateProtocol(params: { protocolId: ProjectProtocolId, enabled: boolean }): Promise; /** * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. * - * @param {ProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {ProjectProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket * @param {boolean} enabled - Protocol status. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateProtocol(protocolId: ProtocolId, enabled: boolean): Promise; + updateProtocol(protocolId: ProjectProtocolId, enabled: boolean): Promise; updateProtocol( - paramsOrFirst: { protocolId: ProtocolId, enabled: boolean } | ProtocolId, + paramsOrFirst: { protocolId: ProjectProtocolId, enabled: boolean } | ProjectProtocolId, ...rest: [(boolean)?] ): Promise { - let params: { protocolId: ProtocolId, enabled: boolean }; + let params: { protocolId: ProjectProtocolId, enabled: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { protocolId: ProtocolId, enabled: boolean }; + params = (paramsOrFirst || {}) as { protocolId: ProjectProtocolId, enabled: boolean }; } else { params = { - protocolId: paramsOrFirst as ProtocolId, + protocolId: paramsOrFirst as ProjectProtocolId, enabled: rest[0] as boolean }; } @@ -5488,33 +5684,33 @@ export class Project { /** * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * - * @param {ServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging + * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor * @param {boolean} params.enabled - Service status. * @throws {AppwriteException} * @returns {Promise} */ - updateService(params: { serviceId: ServiceId, enabled: boolean }): Promise; + updateService(params: { serviceId: ProjectServiceId, enabled: boolean }): Promise; /** * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * - * @param {ServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging + * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor * @param {boolean} enabled - Service status. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateService(serviceId: ServiceId, enabled: boolean): Promise; + updateService(serviceId: ProjectServiceId, enabled: boolean): Promise; updateService( - paramsOrFirst: { serviceId: ServiceId, enabled: boolean } | ServiceId, + paramsOrFirst: { serviceId: ProjectServiceId, enabled: boolean } | ProjectServiceId, ...rest: [(boolean)?] ): Promise { - let params: { serviceId: ServiceId, enabled: boolean }; + let params: { serviceId: ProjectServiceId, enabled: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId: ServiceId, enabled: boolean }; + params = (paramsOrFirst || {}) as { serviceId: ProjectServiceId, enabled: boolean }; } else { params = { - serviceId: paramsOrFirst as ServiceId, + serviceId: paramsOrFirst as ProjectServiceId, enabled: rest[0] as boolean }; } @@ -5559,12 +5755,12 @@ export class Project { * @param {string} params.senderName - Name shown in inbox as the sender of the email. * @param {string} params.replyToEmail - Email used when user replies to the email. * @param {string} params.replyToName - Name used when user replies to the email. - * @param {Secure} params.secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. + * @param {ProjectSMTPSecure} params.secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. * @param {boolean} params.enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. * @throws {AppwriteException} * @returns {Promise} */ - updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean }): Promise; + updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }): Promise; /** * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. * @@ -5576,21 +5772,21 @@ export class Project { * @param {string} senderName - Name shown in inbox as the sender of the email. * @param {string} replyToEmail - Email used when user replies to the email. * @param {string} replyToName - Name used when user replies to the email. - * @param {Secure} secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. + * @param {ProjectSMTPSecure} secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. * @param {boolean} enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSMTP(host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean): Promise; + updateSMTP(host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean): Promise; updateSMTP( - paramsOrFirst?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean } | string, - ...rest: [(number)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (Secure)?, (boolean)?] + paramsOrFirst?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean } | string, + ...rest: [(number)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (ProjectSMTPSecure)?, (boolean)?] ): Promise { - let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean }; + let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean }; + params = (paramsOrFirst || {}) as { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; } else { params = { host: paramsOrFirst as string, @@ -5601,7 +5797,7 @@ export class Project { senderName: rest[4] as string, replyToEmail: rest[5] as string, replyToName: rest[6] as string, - secure: rest[7] as Secure, + secure: rest[7] as ProjectSMTPSecure, enabled: rest[8] as boolean }; } @@ -5781,8 +5977,8 @@ export class Project { /** * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. * - * @param {EmailTemplateType} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {EmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. * @param {string} params.subject - Subject of the email template. Can be up to 255 characters. * @param {string} params.message - Plain or HTML body of the email template message. Can be up to 10MB of content. * @param {string} params.senderName - Name of the email sender. @@ -5792,12 +5988,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise; + updateEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise; /** * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. * - * @param {EmailTemplateType} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {EmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. * @param {string} subject - Subject of the email template. Can be up to 255 characters. * @param {string} message - Plain or HTML body of the email template message. Can be up to 10MB of content. * @param {string} senderName - Name of the email sender. @@ -5808,19 +6004,19 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailTemplate(templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string): Promise; + updateEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string): Promise; updateEmailTemplate( - paramsOrFirst: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string } | EmailTemplateType, - ...rest: [(EmailTemplateLocale)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string } | ProjectEmailTemplateId, + ...rest: [(ProjectEmailTemplateLocale)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] ): Promise { - let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; + let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst || 'subject' in paramsOrFirst || 'message' in paramsOrFirst || 'senderName' in paramsOrFirst || 'senderEmail' in paramsOrFirst || 'replyToEmail' in paramsOrFirst || 'replyToName' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; + params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; } else { params = { - templateId: paramsOrFirst as EmailTemplateType, - locale: rest[0] as EmailTemplateLocale, + templateId: paramsOrFirst as ProjectEmailTemplateId, + locale: rest[0] as ProjectEmailTemplateLocale, subject: rest[1] as string, message: rest[2] as string, senderName: rest[3] as string, @@ -5886,34 +6082,34 @@ export class Project { /** * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. * - * @param {EmailTemplateType} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {EmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. * @throws {AppwriteException} * @returns {Promise} */ - getEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }): Promise; + getEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }): Promise; /** * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. * - * @param {EmailTemplateType} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {EmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getEmailTemplate(templateId: EmailTemplateType, locale?: EmailTemplateLocale): Promise; + getEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale): Promise; getEmailTemplate( - paramsOrFirst: { templateId: EmailTemplateType, locale?: EmailTemplateLocale } | EmailTemplateType, - ...rest: [(EmailTemplateLocale)?] + paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale } | ProjectEmailTemplateId, + ...rest: [(ProjectEmailTemplateLocale)?] ): Promise { - let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; + let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; + params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; } else { params = { - templateId: paramsOrFirst as EmailTemplateType, - locale: rest[0] as EmailTemplateLocale + templateId: paramsOrFirst as ProjectEmailTemplateId, + locale: rest[0] as ProjectEmailTemplateLocale }; } diff --git a/src/services/usage.ts b/src/services/usage.ts new file mode 100644 index 0000000..84c654a --- /dev/null +++ b/src/services/usage.ts @@ -0,0 +1,130 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Usage { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listEvents(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @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. + */ + listEvents(queries?: string[], total?: boolean): Promise; + listEvents( + 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 = '/usage/events'; + 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, + ); + } + + /** + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listGauges(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @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. + */ + listGauges(queries?: string[], total?: boolean): Promise; + listGauges( + 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 = '/usage/gauges'; + 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, + ); + } +} diff --git a/test/services/advisor.test.js b/test/services/advisor.test.js new file mode 100644 index 0000000..5160f13 --- /dev/null +++ b/test/services/advisor.test.js @@ -0,0 +1,111 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Advisor } = require("../../dist/services/advisor"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Advisor', () => { + const client = new Client(); + const advisor = new Advisor(client); + + + test('test method listReports()', async () => { + const data = { + 'total': 5, + 'reports': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.listReports( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getReport()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'type': 'lighthouse', + 'title': 'Lighthouse audit for https://appwrite.io/', + 'summary': 'Performance score 78. 4 opportunities found.', + 'targetType': 'urls', + 'target': 'https://appwrite.io/', + 'categories': [], + 'insights': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.getReport( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteReport()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.deleteReport( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listInsights()', async () => { + const data = { + 'total': 5, + 'insights': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.listInsights( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInsight()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'reportId': '5e5ea5c16897e', + 'type': 'tablesDBIndex', + 'severity': 'warning', + 'status': 'active', + 'resourceType': 'databases', + 'resourceId': 'main', + 'parentResourceType': 'tables', + 'parentResourceId': 'orders', + 'title': 'Missing index on collection orders', + 'summary': 'Queries against `orders.status` are scanning the full collection.', + 'ctas': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.getInsight( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/presences.test.js b/test/services/presences.test.js new file mode 100644 index 0000000..2b43154 --- /dev/null +++ b/test/services/presences.test.js @@ -0,0 +1,104 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Presences } = require("../../dist/services/presences"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Presences', () => { + const client = new Client(); + const presences = new Presences(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'presences': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.get( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsert()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.upsert( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePresence()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.updatePresence( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.delete( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/project.test.js b/test/services/project.test.js index 51cedbd..29a4071 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -10,6 +10,46 @@ describe('Project', () => { const project = new Project(client); + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'billingLimits': {}, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { const data = {message: ""}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -29,37 +69,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -75,33 +85,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -251,37 +237,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -297,33 +253,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -445,7 +377,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - 'clientSecret': '',}; + 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Amazon( @@ -481,7 +413,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'OaOkIA000000000000000000005KLSYq', - 'clientSecret': '', + 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', 'endpoint': 'example.us.auth0.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -499,7 +431,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret': '', + 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', 'endpoint': 'example.authentik.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -517,7 +449,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '5zw90v00000000000000000000kVYXN7', - 'clientSecret': '',}; + 'clientSecret': '7I000000000000MW',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Autodesk( @@ -534,7 +466,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'key': 'Knt70000000000ByRc', - 'secret': '',}; + 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Bitbucket( @@ -551,7 +483,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'd95151000000000000000000000000000067af9b', - 'clientSecret': '',}; + 'clientSecret': 'a13e250000000000000000000000000000d73095',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Bitly( @@ -568,7 +500,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'deglcs00000000000000000000x2og6y', - 'clientSecret': '',}; + 'clientSecret': 'OKM1f100000000000000000000eshEif',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Box( @@ -585,7 +517,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'apiKey': '07a9000000000000067f', - 'apiSecret': '',}; + 'apiSecret': 'a399a90000000000000000000000000000d90639',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Dailymotion( @@ -602,7 +534,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '950722000000343754', - 'clientSecret': '',}; + 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Discord( @@ -619,7 +551,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - 'secretKey': '',}; + 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Disqus( @@ -636,7 +568,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'appKey': 'jl000000000009t', - 'appSecret': '',}; + 'appSecret': 'g200000000000vw',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Dropbox( @@ -653,7 +585,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'keyString': 'nsgzxh0000000000008j85a2', - 'sharedSecret': '',}; + 'sharedSecret': 'tp000000ru',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Etsy( @@ -670,7 +602,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'appId': '260600000007694', - 'appSecret': '',}; + 'appSecret': '2d0b2800000000000000000000d38af4',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Facebook( @@ -687,7 +619,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'byay5H0000000000VtiI40', - 'clientSecret': '',}; + 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Figma( @@ -704,7 +636,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret': '', + 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', 'endpoint': 'example.fusionauth.io',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -722,7 +654,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'e4d87900000000540733', - 'clientSecret': '',}; + 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2GitHub( @@ -739,7 +671,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret': '', + 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', 'endpoint': 'https://gitlab.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -757,7 +689,8 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret': '',}; + 'clientSecret': 'example-google-client-secret', + 'prompt': [],}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Google( @@ -774,7 +707,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'appwrite-o0000000st-app', - 'clientSecret': '', + 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', 'endpoint': 'keycloak.example.com', 'realmName': 'appwrite-realm',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -793,7 +726,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '01KQ7C00000000000001MFHS32', - 'clientSecret': '',}; + 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Kick( @@ -810,7 +743,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '770000000000dv', - 'primaryClientSecret': '',}; + 'primaryClientSecret': 'example-linkedin-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Linkedin( @@ -827,7 +760,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': '', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', 'tenant': 'common',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -845,7 +778,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', - 'oauthClientSecret': '',}; + 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Notion( @@ -862,7 +795,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', - 'clientSecret': '', + 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', 'authorizationURL': 'https://myoauth.com/oauth2/authorize', 'tokenURL': 'https://myoauth.com/oauth2/token', @@ -883,7 +816,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '0oa00000000000000698', - 'clientSecret': '', + 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', 'domain': 'trial-6400025.okta.com', 'authorizationServerId': 'aus000000000000000h7z',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -902,7 +835,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': '',}; + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Paypal( @@ -919,7 +852,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': '',}; + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2PaypalSandbox( @@ -936,7 +869,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'appwrite-oauth-test-app', - 'clientSecret': '',}; + 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Podio( @@ -953,7 +886,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', - 'customerSecret': '',}; + 'customerSecret': '3w000000000000e2',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Salesforce( @@ -970,7 +903,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '23000000089.15000000000023', - 'clientSecret': '',}; + 'clientSecret': '81656000000000000000000000f3d2fd',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Slack( @@ -987,7 +920,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '6ec271000000000000000000009beace', - 'clientSecret': '',}; + 'clientSecret': 'db068a000000000000000000008b5b9f',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Spotify( @@ -1004,7 +937,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'ca_UKibXX0000000000000000000006byvR', - 'apiSecretKey': '',}; + 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Stripe( @@ -1021,7 +954,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '',}; + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Tradeshift( @@ -1038,7 +971,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '',}; + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2TradeshiftSandbox( @@ -1055,7 +988,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'vvi0in000000000000000000ikmt9p', - 'clientSecret': '',}; + 'clientSecret': 'pmapue000000000000000000zylw3v',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Twitch( @@ -1072,7 +1005,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '130005', - 'clientSecret': '',}; + 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2WordPress( @@ -1089,7 +1022,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'customerKey': 'slzZV0000000000000NFLaWT', - 'secretKey': '',}; + 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2X( @@ -1106,7 +1039,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', - 'clientSecret': '',}; + 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Yahoo( @@ -1123,7 +1056,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '6a8a6a0000000000000000000091483c', - 'clientSecret': '',}; + 'clientSecret': 'bbf98500000000000000000000c75a63',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Yandex( @@ -1140,7 +1073,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '1000.83C178000000000000000000RPNX0B', - 'clientSecret': '',}; + 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Zoho( @@ -1157,7 +1090,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'QMAC00000000000000w0AQ', - 'clientSecret': '',}; + 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Zoom( @@ -1174,7 +1107,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': '', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', 'tenant': 'common',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1472,43 +1405,136 @@ describe('Project', () => { expect(response).toEqual(data); }); + test('test method updateDenyAliasedEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'billingLimits': {}, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyAliasedEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDenyDisposableEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'billingLimits': {}, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyDisposableEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDenyFreeEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'billingLimits': {}, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyFreeEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateMembershipPrivacyPolicy()', async () => { const data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1524,33 +1550,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -1572,37 +1574,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1618,33 +1590,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -1667,37 +1615,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1713,33 +1631,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -1762,37 +1656,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1808,33 +1672,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -1857,37 +1697,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1903,33 +1713,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -1952,37 +1738,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -1998,33 +1754,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2047,37 +1779,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2093,33 +1795,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2142,37 +1820,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2188,33 +1836,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2237,37 +1861,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2283,33 +1877,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2352,37 +1922,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2398,33 +1938,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2448,37 +1964,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2494,33 +1980,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], @@ -2544,37 +2006,7 @@ describe('Project', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'name': 'New Project', - 'description': 'This is a new project.', 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], 'devKeys': [], 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', @@ -2590,33 +2022,9 @@ describe('Project', () => { 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, + 'authMethods': [], + 'services': [], + 'protocols': [], 'region': 'fra', 'billingLimits': {}, 'blocks': [], diff --git a/test/services/usage.test.js b/test/services/usage.test.js new file mode 100644 index 0000000..0d0428f --- /dev/null +++ b/test/services/usage.test.js @@ -0,0 +1,42 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Usage } = require("../../dist/services/usage"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Usage', () => { + const client = new Client(); + const usage = new Usage(client); + + + test('test method listEvents()', async () => { + const data = { + 'total': 5, + 'events': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await usage.listEvents( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listGauges()', async () => { + const data = { + 'total': 5, + 'gauges': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await usage.listGauges( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + })